示例#1
0
 /// <summary>
 /// Загрузка фаила с сервером
 /// </summary>
 public static void FileLoad()
 {
     try
     {
         string path = @"\HelaMedical\HelaMedical\File\INC.INI";
         if (!File.Exists(path))
         {
             MessageBox.Show("Файл с нахождением информации по серверу не найден!" +
                             "\nУкажите место нахождение файла");
             path = OpenFile.Open_File();
         }
         string s = File.ReadAllText(path);
         DBConection.Select(s);
     }
     catch (Exception excep)
     {
         MessageBox.Show(excep.Message);
         ExcepLog.Excep(excep);
     }
 }
示例#2
0
 public static void ReadExcel_Alco()
 {
     try
     {
         string ExcelFilePath = OpenFile.Open_File();
         excelApp  = new Excel.Application();
         workBook  = excelApp.Workbooks.Open(ExcelFilePath);
         workSheet = (Worksheet)workBook.Worksheets.get_Item(1);
         range     = workSheet.UsedRange;
         for (int cCnt = 2; cCnt <= range.Rows.Count; cCnt++)
         {
             Alco alcos = new Alco
             {
                 FIO                          = Convert.ToString(workSheet.Cells[cCnt, 2].Value),
                 Sex                          = Convert.ToString(workSheet.Cells[cCnt, 3].Value),
                 Date                         = Convert.ToString(workSheet.Cells[cCnt, 4].Value),
                 RegionCenterBLR              = Convert.ToString(workSheet.Cells[cCnt, 5].Value),
                 RaenCenterBLR                = Convert.ToString(workSheet.Cells[cCnt, 6].Value),
                 Life                         = Convert.ToString(workSheet.Cells[cCnt, 7].Value),
                 Age                          = Convert.ToString(workSheet.Cells[cCnt, 8].Value),
                 FamilyStatus                 = Convert.ToString(workSheet.Cells[cCnt, 9].Value),
                 CostOfKids                   = Convert.ToString(workSheet.Cells[cCnt, 10].Value),
                 FamilyComposition            = Convert.ToString(workSheet.Cells[cCnt, 11].Value),
                 Education                    = Convert.ToString(workSheet.Cells[cCnt, 12].Value),
                 Profession                   = Convert.ToString(workSheet.Cells[cCnt, 13].Value),
                 TheSkillLevelOfTheProfession = Convert.ToString(workSheet.Cells[cCnt, 14].Value),
                 AddressOfRegistration        = Convert.ToString(workSheet.Cells[cCnt, 15].Value),
                 AddressAtTheTimeOfDeath      = Convert.ToString(workSheet.Cells[cCnt, 16].Value),
                 DataOfRegistration           = Convert.ToString(workSheet.Cells[cCnt, 17].Value),
                 ReRegistrationData           = Convert.ToString(workSheet.Cells[cCnt, 18].Value),
                 TypeOfRegistration           = Convert.ToString(workSheet.Cells[cCnt, 19].Value),
                 Heredity                     = Convert.ToString(workSheet.Cells[cCnt, 20].Value),
                 DisabilityGroup              = Convert.ToString(workSheet.Cells[cCnt, 21].Value),
                 DisabilityStatus             = Convert.ToString(workSheet.Cells[cCnt, 22].Value),
                 ReasonForDisability          = Convert.ToString(workSheet.Cells[cCnt, 23].Value),
                 WorksStatus                  = Convert.ToString(workSheet.Cells[cCnt, 24].Value),
                 AdmOtv                       = Convert.ToString(workSheet.Cells[cCnt, 25].Value),
                 UgOtv                        = Convert.ToString(workSheet.Cells[cCnt, 26].Value),
                 DlitsMLS                     = Convert.ToString(workSheet.Cells[cCnt, 27].Value),
                 Stat107                      = Convert.ToString(workSheet.Cells[cCnt, 28].Value),
                 StatUKRB                     = Convert.ToString(workSheet.Cells[cCnt, 29].Value),
                 RodPrav                      = Convert.ToString(workSheet.Cells[cCnt, 30].Value),
                 NomLTP                       = Convert.ToString(workSheet.Cells[cCnt, 31].Value),
                 LTPKol                       = Convert.ToString(workSheet.Cells[cCnt, 32].Value),
                 Hospitel                     = Convert.ToString(workSheet.Cells[cCnt, 33].Value),
                 EK = Convert.ToString(workSheet.Cells[cCnt, 34].Value),
                 DateOfDeregistration   = Convert.ToString(workSheet.Cells[cCnt, 35].Value),
                 DateOfDead             = Convert.ToString(workSheet.Cells[cCnt, 36].Value),
                 PlaceOfDead            = Convert.ToString(workSheet.Cells[cCnt, 37].Value),
                 DeathCertificate       = Convert.ToString(workSheet.Cells[cCnt, 38].Value),
                 CauseOfDead            = Convert.ToString(workSheet.Cells[cCnt, 39].Value),
                 DeathCategory          = Convert.ToString(workSheet.Cells[cCnt, 40].Value),
                 OpeningPlace           = Convert.ToString(workSheet.Cells[cCnt, 41].Value),
                 HistoryOfParasucicides = Convert.ToString(workSheet.Cells[cCnt, 42].Value),
                 FeaturesOfObservation  = Convert.ToString(workSheet.Cells[cCnt, 43].Value),
                 ExperienceAbuse        = Convert.ToString(workSheet.Cells[cCnt, 44].Value),
                 AlcoholicDrinks        = Convert.ToString(workSheet.Cells[cCnt, 45].Value),
                 IK = Convert.ToString(workSheet.Cells[cCnt, 46].Value),
                 DrugDiagnosisAlc  = Convert.ToString(workSheet.Cells[cCnt, 47].Value),
                 AgeOfRegistration = Convert.ToString(workSheet.Cells[cCnt, 48].Value),
                 AgeOfDead         = Convert.ToString(workSheet.Cells[cCnt, 49].Value),
                 DataInfo          = Convert.ToString(workSheet.Cells[cCnt, 50].Value),
                 Registrotor       = Convert.ToString(workSheet.Cells[cCnt, 51].Value)
             };
             AlcoholismPersona.Add(alcos);
         }
     }
     catch (Exception excep)
     {
         MessageBox.Show(excep.Message);
         ExcepLog.Excep(excep);
     }
     finally
     {
         workBook.Close();
         excelApp.Quit();
     }
 }