コード例 #1
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);
            }
        }
コード例 #2
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys InfractionSurveyGroupKey = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys();
            InfractionSurveyGroupKey.InfractionSurveyGroupID_int = (Int32?)this.InfractionSurveyGroupGridView.CurrentRow.Cells["colInfractionSurveyGroupID_int"].Value;
            InfractionSurveyGroupEntityForm InfractionSurveyGroup = new InfractionSurveyGroupEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.InfractionSurveyGroupGridView.DataSource, InfractionSurveyGroupKey);

            InfractionSurveyGroup.ShowDialog();
        }
コード例 #3
0
 public void GetBy(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys keys, ref System.Data.DataTable dataTable)
 {
     try{
         _dataObject.SelectByPrimaryKey(keys, ref dataTable);
     }catch (System.Exception ex) {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
コード例 #4
0
 public HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T GetBy(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys keys)
 {
     try{
         return(_dataObject.SelectByPrimaryKey(keys));
     }catch (System.Exception ex) {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
コード例 #5
0
 public void Delete(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys keys)
 {
     try{
         _dataObject.Delete(keys);
     }catch (System.Exception ex) {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
コード例 #6
0
        public void SelectByPrimaryKey(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys businessObjectKey, ref System.Data.DataTable dataTable)
        {
            bool           ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);
            SqlDataAdapter sqlDataAdapter    = new System.Data.SqlClient.SqlDataAdapter(this.Command);

            this.Command.CommandText = "[sp_InfractionSurveyGroup_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try{
                this.Command.Parameters.Clear();

                SqlParameter InfractionSurveyGroupID_int = new SqlParameter();
                InfractionSurveyGroupID_int.ParameterName = "@InfractionSurveyGroupID_int";
                InfractionSurveyGroupID_int.SqlDbType     = SqlDbType.Int;
                InfractionSurveyGroupID_int.Direction     = ParameterDirection.Input;
                InfractionSurveyGroupID_int.IsNullable    = false;
                InfractionSurveyGroupID_int.Value         = businessObjectKey.InfractionSurveyGroupID_int;
                this.Command.Parameters.Add(InfractionSurveyGroupID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
コード例 #7
0
 public InfractionSurveyGroupEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }
コード例 #8
0
        public void Update(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T businessObject, HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_InfractionSurveyGroup_T_Update]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try{
                this.Command.Parameters.Clear();

                SqlParameter InfractionSurveyGroup_nvc = new SqlParameter();
                InfractionSurveyGroup_nvc.ParameterName = "@InfractionSurveyGroup_nvc";
                InfractionSurveyGroup_nvc.SqlDbType     = SqlDbType.NVarChar;
                InfractionSurveyGroup_nvc.Direction     = ParameterDirection.Input;
                InfractionSurveyGroup_nvc.IsNullable    = false;
                InfractionSurveyGroup_nvc.Value         = businessObject.InfractionSurveyGroup_nvc;
                this.Command.Parameters.Add(InfractionSurveyGroup_nvc);


                SqlParameter pk_InfractionSurveyGroupID_int = new SqlParameter();
                pk_InfractionSurveyGroupID_int.ParameterName = "@pk_InfractionSurveyGroupID_int";
                pk_InfractionSurveyGroupID_int.SqlDbType     = SqlDbType.Int;
                pk_InfractionSurveyGroupID_int.Direction     = ParameterDirection.Input;
                pk_InfractionSurveyGroupID_int.IsNullable    = false;
                pk_InfractionSurveyGroupID_int.Value         = businessObjectKey.InfractionSurveyGroupID_int;
                this.Command.Parameters.Add(pk_InfractionSurveyGroupID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
コード例 #9
0
        public HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T SelectByPrimaryKey(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_InfractionSurveyGroup_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try{
                this.Command.Parameters.Clear();

                SqlParameter InfractionSurveyGroupID_int = new SqlParameter();
                InfractionSurveyGroupID_int.ParameterName = "@InfractionSurveyGroupID_int";
                InfractionSurveyGroupID_int.SqlDbType     = SqlDbType.Int;
                InfractionSurveyGroupID_int.Direction     = ParameterDirection.Input;
                InfractionSurveyGroupID_int.IsNullable    = false;
                InfractionSurveyGroupID_int.Value         = businessObjectKey.InfractionSurveyGroupID_int;
                this.Command.Parameters.Add(InfractionSurveyGroupID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T businessObject = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T();
                if (dataReader.Read())
                {
                    PopulateBusinessObjectFromReader(businessObject, dataReader);
                }
                else
                {
                    businessObject = null;
                }

                if (dataReader.IsClosed == false)
                {
                    dataReader.Close();
                }


                if (ControlConnection)
                {
                    this.Commit();
                }
                return(businessObject);
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
コード例 #10
0
        public void Update(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T businessObject, HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys businessObjectKey)
        {
            try{
                if (businessObject.InfractionSurveyGroupID_int == businessObjectKey.InfractionSurveyGroupID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueInfractionSurveyGroupID_int") == false)
                    {
                        throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                    }
                }
                else
                {
                    if (businessObject.IsValid() == false)
                    {
                        throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                    }
                }

                _dataObject.Update(businessObject, businessObjectKey);
            }catch (System.Exception ex) {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }