Esempio n. 1
0
 private void validatefile()
 {
     try
     {
         string location = ddlLocation2.SelectedValue.ToString();
         if (location.Equals("0"))
         {
             ShowMessage("Select Enginners Location", true);
         }
         else
         {
             if (FileUpload1.FileName.Trim().Equals(""))
             {
                 ShowMessage("Please Browse File to Upload", true);
             }
             else
             {
                 string path          = Path.GetFullPath(FileUpload1.FileName);
                 string fileName      = Path.GetFileName(FileUpload1.FileName);
                 string fileExtension = Path.GetExtension(fileName);
                 string extension     = fileExtension.ToUpper();
                 if (!extension.Equals(".CSV"))
                 {
                     ShowMessage("Invalid File Selected", true);
                 }
                 else
                 {
                     string folder      = data_file.GetSystemParameter(1);
                     string NewfilePath = folder + fileName;
                     FileUpload1.SaveAs(NewfilePath);
                     string output = Process_file.UploadEngineerList(NewfilePath, location);
                     if (output.Contains("SUCCESSFULLY"))
                     {
                         ShowMessage(output, false);
                         MultiView1.ActiveViewIndex = 0;
                         MultiView2.ActiveViewIndex = 0;
                         LoadFieldEngineers();
                     }
                     else
                     {
                         ShowMessage(output, true);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex.Message, true);
     }
 }