示例#1
0
        private void ClientsGrid_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            string fio = "";

            if (e.ColumnIndex != -1 & e.RowIndex != -1)
            {
                //подготовка формы клиента
                fio = ClientsGrid.Rows[e.RowIndex].Cells[0].Value.ToString();
                Data.CurrentClient = Data.Clients.FindByFIO(fio);
                ClientView clientView = new ClientView();
                clientView.Owner = this;
                clientView.ShowDialog();//открытие формы просмотра клиента
            }
        }
示例#2
0
 private void ClientEdit_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         this.Close();
         try
         {
             ClientView clientView = this.Owner as ClientView;
             clientView.Close();
         }
         catch
         {
         }
     }
 }
示例#3
0
 private void ClientEdit_FormClosed(object sender, FormClosedEventArgs e)//изменения в форму родителя
 {
     try
     {
         ClientView clientView = this.Owner as ClientView;
         if (FIOBox.Text == "" || passBox.Text == "" || passBox.Text == "" || licenseBox.Text == "" || addressBox.Text == "")
         {
             Data.Clients.DelClient(Data.CurrentClient);
             clientView.Close();
         }
         else
         {
             clientView.FillForm(Data.CurrentClient);
         }
     }
     catch
     {
         MainForm mainForm = this.Owner as MainForm;
         mainForm.FillClients();
     }
 }
示例#4
0
 private void saveButton_Click(object sender, EventArgs e)//сохранение
 {
     if (FIOBox.Text == "" || passBox.Text == "" || licenseBox.Text == "" || addressBox.Text == "")
     {
         MainForm.stStrip.Items.Clear();
         MainForm.stStrip.Items.Add("Заполнены не все поля");
         MessageBox.Show("Для сохранения заполните все поля формы.", "Упс!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         SaveThisForm();
         Data.Status = false;
         MainForm.stStrip.Items.Clear();
         MainForm.stStrip.Items.Add("Есть несохраненные данные");
         MessageBox.Show("Данные успешно изменены.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
         ClientView clientView = this.Owner as ClientView;
         if (clientView != null)
         {
             clientView.Close();
         }
     }
 }