private void AddChildForm_Load(object sender, EventArgs e)
        {
            AddPatient main = this.Owner as AddPatient;

            if (main != null)
            {
                sexTB.SelectedItem = main.Child.Rows[id].ItemArray[1].ToString();
                weightTB.Text      = main.Child.Rows[id].ItemArray[2].ToString();
                growthTB.Text      = main.Child.Rows[id].ItemArray[3].ToString();
                diagTB.Text        = main.Child.Rows[id].ItemArray[4].ToString();
            }
        }
 private void AddRodBTN()
 {
     try
     {
         using (AddPatient apForm = new AddPatient(int.Parse(dataRodOtdel.CurrentRow.Cells[0].Value.ToString()), true))
         {
             apForm.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
         logger.Debug("\n/--------------------------------------------------------------------/\n" + ex.StackTrace + "\n//----------------------------//\n" + ex.Message + "\n\n");
     }
 }
        private void EditRodBTN()
        {
            try
            {
                using (AddPatient apForm = new AddPatient(int.Parse(dataCertifRod.CurrentRow.Cells[13].Value.ToString()), false))
                {
                    apForm.ShowDialog();
                }

                dataCertifRod.DataSource = LoadClass.FuncLoadFromTable(dateFrom.Value.ToString("yyyy-MM-dd"), dateTo.Value.ToString("yyyy-MM-dd"));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                logger.Debug("\n/--------------------------------------------------------------------/\n" + ex.StackTrace + "\n//----------------------------//\n" + ex.Message + "\n\n");
            }
        }
Пример #4
0
        private void DataCertifRod_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                using (AddPatient apForm = new AddPatient(int.Parse(dataCertifRod.CurrentRow.Cells[13].Value.ToString()), false))
                {
                    apForm.ShowDialog();
                }

                dataCertifRod.AutoGenerateColumns = false;
                dataCertifRod.DataSource          = LoadClass.FuncLoadFromTable(dateFrom.Value.ToString("yyyy-MM-dd"), dateTo.Value.ToString("yyyy-MM-dd"));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                logger.Debug("\n/--------------------------------------------------------------------/\n" + ex.StackTrace + "\n//----------------------------//\n" + ex.Message + "\n\n");
            }
        }
        private void AddBTN_Click(object sender, EventArgs e)
        {
            try
            {
                AddPatient main = this.Owner as AddPatient;

                if (insert == true)
                {
                    id++;

                    if (main != null)
                    {
                        main.Child.Rows.Add(id, sexTB.SelectedItem, weightTB.Text, growthTB.Text, diagTB.Text == null || diagTB.Text == "" ? null : diagTB.Text);
                        main.BQNT = ++main.BQNT;
                        MessageBox.Show("Данные добавлены", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    sexTB.SelectedIndex = -1;
                    weightTB.Clear();
                    growthTB.Clear();
                    diagTB.Clear();
                }
                else
                {
                    if (main != null)
                    {
                        DataRow dataRow = main.Child.Rows[id];

                        dataRow[1] = sexTB.SelectedItem.ToString();
                        dataRow[2] = weightTB.Text;
                        dataRow[3] = growthTB.Text;
                        dataRow[4] = diagTB.Text;
                    }
                    MessageBox.Show("Данные сохранены", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                logger.Debug("\n/--------------------------------------------------------------------/\n" + ex.StackTrace + "\n//----------------------------//\n" + ex.Message + "\n\n");
            }
        }