Beispiel #1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TFactory AnnouncementTimeFactory = new HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TFactory();

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


                HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TFactory AnnouncementTime_TFactory = new HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TFactory();
                HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys    AnnouncementTimeKey       = new HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys();

                AnnouncementTimeKey.AnnouncementTimeID_int = (Int32?)AnnouncementTimeGridView.CurrentRow.Cells["colAnnouncementTimeID_int"].Value;
                AnnouncementTimeFactory.Delete(AnnouncementTimeKey);

                DataRow[] dr = ((DataTable)this.AnnouncementTimeGridView.DataSource).Select(HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_T.AnnouncementTime_TField.AnnouncementTimeID_int.ToString() + "='" + AnnouncementTimeKey.AnnouncementTimeID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.AnnouncementTimeGridView.DataSource).AcceptChanges();
            }

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

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    AnnouncementTimeFactory.BeginProc();
                    AnnouncementTimeFactory.Delete((HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys)Key);
                    AnnouncementTimeFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_T.AnnouncementTime_TField.AnnouncementTimeID_int.ToString() + "='" + ((HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys)Key).AnnouncementTimeID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                AnnouncementTimeFactory.RollBackProc();
                throw ex;
            }
        }