Beispiel #1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.ComputerBLL.BLLComputer_TFactory ComputerFactory = new HPS.BLL.ComputerBLL.BLLComputer_TFactory();

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


                HPS.BLL.ComputerBLL.BLLComputer_TFactory Computer_TFactory = new HPS.BLL.ComputerBLL.BLLComputer_TFactory();
                HPS.BLL.ComputerBLL.BLLComputer_TKeys    ComputerKey       = new HPS.BLL.ComputerBLL.BLLComputer_TKeys();

                ComputerKey.ComputerID_int = (Int32?)ComputerGridView.CurrentRow.Cells["colComputerID_int"].Value;
                ComputerFactory.Delete(ComputerKey);

                DataRow[] dr = ((DataTable)this.ComputerGridView.DataSource).Select(HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.ComputerID_int.ToString() + "='" + ComputerKey.ComputerID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.ComputerGridView.DataSource).AcceptChanges();
            }

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

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    ComputerFactory.BeginProc();
                    ComputerFactory.Delete((HPS.BLL.ComputerBLL.BLLComputer_TKeys)Key);
                    ComputerFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.ComputerID_int.ToString() + "='" + ((HPS.BLL.ComputerBLL.BLLComputer_TKeys)Key).ComputerID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ComputerFactory.RollBackProc();
                throw ex;
            }
        }