示例#1
0
        private void UpdateWorker()
        {
            PersonProxy workerToUpdate = new PersonProxy();

            workerToUpdate.ID         = int.Parse(dataGridView1.CurrentRow.Cells["PersonId"].Value.ToString());
            workerToUpdate.LastName   = dataGridView1.CurrentRow.Cells["PersonLastName"].Value.ToString();
            workerToUpdate.FirstName  = dataGridView1.CurrentRow.Cells["PersonFirstName"].Value.ToString();
            workerToUpdate.Patronymic = dataGridView1.CurrentRow.Cells["PersonPatronymic"].Value.ToString();
            switch (dataGridView1.CurrentRow.Cells["PersonGender"].Value.ToString())
            {
            case "Муж":
            {
                workerToUpdate.Gender = true;
                break;
            }

            case "Жен":
            {
                workerToUpdate.Gender = false;
                break;
            }
            }
            workerToUpdate.BirthDate =
                DateTime.Parse(dataGridView1.CurrentRow.Cells["PersonBirthDate"].Value.ToString());

            WorkerInfoForm workerInfo = new WorkerInfoForm(workerToUpdate, true);

            //workerInfo.MdiParent = this.MdiParent;
            workerInfo.Text = "Редактирование сотрудника";
            if (workerInfo.ShowDialog() == DialogResult.OK)
            {
                FillDataGridView();
            }
        }
示例#2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            WorkerInfoForm workerInfo = new WorkerInfoForm(false);

            //workerInfo.MdiParent = this.MdiParent;
            workerInfo.Text = "Добавление сотрудника";
            if (workerInfo.ShowDialog() == DialogResult.OK)
            {
                FillDataGridView();
            }
        }