Beispiel #1
0
        public void Update(HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T businessObject, HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.MultiLaderTypeID_int == businessObjectKey.MultiLaderTypeID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueMultiLaderTypeID_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 #2
0
        public void Insert(HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

                SqlParameter MultiLaderTypeID_int = new SqlParameter();
                MultiLaderTypeID_int.ParameterName = "@MultiLaderTypeID_int";
                MultiLaderTypeID_int.SqlDbType     = SqlDbType.Int;
                MultiLaderTypeID_int.Direction     = ParameterDirection.Output;
                MultiLaderTypeID_int.IsNullable    = false;
                MultiLaderTypeID_int.Value         = businessObject.MultiLaderTypeID_int;
                this.Command.Parameters.Add(MultiLaderTypeID_int);

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

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



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

                this.Command.ExecuteNonQuery();

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

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Beispiel #3
0
        public HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T SelectByPrimaryKey(HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T businessObject = new HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_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
        public List <HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T> list = new List <HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T>();

            while (dataReader.Read())
            {
                HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T businessObject = new HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Beispiel #5
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T businessObject, IDataReader dataReader)
 {
     businessObject.MultiLaderTypeID_int  = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T.MultiLaderType_TField.MultiLaderTypeID_int.ToString()));
     businessObject.LadeAssignmentID_bint = dataReader.GetInt64(dataReader.GetOrdinal(HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T.MultiLaderType_TField.LadeAssignmentID_bint.ToString()));
     businessObject.LaderTypeID_int       = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.MultiLaderTypeBLL.BLLMultiLaderType_T.MultiLaderType_TField.LaderTypeID_int.ToString()));
 }