Exemplo n.º 1
0
 private void btnSettClient_car_Click(object sender, EventArgs e)
 {
     if (dtgfio.SelectedRows.Count > 0)
     {
         if (dtgfio.SelectedRows[0].Index != -1)
         {
             int i_row = dtgfio.SelectedRows[0].Index;
             ClientAutoSettings.TextBtn          = "Изменить";
             ClientAutoSettings.SurnameClient    = dtgfio.Rows[i_row].Cells[0].FormattedValue.ToString().Trim();
             ClientAutoSettings.NameClient       = dtgfio.Rows[i_row].Cells[1].FormattedValue.ToString().Trim();
             ClientAutoSettings.PatronymicClient = dtgfio.Rows[i_row].Cells[2].FormattedValue.ToString().Trim();
             ClientAutoSettings.BirthdayClient   = Convert.ToDateTime(dtgfio.Rows[i_row].Cells[3].Value);
             ClientAutoSettings.PhoneClient      = dtgfio.Rows[i_row].Cells[4].FormattedValue.ToString().Trim();
             if (dtgfio.Rows[i_row].Cells[5].FormattedValue.ToString().Trim() != "")
             {
                 ClientAutoSettings.namePicture = dtgfio.Rows[i_row].Cells[5].FormattedValue.ToString().Trim();
             }
             else
             {
                 ClientAutoSettings.namePicture = null;
             }
             using (SettingsClient_Auto client_auto = new SettingsClient_Auto())
             {
                 client_auto.ShowDialog();
                 RefreshDataGrid();
                 dtgfio.Rows[i_row].Cells[0].Selected = true;
             }
         }
     }
 }
Exemplo n.º 2
0
        private void btnNewClient_Click(object sender, EventArgs e)
        {
            int i_row = dtgfio.SelectedRows[0].Index;

            ClientAutoSettings.TextBtn = "Добавить";
            using (SettingsClient_Auto client_auto = new SettingsClient_Auto())
            {
                client_auto.ShowDialog();
                RefreshDataGrid();
                dtgfio.Rows[i_row].Cells[0].Selected = true;
            }
        }