示例#1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory();
            HPS.BLL.SaloonBLL.BLLSaloon_TKeys    SaloonKey     = new HPS.BLL.SaloonBLL.BLLSaloon_TKeys();
            try
            {
                if (this.SaloonGridView.SelectedRows.Count > 0)
                {
                    if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
                    {
                        return;
                    }
                }

                SaloonKey.SaloonID_int = (Int32)SaloonGridView.SelectedRows[0].Cells["colSaloonID_int"].Value;

                SaloonFactory.Delete(SaloonKey);
                if ((DataTable)this.SaloonGridView.DataSource != null)
                {
                    DataRow[] dr = ((DataTable)this.SaloonGridView.DataSource).Select(HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString() + "=" + SaloonKey.SaloonID_int.ToString() + "");
                    if (dr.Length > 0)
                    {
                        dr[0].Delete();
                    }
                    ((DataTable)this.SaloonGridView.DataSource).AcceptChanges();
                }
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
示例#2
0
 protected override void Delete()
 {
     HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory();
     try
     {
         if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
         {
             return;
         }
         SaloonFactory.BeginProc();
         SaloonFactory.Delete((HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key);
         SaloonFactory.CommitProc();
         if (DataTable != null)
         {
             DataRow[] dr = DataTable.Select(HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString() + " = " + ((HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key).SaloonID_int.ToString() + "");
             if (dr.Length > 0)
             {
                 dr[0].Delete();
             }
             DataTable.AcceptChanges();
         }
         this.Close();
     }
     catch (Exception ex)
     {
         SaloonFactory.RollBackProc();
         throw ex;
     }
 }