Exemplo n.º 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);
     }
 }
Exemplo n.º 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();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Сохранение информации по выборке из отчета по полизависимости
        /// </summary>
        public static void Save_Report_Excel_Poliz(List <Polizavis> poliz)
        {
            int count = 0;

            for (int i = 0; i < poliz.Count; i++)
            {
                count++;
            }
            if (count > 0)
            {
                Excel.Application excelApp = new Excel.Application();
                Workbook          workBook;
                Worksheet         workSheet;
                string            ExcelFilePath = OpenFile.Save_File_Excel();
                if (!(File.Exists(ExcelFilePath)))
                {
                    workBook  = excelApp.Workbooks.Add(1);
                    workSheet = (Excel.Worksheet)workBook.Sheets[1];
                }
                else
                {
                    workBook  = excelApp.Workbooks.Open(ExcelFilePath);
                    workSheet = (Excel.Worksheet)workBook.Worksheets.get_Item(1);
                }
                // Получаем активную таблицу
                for (int i = 1; i <= poliz.Count; i++)
                {
                    int j = i - 1;
                    workSheet.Cells[i, 1]  = poliz[j].Id;
                    workSheet.Cells[i, 2]  = poliz[j].FIO;
                    workSheet.Cells[i, 3]  = poliz[j].Sex;
                    workSheet.Cells[i, 4]  = poliz[j].Date;
                    workSheet.Cells[i, 5]  = poliz[j].RegionCenterBLR;
                    workSheet.Cells[i, 6]  = poliz[j].RaenCentrBLR;
                    workSheet.Cells[i, 7]  = poliz[j].Life;
                    workSheet.Cells[i, 8]  = poliz[j].Age;
                    workSheet.Cells[i, 9]  = poliz[j].FamilyStatus;
                    workSheet.Cells[i, 10] = poliz[j].CostOfKids;
                    workSheet.Cells[i, 11] = poliz[j].FamilyComposition;
                    workSheet.Cells[i, 12] = poliz[j].Education;
                    workSheet.Cells[i, 13] = poliz[j].Profession;
                    workSheet.Cells[i, 14] = poliz[j].TheSkillLevelOfTheProfession;
                    workSheet.Cells[i, 15] = poliz[j].AddressOfRegistration;
                    workSheet.Cells[i, 16] = poliz[j].AddressAtTheTimeOfDeath;
                    workSheet.Cells[i, 17] = poliz[j].DataOfRegistration;
                    workSheet.Cells[i, 18] = poliz[j].ReRegistrationData;
                    workSheet.Cells[i, 19] = poliz[j].TypeOfRegistration;
                    workSheet.Cells[i, 20] = poliz[j].Heredity;
                    workSheet.Cells[i, 21] = poliz[j].DisabilityGroup;
                    workSheet.Cells[i, 22] = poliz[j].DisabilityStatus;
                    workSheet.Cells[i, 23] = poliz[j].ReasonForDisability;
                    workSheet.Cells[i, 24] = poliz[j].WorksStatus;
                    workSheet.Cells[i, 25] = poliz[j].AdmOtv;
                    workSheet.Cells[i, 26] = poliz[j].UgOtv;
                    workSheet.Cells[i, 27] = poliz[j].DlitsMLS;
                    workSheet.Cells[i, 28] = poliz[j].Stat107;
                    workSheet.Cells[i, 29] = poliz[j].StatUKRB;
                    workSheet.Cells[i, 30] = poliz[j].RodPrav;
                    workSheet.Cells[i, 31] = poliz[j].NomLTP;
                    workSheet.Cells[i, 32] = poliz[j].LTPKol;
                    workSheet.Cells[i, 33] = poliz[j].Hospitel;
                    workSheet.Cells[i, 34] = poliz[j].EK;
                    workSheet.Cells[i, 35] = poliz[j].DateOfDeregistration;
                    workSheet.Cells[i, 36] = poliz[j].DateOfDead;
                    workSheet.Cells[i, 37] = poliz[j].PlaceOfDead;
                    workSheet.Cells[i, 38] = poliz[j].DeathCertificate;
                    workSheet.Cells[i, 39] = poliz[j].CauseOfDead;
                    workSheet.Cells[i, 40] = poliz[j].DeathCategory;
                    workSheet.Cells[i, 41] = poliz[j].OpeningPlace;
                    workSheet.Cells[i, 42] = poliz[j].HistoryOfParasucicides;
                    workSheet.Cells[i, 43] = poliz[j].FeaturesOfObservation;
                    workSheet.Cells[i, 44] = poliz[j].ExperienceAbuse;
                    workSheet.Cells[i, 45] = poliz[j].AlcoholicDrinks;
                    workSheet.Cells[i, 46] = poliz[j].IK;
                    workSheet.Cells[i, 47] = poliz[j].DrugDiagnosisAlc;
                    workSheet.Cells[i, 48] = poliz[j].IntranozologicalComorbidity;
                    workSheet.Cells[i, 49] = poliz[j].TypeOfDrug;
                    workSheet.Cells[i, 50] = poliz[j].DrugUse;
                    workSheet.Cells[i, 51] = poliz[j].YearOfFirstUse;
                    workSheet.Cells[i, 52] = poliz[j].ExperienceAbuseDrug;
                    workSheet.Cells[i, 53] = poliz[j].Remissions;
                    workSheet.Cells[i, 54] = poliz[j].RemissionNumber;
                    workSheet.Cells[i, 55] = poliz[j].RemissionTimer;
                    workSheet.Cells[i, 56] = poliz[j].DrugDiagnosisX;
                    workSheet.Cells[i, 57] = poliz[j].AgeOfRegistration;
                    workSheet.Cells[i, 58] = poliz[j].AgeOfDead;
                    workSheet.Cells[i, 59] = poliz[j].DataInfo;
                    workSheet.Cells[i, 60] = poliz[j].Registrotor;
                }
                workBook.Save();
                workBook.Close();
                excelApp.Quit();
            }
            else
            {
                MessageBox.Show("Нет информации для создания отчета!!! Сформируйте отчет для записи информации в файл");
            }
        }