Exemplo n.º 1
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (dgvState.RowCount != 0)
     {
         int         stateId    = (int)(dgvState.SelectedRows[0].Cells[0].Value);
         StateDialog dlgState   = new StateDialog();
         StateBO     objStateBO = new StateBO();
         //update the records
         State objState = objStateBO.GetState(stateId);
         dlgState.CountryId = objState.CountryId;
         dlgState.StateName = objState.StateName;
         dlgState.IsActive  = objState.IsActive;
         if (dlgState.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 if (!(objState.StateName == dlgState.StateName))
                 {
                     objStateBo.IsStateExist(dlgState.CountryName, dlgState.StateName);
                 }
                 objStateBO.UpdateState(objState.StateId, objState.CountryId, dlgState.StateName, dlgState.IsActive);
             }
             catch (Exception EX)
             {
                 MessageBox.Show(EX.Message);
             }
             BindGridView();
         }
     }
 }
Exemplo n.º 2
0
 //for Updating the data in the table
 public void Update(object T, int c)
 {
     if (c == 1)
     {
         CountryBO.UpdateCountry((Country)T);
     }
     else if (c == 2)
     {
         StateBO.UpdateState((State)T);
     }
     else if (c == 3)
     {
         UserDB.Update((UserDetail)T);
     }
     if (c == 4)
     {
         // AddressBookDB.UpdateAddress((Addressbook)T);
     }
 }