Beispiel #1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();

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


                HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagement_TFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
                HPS.BLL.TurnManagementBLL.BLLTurnManagement_TKeys    TurnManagementKey       = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TKeys();

                TurnManagementKey.TurnManagementID_int = (Int32?)TurnManagementGridView.CurrentRow.Cells["colTurnManagementID_int"].Value;
                TurnManagementFactory.Delete(TurnManagementKey);

                DataRow[] dr = ((DataTable)this.TurnManagementGridView.DataSource).Select(HPS.BLL.TurnManagementBLL.BLLTurnManagement_T.TurnManagement_TField.TurnManagementID_int.ToString() + "='" + TurnManagementKey.TurnManagementID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.TurnManagementGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Beispiel #2
0
        protected override void Delete()
        {
            HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    TurnManagementFactory.BeginProc();
                    TurnManagementFactory.Delete((HPS.BLL.TurnManagementBLL.BLLTurnManagement_TKeys)Key);
                    TurnManagementFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.TurnManagementBLL.BLLTurnManagement_T.TurnManagement_TField.TurnManagementID_int.ToString() + "='" + ((HPS.BLL.TurnManagementBLL.BLLTurnManagement_TKeys)Key).TurnManagementID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                TurnManagementFactory.RollBackProc();
                throw ex;
            }
        }