Exemplo n.º 1
0
        /// <summary>
        /// Нажатие кнопки Сохранить
        /// </summary>
        private void button5_Click(object sender, EventArgs e)
        {
            SelectedPerson.SurName          = surnameTB.Text;
            SelectedPerson.Name             = nameTB.Text;
            SelectedPerson.Patronomyc       = patronomycTB.Text;
            SelectedPerson.Telefon          = telefonTB.Text;
            SelectedPerson.Birthday         = dateTimePicker1.Value;
            SelectedPerson.BirthdayMesto    = birthdayMestoTB.Text;
            SelectedPerson.Country          = countryTB.Text;
            SelectedPerson.Addres           = adressTB.Text;
            SelectedPerson.AddresRegistry   = adresRegTB.Text;
            SelectedPerson.SubjectRF        = subjectRFTB.Text;
            SelectedPerson.VK               = vkTB.Text;
            SelectedPerson.Health           = healthTB.Text;
            SelectedPerson.HealtHron        = healthHronTB.Text;
            SelectedPerson.VUZ              = vuzTB.Text;
            SelectedPerson.VUZKor           = vuzKor.Text;
            SelectedPerson.Specialnost      = specialnostTB.Text;
            SelectedPerson.Diplom           = diplomTB.Text;
            SelectedPerson.SrBall           = double.Parse(srBallTB.Text);
            SelectedPerson.VKR              = vkrTB.Text;
            SelectedPerson.Soiskatelstvo    = soiscatelstvoCB.Checked ? 5 : 0;
            SelectedPerson.Exams            = examsTB.Text;
            SelectedPerson.Statiy[0]        = StatiyCLB.GetItemChecked(0) ? 5 : 0;
            SelectedPerson.Statiy[1]        = StatiyCLB.GetItemChecked(1) ? 4 : 0;
            SelectedPerson.Statiy[2]        = StatiyCLB.GetItemChecked(2) ? 3 : 0;
            SelectedPerson.Statiy[3]        = StatiyCLB.GetItemChecked(3) ? 1 : 0;
            SelectedPerson.Statiy[4]        = StatiyCLB.GetItemChecked(4) ? 1 : 0;
            SelectedPerson.Statiy[5]        = StatiyCLB.GetItemChecked(5) ? 0.5 : 0;
            SelectedPerson.Statya           = statiyNameTB.Text;
            SelectedPerson.Sience[0]        = OlympCLB.GetItemChecked(0) ? 4 : 0;
            SelectedPerson.Sience[1]        = OlympCLB.GetItemChecked(1) ? 4 : 0;
            SelectedPerson.Sience[2]        = OlympCLB.GetItemChecked(2) ? 3 : 0;
            SelectedPerson.Sience[3]        = OlympCLB.GetItemChecked(3) ? 3 : 0;
            SelectedPerson.Sience[4]        = OlympCLB.GetItemChecked(4) ? 3 : 0;
            SelectedPerson.Sience[5]        = OlympCLB.GetItemChecked(5) ? 2 : 0;
            SelectedPerson.Sience[6]        = OlympCLB.GetItemChecked(6) ? 1 : 0;
            SelectedPerson.SienceName       = sienceNameTB.Text;
            SelectedPerson.SienceStepen[0]  = KandCLB.GetItemChecked(0) ? 3 : 0;
            SelectedPerson.SienceStepen[1]  = KandCLB.GetItemChecked(1) ? 6 : 0;
            SelectedPerson.SienceStepen[2]  = KandCLB.GetItemChecked(2) ? 8 : 0;
            SelectedPerson.Work[0]          = WorkCLB.GetItemChecked(0) ? 2 : 0;
            SelectedPerson.Work[1]          = WorkCLB.GetItemChecked(1) ? 4 : 0;
            SelectedPerson.Work[2]          = WorkCLB.GetItemChecked(2) ? 6 : 0;
            SelectedPerson.WorkName         = workNameTB.Text;
            SelectedPerson.Sport[0]         = SportCLB.GetItemChecked(0) ? 4 : 0;
            SelectedPerson.Sport[1]         = SportCLB.GetItemChecked(1) ? 2 : 0;
            SelectedPerson.Prioritet[0]     = PrioritetCLB.GetItemChecked(0) ? 3 : 0;
            SelectedPerson.Prioritet[1]     = PrioritetCLB.GetItemChecked(1) ? 1 : 0;
            SelectedPerson.SportName        = sportNameTB.Text;
            SelectedPerson.Language         = languageTB.Text;
            SelectedPerson.Products         = productsTB.Text;
            SelectedPerson.Napravlenie      = napravlenieTB.Text;
            SelectedPerson.Dopusk           = dopuskTB.Text;
            SelectedPerson.TattooAndPirsing = tattooAndPirsingTB.Text;
            SelectedPerson.Rost             = double.TryParse(rostTB.Text, out double result1) ? result1 : SelectedPerson.Rost;
            SelectedPerson.Ves              = double.TryParse(vesTB.Text, out double result2) ? result2 : SelectedPerson.Ves;
            SelectedPerson.Family           = familyTB.Text;
            SelectedPerson.Info             = infoTB.Text;
            SelectedPerson.Reserv           = reservCB.Checked;
            SelectedPerson.Magistr          = magCB.Checked;
            SelectedPerson.Zachetka         = ZachetCB.Checked;
            SelectedPerson.Bakalavr         = BakCB.Checked;
            SelectedPerson.Ball             = SelectedPerson.ExecuteBall();
            ball.Text = SelectedPerson.Ball.ToString();

            /*if (!SelectedPerson.OK())
             * {
             *  MessageBox.Show("Введите все данные", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             *  return;
             * }*/

            _excel = new AccessExcel();
            _excel.DoAccess(PathFile);

            groupBox1.Enabled = false;
            groupBox2.Enabled = false;
            listBox1.Enabled  = true;
            changeBTN.Enabled = true;

            Persons.Sort(new NaturalStringComparer());
            Persons.Sort(new BallComparer());
            listBox1.Items.Clear();
            foreach (var person in Persons)
            {
                listBox1.Items.Add(person);
            }

            listBox1.SelectedItem = listBox1.Items.OfType <Person>().First(x => x.ID == SelectedPerson.ID);

            for (int i = 0; i < Persons.Count; i++)
            {
                _excel.WriteCell <string>(1, 1, "Дата изменения");
                int iRow = i + 2;
                var p    = Persons[i];
                int j    = 1;
                _excel.WriteCell <string>(iRow, j++, DateTime.Now.ToString("G"));
                _excel.WriteCell <string>(iRow, j++, p.URLPhoto);
                _excel.WriteCell <string>(iRow, j++, p.URLPhoto);
                _excel.WriteCell <string>(iRow, j++, p.URLSOGLASIE);
                _excel.WriteCell <string>(iRow, j++, p.SurName);
                _excel.WriteCell <string>(iRow, j++, p.Name);
                _excel.WriteCell <string>(iRow, j++, p.Patronomyc);
                _excel.WriteCell <string>(iRow, j++, p.Telefon);
                _excel.WriteCell <string>(iRow, j++, p.Birthday.ToShortDateString());
                _excel.WriteCell <string>(iRow, j++, p.BirthdayMesto);
                _excel.WriteCell <string>(iRow, j++, p.Country);
                _excel.WriteCell <string>(iRow, j++, p.Addres);
                _excel.WriteCell <string>(iRow, j++, p.AddresRegistry);
                _excel.WriteCell <string>(iRow, j++, p.SubjectRF);
                _excel.WriteCell <string>(iRow, j++, p.VK);
                _excel.WriteCell <string>(iRow, j++, p.Health);
                _excel.WriteCell <string>(iRow, j++, p.HealtHron);
                _excel.WriteCell <string>(iRow, j++, p.VUZ);
                _excel.WriteCell <string>(iRow, j++, p.VUZKor);
                _excel.WriteCell <string>(iRow, j++, p.Specialnost);
                _excel.WriteCell <string>(iRow, j++, p.Diplom);
                _excel.WriteCell <double>(iRow, j++, p.SrBall);
                _excel.WriteCell <string>(iRow, j++, p.VKR);
                _excel.WriteCell <string>(iRow, j++, p.Soiskatelstvo == 0 ? "Нет": "Да");
                _excel.WriteCell <string>(iRow, j++, p.Exams);
                _excel.WriteCell <string>(iRow, j++, p.Statiy[0] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Statiy[1] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Statiy[2] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Statiy[3] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Statiy[4] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Statiy[5] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Statya);
                _excel.WriteCell <string>(iRow, j++, p.Sience[0] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Sience[1] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Sience[2] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Sience[3] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Sience[4] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Sience[5] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Sience[6] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.SienceName);
                _excel.WriteCell <string>(iRow, j++, p.SienceStepen[0] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.SienceStepen[1] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.SienceStepen[2] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Work[0] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Work[1] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Work[2] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.WorkName);
                _excel.WriteCell <string>(iRow, j++, p.Sport[0] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.Sport[1] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, j++, p.SportName);
                _excel.WriteCell <string>(iRow, j++, p.Language);
                _excel.WriteCell <string>(iRow, j++, p.Products);
                _excel.WriteCell <string>(iRow, j++, p.Napravlenie);
                _excel.WriteCell <string>(iRow, j++, p.Dopusk);
                _excel.WriteCell <string>(iRow, j++, p.TattooAndPirsing);
                _excel.WriteCell <double>(iRow, j++, p.Rost);
                _excel.WriteCell <double>(iRow, j++, p.Ves);
                _excel.WriteCell <string>(iRow, j++, p.Family);
                _excel.WriteCell <string>(iRow, j++, p.Info);
                _excel.WriteCell <string>(iRow, 100, p.Prioritet[0] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, 101, p.Prioritet[1] == 0 ? "Нет" : "Есть");
                _excel.WriteCell <string>(iRow, 102, p.Reserv ? "Резерв" : "Основа");
                _excel.WriteCell <string>(iRow, 103, p.Magistr ? "Магистр" : p.Bakalavr ? "Бакалавр" : p.Zachetka ? "Зачетка" : "");
            }
            _excel.FinishAccess();
        }
Exemplo n.º 2
0
        /// <summary>
        /// метод при изменении выделенного кандидата
        /// </summary>
        private void listBox1_SelectedValueChanged(object sender, EventArgs e)
        {
            if ((Person)listBox1.SelectedItem != null)
            {
                changeBTN.Enabled       = true;
                SelectedPerson          = Persons.First(x => x.ID == ((Person)listBox1.SelectedItem).ID);
                ball.Text               = SelectedPerson.Ball.ToString();
                telefonTB.Text          = SelectedPerson.Telefon;
                birthdayMestoTB.Text    = SelectedPerson.BirthdayMesto;
                vuzTB.Text              = SelectedPerson.VUZ;
                specialnostTB.Text      = SelectedPerson.Specialnost;
                diplomTB.Text           = SelectedPerson.Diplom;
                vkrTB.Text              = SelectedPerson.VKR;
                soiscatelstvoCB.Checked = SelectedPerson.Soiskatelstvo != 0;
                examsTB.Text            = SelectedPerson.Exams;
                napravlenieTB.Text      = SelectedPerson.Napravlenie;
                dopuskTB.Text           = SelectedPerson.Dopusk;
                srBallTB.Text           = SelectedPerson.SrBall.ToString();
                familyTB.Text           = SelectedPerson.Family;
                tattooAndPirsingTB.Text = SelectedPerson.TattooAndPirsing;
                healthHronTB.Text       = SelectedPerson.HealtHron;
                subjectRFTB.Text        = SelectedPerson.SubjectRF;
                languageTB.Text         = SelectedPerson.Language;
                productsTB.Text         = SelectedPerson.Products;
                rostTB.Text             = SelectedPerson.Rost.ToString();
                vesTB.Text              = SelectedPerson.Ves.ToString();
                statiyNameTB.Text       = SelectedPerson.Statya;
                sienceNameTB.Text       = SelectedPerson.SienceName;
                workNameTB.Text         = SelectedPerson.WorkName;
                sportNameTB.Text        = SelectedPerson.SportName;
                countryTB.Text          = SelectedPerson.Country;
                surnameTB.Text          = SelectedPerson.SurName;
                nameTB.Text             = SelectedPerson.Name;
                patronomycTB.Text       = SelectedPerson.Patronomyc;
                adressTB.Text           = SelectedPerson.Addres;
                adresRegTB.Text         = SelectedPerson.AddresRegistry;
                vuzKor.Text             = SelectedPerson.VUZKor;
                vkTB.Text               = SelectedPerson.VK;
                healthTB.Text           = SelectedPerson.Health;
                infoTB.Text             = SelectedPerson.Info;
                dateTimePicker1.Value   = SelectedPerson.Birthday;
                reservCB.Checked        = SelectedPerson.Reserv;
                magCB.Checked           = SelectedPerson.Magistr;
                BakCB.Checked           = SelectedPerson.Bakalavr;
                ZachetCB.Checked        = SelectedPerson.Zachetka;
                //pictureBox1.Image = Image.FromFile(SelectedPerson.photoPath);

                for (int i = 0; i < SelectedPerson.Statiy.Length; i++)
                {
                    StatiyCLB.SetItemChecked(i, SelectedPerson.Statiy[i] != 0);
                }

                for (int i = 0; i < SelectedPerson.Sience.Length; i++)
                {
                    OlympCLB.SetItemChecked(i, SelectedPerson.Sience[i] != 0);
                }

                for (int i = 0; i < SelectedPerson.Work.Length; i++)
                {
                    WorkCLB.SetItemChecked(i, SelectedPerson.Work[i] != 0);
                }

                for (int i = 0; i < SelectedPerson.Sport.Length; i++)
                {
                    SportCLB.SetItemChecked(i, SelectedPerson.Sport[i] != 0);
                }

                for (int i = 0; i < SelectedPerson.SienceStepen.Length; i++)
                {
                    KandCLB.SetItemChecked(i, SelectedPerson.SienceStepen[i] != 0);
                }
                for (int i = 0; i < SelectedPerson.Prioritet.Length; i++)
                {
                    PrioritetCLB.SetItemChecked(i, SelectedPerson.Prioritet[i] != 0);
                }
            }
        }