Exemple #1
0
 private void btnEditEducation_Click(object sender, EventArgs e)
 {
     if (dgvEducation.SelectedRows.Count == 1)
     {
         int             row   = dgvEducation.SelectedRows[0].Index;
         string          id    = wi.education[row].id;
         WorkerEducation newWE = new WorkerEducation();
         newWE.id             = id;
         newWE.diplomaDate    = dpDiplomaDate.Value;
         newWE.diplomaNum     = tbDiplomaNum.Text;
         newWE.educationType  = cbEducation.SelectedItem.ToString();
         newWE.eduPlace       = tbEducationPlace.Text;
         newWE.faculty        = tbFaculty.Text;
         newWE.qualification  = tbQualification.Text;
         newWE.specialization = tbSpecialization.Text;
         if (okDB.editWorkerEducation(newWE))
         {
             dgvEducation.Rows[row].Cells[7].Value = newWE.diplomaDate.ToShortDateString();
             dgvEducation.Rows[row].Cells[6].Value = newWE.diplomaNum;
             dgvEducation.Rows[row].Cells[1].Value = newWE.educationType;
             dgvEducation.Rows[row].Cells[2].Value = newWE.eduPlace;
             dgvEducation.Rows[row].Cells[3].Value = newWE.faculty;
             dgvEducation.Rows[row].Cells[5].Value = newWE.qualification;
             dgvEducation.Rows[row].Cells[4].Value = newWE.specialization;
         }
         else
         {
             MessageBox.Show("Запись не была изменена");
         }
     }
     else
     {
         MessageBox.Show("Необходимо выделить в таблице запись для редактирования");
     }
 }
Exemple #2
0
        private void btnAddEducation_Click(object sender, EventArgs e)
        {
            WorkerEducation newWE = new WorkerEducation();

            newWE.diplomaDate    = dpDiplomaDate.Value;
            newWE.diplomaNum     = tbDiplomaNum.Text;
            newWE.educationType  = cbEducation.SelectedItem.ToString();
            newWE.eduPlace       = tbEducationPlace.Text;
            newWE.faculty        = tbFaculty.Text;
            newWE.qualification  = tbQualification.Text;
            newWE.specialization = tbSpecialization.Text;
            newWE = okDB.addWorkerEducation(newWE, wi.cardId);
            if (newWE != null)
            {
                wi.education.Add(newWE);
                dgvEducation.Rows.Add(newWE.id, newWE.educationType, newWE.eduPlace, newWE.faculty, newWE.specialization, newWE.qualification, newWE.diplomaNum, newWE.diplomaDate.ToShortDateString());
            }
            else
            {
                MessageBox.Show("Запись не была добавлена");
            }
        }