コード例 #1
0
        /// <summary>
        /// Fills UserBranch object
        /// </summary>
        /// <param name="userBranchObject">The object to be filled</param>
        /// <param name="reader">The reader to use to fill a single object</param>
        /// <param name="start">The ordinal position from which to start reading the reader</param>
        protected void FillObject(UserBranchBase userBranchObject, SqlDataReader reader, int start)
        {
            userBranchObject.Id        = reader.GetInt32(start + 0);
            userBranchObject.CompanyId = reader.GetGuid(start + 1);
            userBranchObject.UserId    = reader.GetGuid(start + 2);
            userBranchObject.BranchId  = reader.GetInt32(start + 3);
            FillBaseObject(userBranchObject, reader, (start + 4));


            userBranchObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
        }
コード例 #2
0
        /// <summary>
        /// Updates UserBranch
        /// </summary>
        /// <param name="userBranchObject">Object to be updated</param>
        /// <returns>Number of rows affected</returns>
        public long Update(UserBranchBase userBranchObject)
        {
            try
            {
                SqlCommand cmd = GetSPCommand(UPDATEUSERBRANCH);

                AddParameter(cmd, pInt32(UserBranchBase.Property_Id, userBranchObject.Id));
                AddCommonParams(cmd, userBranchObject);

                long result = UpdateRecord(cmd);
                if (result > 0)
                {
                    userBranchObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
                }
                return(result);
            }
            catch (SqlException x)
            {
                throw new ObjectUpdateException(userBranchObject, x);
            }
        }
コード例 #3
0
        /// <summary>
        /// Inserts UserBranch
        /// </summary>
        /// <param name="userBranchObject">Object to be inserted</param>
        /// <returns>Number of rows affected</returns>
        public long Insert(UserBranchBase userBranchObject)
        {
            try
            {
                SqlCommand cmd = GetSPCommand(INSERTUSERBRANCH);

                AddParameter(cmd, pInt32Out(UserBranchBase.Property_Id));
                AddCommonParams(cmd, userBranchObject);

                long result = InsertRecord(cmd);
                if (result > 0)
                {
                    userBranchObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
                    userBranchObject.Id       = (Int32)GetOutParameter(cmd, UserBranchBase.Property_Id);
                }
                return(result);
            }
            catch (SqlException x)
            {
                throw new ObjectInsertException(userBranchObject, x);
            }
        }
コード例 #4
0
 /// <summary>
 /// Add common parameters before calling a procedure
 /// </summary>
 /// <param name="cmd">command object, where parameters will be added</param>
 /// <param name="userBranchObject"></param>
 private void AddCommonParams(SqlCommand cmd, UserBranchBase userBranchObject)
 {
     AddParameter(cmd, pGuid(UserBranchBase.Property_CompanyId, userBranchObject.CompanyId));
     AddParameter(cmd, pGuid(UserBranchBase.Property_UserId, userBranchObject.UserId));
     AddParameter(cmd, pInt32(UserBranchBase.Property_BranchId, userBranchObject.BranchId));
 }
コード例 #5
0
 /// <summary>
 /// Fills UserBranch object
 /// </summary>
 /// <param name="userBranchObject">The object to be filled</param>
 /// <param name="reader">The reader to use to fill a single object</param>
 protected void FillObject(UserBranchBase userBranchObject, SqlDataReader reader)
 {
     FillObject(userBranchObject, reader, 0);
 }