private void FillMasterRequest(Applicant NewApplicant, Master NewMaster) { ExcelForm.SetValue("AT1", NewApplicant.RegNumber); ExcelForm.SetValue("I5", NewApplicant.SecondName); ExcelForm.SetValue("I6", NewApplicant.FirstName); ExcelForm.SetValue("I7", NewApplicant.LastName); ExcelForm.SetValue("I8", NewApplicant.BirthDate); ExcelForm.SetValue("I9", NewApplicant.BirthPlace); ExcelForm.SetValue("P11", NewApplicant.Address_.Index + ", " + NewApplicant.Address_.Region + ", " + NewApplicant.Address_.Town); ExcelForm.SetValue("A12", NewApplicant.Address_.AppAddress); ExcelForm.SetValue("AL5", NewApplicant.Citizenship); ExcelForm.SetValue("AR6", NewApplicant.Passport); ExcelForm.SetValue("AK7", NewApplicant.Serial); ExcelForm.SetValue("AU7", NewApplicant.Number); ExcelForm.SetValue("Z9", NewApplicant.PassportIssuedDate); ExcelForm.SetValue("AL12", NewApplicant.HomePhone); ExcelForm.SetValue("C17", NewApplicant.LearningForm); ExcelForm.SetValue("Z17", NewApplicant.Funding); ExcelForm.SetValue("G23", NewMaster.University); ExcelForm.SetValue("G24", NewMaster.Diploma); if (NewApplicant.Specs[0] != null) { ExcelForm.SetValue("G15", NewMaster.Specs[0].Spec.Insert(6, ".068")); if (NewApplicant.Specs[0].Spec != "Неизвестно") ExcelForm.SetValue("G16", "№" + GetFacultyNumber(NewMaster.Specs[0].Faculty.ToArray()[0])); } ExcelForm.SetValue("V25", NewApplicant.Facilities); if (NewApplicant.NeedDorm == true) ExcelForm.SetValue("I27", "нуждаюсь"); else ExcelForm.SetValue("I27", "не нуждаюсь"); ExcelForm.SetValue("V20", NewApplicant.IssuedUniversityEducation); ExcelForm.SetValue("B40", DateTime.Today.ToString("dd.MM.yyyy")); ExcelForm.SetValue("M40", NewApplicant.SecondName + " " + NewApplicant.FirstName + " " + NewApplicant.LastName); }
private void GenerateDocuments(object sender, RoutedEventArgs e) { Address Addr = new Address(); Addr.Index = ControlIndex.Text; Addr.Region = ControlRegion.Text; Addr.Town = ControlTown.Text; Addr.AppAddress = ControlAddress.Text; List<EnteranceExamination> LExams = new List<EnteranceExamination>(); EnteranceExamination Exam = new EnteranceExamination(); if (ControlSubject1.SelectedIndex != -1) Exam.Subject = ControlSubject1.SelectedItem.ToString(); Exam.Points = ControlPoints1.Text; if (ControlEge1.IsChecked == true) { Exam.Ege = true; Exam.Olimp = false; } if (ControlOlimp1.IsChecked == true) { Exam.Ege = false; Exam.Olimp = true; } Exam.TitleAndNum = ControlTitleAndNum1.Text; Exam.DocumentIssuedDate = ControlDocumentIssuedDate1.Text; LExams.Add(Exam); Exam = new EnteranceExamination(); if (ControlSubject2.SelectedIndex != -1) Exam.Subject = ControlSubject2.SelectedItem.ToString(); Exam.Points = ControlPoints2.Text; if (ControlEge2.IsChecked == true) { Exam.Ege = true; Exam.Olimp = false; } if (ControlOlimp2.IsChecked == true) { Exam.Ege = false; Exam.Olimp = true; } Exam.TitleAndNum = ControlTitleAndNum2.Text; Exam.DocumentIssuedDate = ControlDocumentIssuedDate2.Text; LExams.Add(Exam); Exam = new EnteranceExamination(); if (ControlSubject3.SelectedIndex != -1) Exam.Subject = ControlSubject3.SelectedItem.ToString(); Exam.Points = ControlPoints3.Text; if (ControlEge3.IsChecked == true) { Exam.Ege = true; Exam.Olimp = false; } if (ControlOlimp3.IsChecked == true) { Exam.Ege = false; Exam.Olimp = true; } Exam.TitleAndNum = ControlTitleAndNum3.Text; Exam.DocumentIssuedDate = ControlDocumentIssuedDate3.Text; LExams.Add(Exam); Exam = new EnteranceExamination(); if (ControlSubject4.SelectedIndex != -1) Exam.Subject = ControlSubject4.SelectedItem.ToString(); Exam.Points = ControlPoints4.Text; if (ControlEge4.IsChecked == true) { Exam.Ege = true; Exam.Olimp = false; } if (ControlOlimp4.IsChecked == true) { Exam.Ege = false; Exam.Olimp = true; } Exam.TitleAndNum = ControlTitleAndNum4.Text; Exam.DocumentIssuedDate = ControlDocumentIssuedDate4.Text; LExams.Add(Exam); Exam = new EnteranceExamination(); if (ControlSubject5.SelectedIndex != -1) Exam.Subject = ControlSubject5.SelectedItem.ToString(); Exam.Points = ControlPoints5.Text; if (ControlEge5.IsChecked == true) { Exam.Ege = true; Exam.Olimp = false; } if (ControlOlimp5.IsChecked == true) { Exam.Ege = false; Exam.Olimp = true; } Exam.TitleAndNum = ControlTitleAndNum5.Text; Exam.DocumentIssuedDate = ControlDocumentIssuedDate5.Text; LExams.Add(Exam); EnterRegistrationNumber ERN = new EnterRegistrationNumber(); ERN.ShowDialog(); String RN = ERN.RegNumber; if(RN.Split(new Char[] { '-' }).Length != 3) { MessageBox.Show("Неправильный формат регистрационного номера."); return; } if (RN != "") { //OMFG begins Applicant NewApplicant = new Applicant( RN, ControlFirstName.Text, ControlSecondName.Text, ControlLastName.Text, ControlBirthDate.Text, ControlBirthPlace.Text, Addr, ControlCitizenship.Text, ControlPassport.Text, ControlSerial.Text, ControlNumber.Text, ControlPassportIssuedDate.Text, ControlHomePhone.Text, ControlLearningForm.Text, ControlFunding.Text, Specs, ControlEducation.Text, ControlTypeOfEducationDocument.Text, ControlNumberOfEducationDocument.Text, ControlEducationIssuedDate.Text, LExams.ToArray(), Convert.ToBoolean(ControlAllowUniversityExams.IsChecked), ControlGrounds.Text, ControlFacilities.Text, ControlOlimpiads.Text, Convert.ToBoolean(ControlNeedDorm.IsChecked), ControlIssuedUniversityEducation.Text, Convert.ToBoolean(ControlMATICourses.IsChecked), Convert.ToBoolean(ControlMATISchool.IsChecked), Convert.ToBoolean(ControlAttest.IsChecked), ControlSex.Text, ControlSchoolType.Text, ControlSchoolName.Text ); //OMFG ends if (Convert.ToBoolean(ControlMagistrProof.IsChecked)) { Master NewMaster = new Master( ControlMagistrUniversity.Text, ControlMagistrDiploma.Text, Specs ); GenerateMasterDocuments(NewApplicant, NewMaster); string[] split = NewApplicant.RegNumber.Split(new Char[] { '-' }); GenerateUSECheck(NewApplicant, GetFacultyNumber(split[0])); //USE means Unified State Exam, ЕГЭ короче } else { if (NewApplicant.LearningForm.Equals("очной")) { File.Copy(ProgramPath + @"Шаблоны\MainFormTemplate.xls", ProgramPath + @"Документы (оч)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); ExcelForm = new ExcelFunc(); ExcelForm.OpenDocument(ProgramPath + @"Документы (оч)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); } else if (NewApplicant.LearningForm.Equals("очно-заочной")) { File.Copy(ProgramPath + @"Шаблоны\MainFormTemplate.xls", ProgramPath + @"Документы (оч-заоч)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); ExcelForm = new ExcelFunc(); ExcelForm.OpenDocument(ProgramPath + @"Документы (оч-заоч)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); } else { if (File.Exists(ProgramPath + @"Документы (др)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls")) { MessageBoxResult result = MessageBox.Show(this, "Документ с таким именем уже существует и будет безвозвратно утерян. Продолжить?", "Предупреждение!", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No, MessageBoxOptions.None); if(result == MessageBoxResult.No) return; else File.Delete(ProgramPath + @"Документы (др)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); } File.Copy(ProgramPath + @"Шаблоны\MainFormTemplate.xls", ProgramPath + @"Документы (др)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); ExcelForm = new ExcelFunc(); ExcelForm.OpenDocument(ProgramPath + @"Документы (др)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); } FillExcelForm(NewApplicant); ExcelForm.OpenWorksheet(2); FillExcelRequest(NewApplicant); ExcelForm.OpenWorksheet(3); FillExcelFacultiesList(NewApplicant); ExcelForm.OpenWorksheet(4); FillExcelContract(NewApplicant); ExcelForm.OpenWorksheet(5); FillExcelLKS(NewApplicant); ExcelForm.OpenWorksheet(6); FillExcelProfile(NewApplicant); ExcelForm.OpenWorksheet(7); FillExcelListOfExams(NewApplicant); ExcelForm.OpenWorksheet(8); FillExcelReceipt(NewApplicant); ExcelForm.CloseDocument(); int Fac; if (NewApplicant.Specs[0] != null) { String SFac = NewApplicant.RegNumber.Remove(2, (NewApplicant.RegNumber.Length - 2)); SFac = GetFacultyNumber(SFac); Int32.TryParse(SFac, out Fac); FillSummary(0, NewApplicant); } } } try { ExcelForm.CloseDocument(); ExcelForm.Dispose(); } catch { // Тут нет костыля. Совсем. Иди отсюда мальчик. Или девочка. В общем, вали быстро! // It's a lion! Get in the car! } try { ExcelSummary.CloseDocument(); ExcelForm.Dispose(); } catch { // Тут нет костыля. Совсем. Иди отсюда мальчик. Или девочка. В общем, вали быстро! // It's a lion! Get in the car! } }
private void FillMasterReceipt(Applicant NewApplicant, Master NewMaster) { ExcelForm.SetValue("I4", NewApplicant.RegNumber); ExcelForm.SetValue("E5", NewApplicant.SecondName + " " + NewApplicant.FirstName + " " + NewApplicant.LastName); ExcelForm.SetValue("C11", DateTime.Today.ToString("dd.MM.yyyy")); }
private void FillMasterProfile(Applicant NewApplicant, Master NewMaster) { ExcelForm.SetValue("E3", NewApplicant.RegNumber); ExcelForm.SetValue("L10", NewApplicant.SecondName); ExcelForm.SetValue("L11", NewApplicant.FirstName); ExcelForm.SetValue("L12", NewApplicant.LastName); ExcelForm.SetValue("L13", NewApplicant.BirthDate); ExcelForm.SetValue("AL13", NewApplicant.Address_.Index + ", " + NewApplicant.Address_.Region + ", " + NewApplicant.Address_.Town + ", " + NewApplicant.Address_.AppAddress); ExcelForm.SetValue("L14", NewApplicant.Citizenship); ExcelForm.SetValue("Z11", NewApplicant.Education); ExcelForm.SetValue("AL15", NewApplicant.HomePhone); if (NewApplicant.Specs[0] != null) { ExcelForm.SetValue("U7", NewMaster.Specs[0].Spec.Insert(6, ".068")); if (NewApplicant.Specs[0].Spec != "Неизвестно") ExcelForm.SetValue("U6", "№" + GetFacultyNumber(NewMaster.Specs[0].Faculty.ToArray()[0])); } }
private void FillMasterListOfExams(Applicant NewApplicant, Master NewMaster) { ExcelForm.SetValue("AL4", NewApplicant.RegNumber); ExcelForm.SetValue("H8", NewApplicant.SecondName); ExcelForm.SetValue("H9", NewApplicant.FirstName); ExcelForm.SetValue("H10", NewApplicant.LastName); if (NewApplicant.Specs[0] != null) { ExcelForm.SetValue("H6", NewMaster.Specs[0].Spec.Insert(6, ".068")); if (NewApplicant.Specs[0].Spec != "Неизвестно") ExcelForm.SetValue("H5", "№" + GetFacultyNumber(NewMaster.Specs[0].Faculty.ToArray()[0])); } ExcelForm.SetValue("L15", DateTime.Today.ToString("dd.MM.yyyy")); }
private void FillMasterForm(Applicant NewApplicant, Master NewMaster) { ExcelForm.SetValue("B2", NewApplicant.RegNumber); ExcelForm.SetValue("B3", NewApplicant.SecondName); ExcelForm.SetValue("B4", NewApplicant.FirstName); ExcelForm.SetValue("B5", NewApplicant.LastName); ExcelForm.SetValue("B7", NewApplicant.BirthDate); ExcelForm.SetValue("B8", NewApplicant.BirthPlace); ExcelForm.SetValue("B17", NewApplicant.Address_.Index + ", " + NewApplicant.Address_.Region + ", " + NewApplicant.Address_.Town + ", " + NewApplicant.Address_.AppAddress); ExcelForm.SetValue("B6", NewApplicant.Citizenship); ExcelForm.SetValue("B11", NewApplicant.Passport); ExcelForm.SetValue("B12", NewApplicant.Serial); ExcelForm.SetValue("B13", NewApplicant.Number); ExcelForm.SetValue("B14", NewApplicant.PassportIssuedDate); ExcelForm.SetValue("B19", NewApplicant.HomePhone); ExcelForm.SetValue("B22", NewApplicant.LearningForm); ExcelForm.SetValue("B23", NewApplicant.Funding); ExcelForm.SetValue("B25", NewMaster.University); ExcelForm.SetValue("B26", NewMaster.Diploma); if (NewApplicant.Specs[0] != null) { ExcelForm.SetValue("B20", NewMaster.Specs[0].Spec.Insert(6, ".068")); if (NewApplicant.Specs[0].Spec != "Неизвестно") ExcelForm.SetValue("B21", "№" + GetFacultyNumber(NewMaster.Specs[0].Faculty.ToArray()[0])); } ExcelForm.SetValue("B28", NewApplicant.Facilities); if (NewApplicant.NeedDorm == true) ExcelForm.SetValue("B30", "нуждаюсь"); else ExcelForm.SetValue("B30", "не нуждаюсь"); ExcelForm.SetValue("B38", NewApplicant.IssuedUniversityEducation); ExcelForm.SetValue("B37", DateTime.Today.ToString("dd.MM.yyyy")); }
private void GenerateMasterDocuments(Applicant NewApplicant, Master NewMaster) { if (NewApplicant.LearningForm.Equals("очной")) { File.Copy(ProgramPath + @"Шаблоны\MasterTemplate.xls", ProgramPath + @"Документы (оч)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); ExcelForm = new ExcelFunc(); ExcelForm.OpenDocument(ProgramPath + @"Документы (оч)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); } else if (NewApplicant.LearningForm.Equals("очно-заочной")) { File.Copy(ProgramPath + @"Шаблоны\MasterTemplate.xls", ProgramPath + @"Документы (оч-заоч)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); ExcelForm = new ExcelFunc(); ExcelForm.OpenDocument(ProgramPath + @"Документы (оч-заоч)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); } else { File.Copy(ProgramPath + @"Шаблоны\MasterTemplate.xls", ProgramPath + @"Документы (др)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); ExcelForm = new ExcelFunc(); ExcelForm.OpenDocument(ProgramPath + @"Документы (др)\" + NewApplicant.SecondName + " " + NewApplicant.RegNumber + ".xls"); } ExcelForm.OpenWorksheet(1); FillMasterForm(NewApplicant, NewMaster); ExcelForm.OpenWorksheet(2); FillMasterRequest(NewApplicant, NewMaster); ExcelForm.OpenWorksheet(3); FillMasterListOfExams(NewApplicant, NewMaster); ExcelForm.OpenWorksheet(4); FillMasterProfile(NewApplicant, NewMaster); ExcelForm.OpenWorksheet(5); FillMasterReceipt(NewApplicant, NewMaster); int Fac; if (NewMaster.Specs[0] != null) { String SFac = GetFacultyNumber(NewMaster.Specs[0].Faculty.ToArray()[0]); Int32.TryParse(SFac, out Fac); FillSummary(Fac, NewApplicant); } ExcelForm.CloseDocument(); }