示例#1
0
 /// <summary>
 /// Fill controls on datagridview cell double click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvBrand_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             BrandInfo infoBrand = new BrandInfo();
             BrandBll  BllBrand  = new BrandBll();
             strBrandName = dgvBrand.CurrentRow.Cells["Column1"].Value.ToString();
             if (strBrandName != "NA")
             {
                 decBrandId           = Convert.ToDecimal(dgvBrand.Rows[e.RowIndex].Cells["dgvtxtBrandid"].Value.ToString());
                 infoBrand            = BllBrand.BrandView(decBrandId);
                 txtBrandName.Text    = infoBrand.BrandName;
                 txtManufacturer.Text = infoBrand.Manufacturer;
                 txtNarration.Text    = infoBrand.Narration;
                 btnSave.Text         = "Update";
                 txtBrandName.Focus();
                 btnDelete.Enabled = true;
                 strBrandName      = infoBrand.BrandName;
             }
             else
             {
                 Messages.WarningMessage("NA Brand cannot update or delete");
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("BR19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }