Beispiel #1
0
        protected override void Insert()
        {
            HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory InfractionSurveyGroupFactory = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory();
            try
            {
                HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T InfractionSurveyGroupEntity = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T();
                InfractionSurveyGroupEntity.InfractionSurveyGroup_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionSurveyGroup_nvcTextBox.Text, TypeCode.String).ToString();

                InfractionSurveyGroupFactory.BeginProc();
                InfractionSurveyGroupFactory.Insert(InfractionSurveyGroupEntity);
                InfractionSurveyGroupFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T.InfractionSurveyGroup_TField.InfractionSurveyGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionSurveyGroupEntity.InfractionSurveyGroupID_int, TypeCode.Int32);
                    dr[HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T.InfractionSurveyGroup_TField.InfractionSurveyGroup_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionSurveyGroupEntity.InfractionSurveyGroup_nvc, TypeCode.String);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                InfractionSurveyGroupFactory.RollBackProc();
                throw ex;
            }
        }
Beispiel #2
0
        protected override void Edit()
        {
            HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory InfractionSurveyGroupFactory = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory();
            try
            {
                HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T InfractionSurveyGroupEntity = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T();
                InfractionSurveyGroupEntity.InfractionSurveyGroup_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionSurveyGroup_nvcTextBox.Text, TypeCode.String).ToString();

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    InfractionSurveyGroupFactory.BeginProc();
                    InfractionSurveyGroupFactory.Update(InfractionSurveyGroupEntity, (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][HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T.InfractionSurveyGroup_TField.InfractionSurveyGroup_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionSurveyGroupEntity.InfractionSurveyGroup_nvc, TypeCode.String);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                InfractionSurveyGroupFactory.RollBackProc();
                throw ex;
            }
        }
Beispiel #3
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;
            }
        }
Beispiel #4
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory InfractionSurveyGroupFactory = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TFactory();
     HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T        InfractionSurveyGroupEntity  = InfractionSurveyGroupFactory.GetBy((HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_TKeys)Key);
     if (InfractionSurveyGroupEntity == null)
     {
         throw new HPS.Exceptions.InfractionSurveyGroupNotFound();
     }
     InfractionSurveyGroup_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionSurveyGroupEntity.InfractionSurveyGroup_nvc, TypeCode.String).ToString();
 }
Beispiel #5
0
        public List <HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T> list = new List <HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T>();

            while (dataReader.Read())
            {
                HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T businessObject = new HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Beispiel #6
0
        public void Insert(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T businessObject)
        {
            try{
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "InfractionSurveyGroupID_int") == false)
                {
                    throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                }

                _dataObject.Insert(businessObject);
            }catch (System.Exception ex) {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
Beispiel #7
0
        public void Insert(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_InfractionSurveyGroup_T_Add]";
            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.Output;
                InfractionSurveyGroupID_int.IsNullable    = false;
                InfractionSurveyGroupID_int.Value         = businessObject.InfractionSurveyGroupID_int;
                this.Command.Parameters.Add(InfractionSurveyGroupID_int);

                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);



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

                this.Command.ExecuteNonQuery();

                businessObject.InfractionSurveyGroupID_int = (Int32?)(this.Command.Parameters["@InfractionSurveyGroupID_int"].Value);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Beispiel #8
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);
            }
        }
Beispiel #9
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T businessObject, IDataReader dataReader)
 {
     businessObject.InfractionSurveyGroupID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T.InfractionSurveyGroup_TField.InfractionSurveyGroupID_int.ToString()));
     businessObject.InfractionSurveyGroup_nvc   = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.InfractionSurveyGroupBLL.BLLInfractionSurveyGroup_T.InfractionSurveyGroup_TField.InfractionSurveyGroup_nvc.ToString()));
 }