Exemplo n.º 1
0
        protected override void Delete()
        {
            HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory InfractionSurveyGroupFactory = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    InfractionSurveyGroupFactory.BeginProc();
                    InfractionSurveyGroupFactory.Delete((HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys)Key);
                    InfractionSurveyGroupFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T.InfractionSurveyGroup_TField.InfractionSurveyGroupID_int.ToString() + "='" + ((HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys)Key).InfractionSurveyGroupID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                InfractionSurveyGroupFactory.RollBackProc();
                throw ex;
            }
        }
Exemplo n.º 2
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory InfractionSurveyGroupFactory = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory();

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


                HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory InfractionSurveyGroup_TFactory = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory();
                HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys    InfractionSurveyGroupKey       = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys();

                InfractionSurveyGroupKey.InfractionSurveyGroupID_int = (Int32?)InfractionSurveyGroupGridView.CurrentRow.Cells["colInfractionSurveyGroupID_int"].Value;
                InfractionSurveyGroupFactory.Delete(InfractionSurveyGroupKey);

                DataRow[] dr = ((DataTable)this.InfractionSurveyGroupGridView.DataSource).Select(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T.InfractionSurveyGroup_TField.InfractionSurveyGroupID_int.ToString() + "='" + InfractionSurveyGroupKey.InfractionSurveyGroupID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.InfractionSurveyGroupGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }