예제 #1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();

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


                HPS.BLL.DriverBLL.BLLDriver_TFactory Driver_TFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
                HPS.BLL.DriverBLL.BLLDriver_TKeys    DriverKey       = new HPS.BLL.DriverBLL.BLLDriver_TKeys();

                DriverKey.DriverID_bint = (Int64)DriverGridView.CurrentRow.Cells["colDriverID_bint"].Value;
                DriverFactory.Delete(DriverKey);

                DataRow[] dr = ((DataTable)this.DriverGridView.DataSource).Select(HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverID_bint.ToString() + "='" + DriverKey.DriverID_bint.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.DriverGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
예제 #2
0
        protected override void Delete()
        {
            HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    DriverFactory.BeginProc();
                    DriverFactory.Delete((HPS.BLL.DriverBLL.BLLDriver_TKeys)Key);
                    DriverFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverID_bint.ToString() + "='" + ((HPS.BLL.DriverBLL.BLLDriver_TKeys)Key).DriverID_bint.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                DriverFactory.RollBackProc();
                throw ex;
            }
        }