Пример #1
0
 public Applicant(String RegNumber,
     String FirstName, String SecondName, String LastName,
     String BirthDate, String BirthPlace, Address Address_,
     String Citizenship, String Passport, String Serial, String Number, String PassportIssuedDate,
     String HomePhone, String LearningForm, String Funding,
     Specialization[] Specs, String Education, String EducationDocument, String NumberOfEducationDocument, String EducationIssuedDate,
     EnteranceExamination[] EnteranceExaminations,
     bool AllowUniversityExams, String Grounds,
     String Facilities, String Olimpiads,
     bool NeedDorm, String IssuedUniversityEducation,
     bool MATICourses, bool MATISchool, bool Attest, String Sex, String SchoolType, String SchoolName)
 {
     this.RegNumber = RegNumber;
     this.FirstName = FirstName;
     this.SecondName = SecondName;
     this.LastName = LastName;
     this.BirthDate = BirthDate;
     this.BirthPlace = BirthPlace;
     this.Address_ = Address_;
     this.Citizenship = Citizenship;
     this.Passport = Passport;
     this.Serial = Serial;
     this.Number = Number;
     this.PassportIssuedDate = PassportIssuedDate;
     this.HomePhone = HomePhone;
     this.LearningForm = LearningForm;
     this.Funding = Funding;
     this.Specs = Specs;
     this.Education = Education;
     this.EducationDocument = EducationDocument;
     this.NumberOfEducationDocument = NumberOfEducationDocument;
     this.EducationIssuedDate = EducationIssuedDate;
     this.EnteranceExaminations = EnteranceExaminations;
     this.AllowUniversityExams = AllowUniversityExams;
     this.Grounds = Grounds;
     this.Facilities = Facilities;
     this.Olimpiads = Olimpiads;
     this.NeedDorm = NeedDorm;
     this.IssuedUniversityEducation = IssuedUniversityEducation;
     this.MATICourses = MATICourses;
     this.MATISchool = MATISchool;
     this.Attest = Attest;
     this.Sex = Sex;
     this.SchoolType = SchoolType;
     this.SchoolName = SchoolName;
 }
Пример #2
0
        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!
            }
        }