Exemplo n.º 1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
                {
                    return;
                }


                HPS.BLL.GoodBLL.BLLGood_TFactory Good_TFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory();
                HPS.BLL.GoodBLL.BLLGood_TKeys    GoodKey       = new HPS.BLL.GoodBLL.BLLGood_TKeys();

                GoodKey.GoodID_int = (Int32?)GoodGridView.CurrentRow.Cells["colGoodID_int"].Value;
                GoodFactory.Delete(GoodKey);

                DataRow[] dr = ((DataTable)this.GoodGridView.DataSource).Select(HPS.BLL.GoodBLL.BLLGood_T.Good_TField.GoodID_int.ToString() + "='" + GoodKey.GoodID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.GoodGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Exemplo n.º 2
0
        protected override void Delete()
        {
            HPS.BLL.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    GoodFactory.BeginProc();
                    GoodFactory.Delete((HPS.BLL.GoodBLL.BLLGood_TKeys)Key);
                    GoodFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.GoodBLL.BLLGood_T.Good_TField.GoodID_int.ToString() + "='" + ((HPS.BLL.GoodBLL.BLLGood_TKeys)Key).GoodID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                GoodFactory.RollBackProc();
                throw ex;
            }
        }