コード例 #1
0
        public HPS.BLL.BLLSmsInfo_T SelectByPrimaryKey(HPS.BLL.BLLSmsInfo_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader          dataReader     = this.Command.ExecuteReader();
                HPS.BLL.BLLSmsInfo_T businessObject = new HPS.BLL.BLLSmsInfo_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;
            }
        }
コード例 #2
0
        public List <HPS.BLL.BLLSmsInfo_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.BLLSmsInfo_T> list = new List <HPS.BLL.BLLSmsInfo_T>();

            while (dataReader.Read())
            {
                HPS.BLL.BLLSmsInfo_T businessObject = new HPS.BLL.BLLSmsInfo_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
コード例 #3
0
        public void Insert(HPS.BLL.BLLSmsInfo_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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



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

                this.Command.ExecuteNonQuery();

                businessObject.SmsInfoID_bint = (Int64)(this.Command.Parameters["@SmsInfoID_bint"].Value);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
コード例 #4
0
        public void Insert(HPS.BLL.BLLSmsInfo_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueSmsInfoID_bint") == 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);
            }
        }
コード例 #5
0
        public void Update(HPS.BLL.BLLSmsInfo_T businessObject, HPS.BLL.BLLSmsInfo_TKeys businessObjectKey)
        {
            try
            {
                List <string> ExceptList = new List <string>();
                if (businessObject.SmsInfoID_bint == businessObjectKey.SmsInfoID_bint)
                {
                    ExceptList.Add("UniqueSmsInfoID_bint");
                }
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, ExceptList.ToArray()) == 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);
            }
        }
コード例 #6
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.BLLSmsInfo_T businessObject, IDataReader dataReader)
 {
     businessObject.SmsInfoID_bint    = dataReader.GetInt64(dataReader.GetOrdinal(HPS.BLL.BLLSmsInfo_T.SmsInfo_TField.SmsInfoID_bint.ToString()));
     businessObject.RecivedSmsID_bint = dataReader.GetInt64(dataReader.GetOrdinal(HPS.BLL.BLLSmsInfo_T.SmsInfo_TField.RecivedSmsID_bint.ToString()));
 }