Exemple #1
0
 /// <summary>
 /// Add common parameters before calling a procedure
 /// </summary>
 /// <param name="cmd">command object, where parameters will be added</param>
 /// <param name="userMachineMapObject"></param>
 private void AddCommonParams(SqlCommand cmd, UserMachineMapBase userMachineMapObject)
 {
     AddParameter(cmd, pGuid(UserMachineMapBase.Property_OwnerId, userMachineMapObject.OwnerId));
     AddParameter(cmd, pGuid(UserMachineMapBase.Property_MachineId, userMachineMapObject.MachineId));
     AddParameter(cmd, pGuid(UserMachineMapBase.Property_LastUpdatedBy, userMachineMapObject.LastUpdatedBy));
     AddParameter(cmd, pDateTime(UserMachineMapBase.Property_LastUpdatedDate, userMachineMapObject.LastUpdatedDate));
 }
Exemple #2
0
        /// <summary>
        /// Fills UserMachineMap object
        /// </summary>
        /// <param name="userMachineMapObject">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(UserMachineMapBase userMachineMapObject, SqlDataReader reader, int start)
        {
            userMachineMapObject.Id              = reader.GetInt32(start + 0);
            userMachineMapObject.OwnerId         = reader.GetGuid(start + 1);
            userMachineMapObject.MachineId       = reader.GetGuid(start + 2);
            userMachineMapObject.LastUpdatedBy   = reader.GetGuid(start + 3);
            userMachineMapObject.LastUpdatedDate = reader.GetDateTime(start + 4);
            FillBaseObject(userMachineMapObject, reader, (start + 5));


            userMachineMapObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
        }
Exemple #3
0
        /// <summary>
        /// Updates UserMachineMap
        /// </summary>
        /// <param name="userMachineMapObject">Object to be updated</param>
        /// <returns>Number of rows affected</returns>
        public long Update(UserMachineMapBase userMachineMapObject)
        {
            try
            {
                SqlCommand cmd = GetSPCommand(UPDATEUSERMACHINEMAP);

                AddParameter(cmd, pInt32(UserMachineMapBase.Property_Id, userMachineMapObject.Id));
                AddCommonParams(cmd, userMachineMapObject);

                long result = UpdateRecord(cmd);
                if (result > 0)
                {
                    userMachineMapObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
                }
                return(result);
            }
            catch (SqlException x)
            {
                throw new ObjectUpdateException(userMachineMapObject, x);
            }
        }
Exemple #4
0
        /// <summary>
        /// Inserts UserMachineMap
        /// </summary>
        /// <param name="userMachineMapObject">Object to be inserted</param>
        /// <returns>Number of rows affected</returns>
        public long Insert(UserMachineMapBase userMachineMapObject)
        {
            try
            {
                SqlCommand cmd = GetSPCommand(INSERTUSERMACHINEMAP);

                AddParameter(cmd, pInt32Out(UserMachineMapBase.Property_Id));
                AddCommonParams(cmd, userMachineMapObject);

                long result = InsertRecord(cmd);
                if (result > 0)
                {
                    userMachineMapObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
                    userMachineMapObject.Id       = (Int32)GetOutParameter(cmd, UserMachineMapBase.Property_Id);
                }
                return(result);
            }
            catch (SqlException x)
            {
                throw new ObjectInsertException(userMachineMapObject, x);
            }
        }
Exemple #5
0
 /// <summary>
 /// Fills UserMachineMap object
 /// </summary>
 /// <param name="userMachineMapObject">The object to be filled</param>
 /// <param name="reader">The reader to use to fill a single object</param>
 protected void FillObject(UserMachineMapBase userMachineMapObject, SqlDataReader reader)
 {
     FillObject(userMachineMapObject, reader, 0);
 }