Paul Rajs

Paul Rajs

  • NA
  • 641
  • 148.3k

How to Read Mobile Number one by one in Excel cell value and set valid

Aug 28 2020 3:16 AM
Hi Friends , 
 
I am get excel sheet rows and columns value and insert db. by using the below code ...
Now i want to get the mobile number one by one and do mobile number validation for all rows and columns value one by one ...
 
If anyone knows how to solve this task kindly suggest me . 
 
am using the below code ... 
 
string folderPath = string.Format("{0}\\{1}\\{2}\\{3}\\Interaction\\", System.Configuration.ConfigurationManager.AppSettings["InteractionFileData"], DateTime.Now.ToString("yyyy"), DateTime.Now.ToString("MMM"), DateTime.Now.ToString("dd"));
if (!Directory.Exists(folderPath))
Directory.CreateDirectory(folderPath);
if (ReadSFTP(folderPath, ref message))
{
string[] Files = Directory.GetFiles(folderPath, "*.xlsx*")
.Select(path => Path.GetFileName(path))
.ToArray();
for (var i = 0; i < Files.Length; i++)
{
string fname = folderPath + Files[i];
DataTable dt = TRMFile.Models.Helper.GeneralHelper.ExcelToDataset(fname);
StringBuilder sb = new StringBuilder();
for (int row = 0; dt.Rows.Count > row; row++)
{
for (int column = 0; dt.Columns.Count > column; column++)
sb.AppendFormat("{0}#", dt.Rows[row][column]);
sb.Length--;
sb.Append("*");
}
StringBuilder sbRequest = new StringBuilder();
sbRequest.AppendFormat("<Request><Filename>{0}</Filename><TRMData>{1}</TRMData></Request>", Files[i], sb.ToString());
string responseXml = TRMFile.Models.Helper.GeneralHelper.SendService("TRMFileUpdation", TRMFile.Models.Helper.GeneralHelper.EncryptDecrypt(sbRequest.ToString(), 1));
string designationFolder = string.Format("{0}\\{1}\\{2}\\{3}\\Interaction_Backup\\", System.Configuration.ConfigurationManager.AppSettings["InteractionFileData"], DateTime.Now.ToString("yyyy"), DateTime.Now.ToString("MMM"), DateTime.Now.ToString("dd"));
MovetoBackupFolder(folderPath, designationFolder);
}
}
else
{
Models.Helper.GeneralHelper.Log_Handler(this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod().Name, "SFTP Failed", 1);
}
 
Thanking you 
Paul.S