protected override void Delete() { HPS.BLL.BLLCompanyMobile_TFactory CompanyMobileFactory = new HPS.BLL.BLLCompanyMobile_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == true) { CompanyMobileFactory.BeginProc(); CompanyMobileFactory.Delete((HPS.BLL.BLLCompanyMobile_TKeys)Key); CompanyMobileFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.BLLCompanyMobile_T.CompanyMobile_TField.CompanyMobileID_int.ToString() + "='" + ((HPS.BLL.BLLCompanyMobile_TKeys)Key).CompanyMobileID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (System.Exception ex) { CompanyMobileFactory.RollBackProc(); throw ex; } }
private void DeleteCompanyMobileButton_Click(object sender, EventArgs e) { HPS.BLL.BLLCompanyMobile_TFactory CompanyMobileFactory = new HPS.BLL.BLLCompanyMobile_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.BLLCompanyMobile_TFactory CompanyMobile_TFactory = new HPS.BLL.BLLCompanyMobile_TFactory(); HPS.BLL.BLLCompanyMobile_TKeys CompanyMobileKey = new HPS.BLL.BLLCompanyMobile_TKeys(); CompanyMobileKey.CompanyMobileID_int = (Int32)CompanyMobileGridView.CurrentRow.Cells["colCompanyMobileID_int"].Value; CompanyMobileFactory.Delete(CompanyMobileKey); DataRow[] dr = ((DataTable)this.CompanyMobileGridView.DataSource).Select(HPS.BLL.BLLCompanyMobile_T.CompanyMobile_TField.CompanyMobileID_int.ToString() + "='" + CompanyMobileKey.CompanyMobileID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.CompanyMobileGridView.DataSource).AcceptChanges(); } catch (System.Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }