/// <summary>
        /// Fills PermissionGroup object
        /// </summary>
        /// <param name="permissionGroupObject">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(PermissionGroupBase permissionGroupObject, SqlDataReader reader, int start)
        {
            permissionGroupObject.Id        = reader.GetInt32(start + 0);
            permissionGroupObject.CompanyId = reader.GetGuid(start + 1);
            permissionGroupObject.Name      = reader.GetString(start + 2);
            if (!reader.IsDBNull(3))
            {
                permissionGroupObject.Tag = reader.GetString(start + 3);
            }
            FillBaseObject(permissionGroupObject, reader, (start + 4));


            permissionGroupObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
        }
        /// <summary>
        /// Updates PermissionGroup
        /// </summary>
        /// <param name="permissionGroupObject">Object to be updated</param>
        /// <returns>Number of rows affected</returns>
        public long Update(PermissionGroupBase permissionGroupObject)
        {
            try
            {
                SqlCommand cmd = GetSPCommand(UPDATEPERMISSIONGROUP);

                AddParameter(cmd, pInt32(PermissionGroupBase.Property_Id, permissionGroupObject.Id));
                AddCommonParams(cmd, permissionGroupObject);

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

                AddParameter(cmd, pInt32Out(PermissionGroupBase.Property_Id));
                AddCommonParams(cmd, permissionGroupObject);

                long result = InsertRecord(cmd);
                if (result > 0)
                {
                    permissionGroupObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
                    permissionGroupObject.Id       = (Int32)GetOutParameter(cmd, PermissionGroupBase.Property_Id);
                }
                return(result);
            }
            catch (SqlException x)
            {
                throw new ObjectInsertException(permissionGroupObject, x);
            }
        }
 /// <summary>
 /// Add common parameters before calling a procedure
 /// </summary>
 /// <param name="cmd">command object, where parameters will be added</param>
 /// <param name="permissionGroupObject"></param>
 private void AddCommonParams(SqlCommand cmd, PermissionGroupBase permissionGroupObject)
 {
     AddParameter(cmd, pGuid(PermissionGroupBase.Property_CompanyId, permissionGroupObject.CompanyId));
     AddParameter(cmd, pNVarChar(PermissionGroupBase.Property_Name, 50, permissionGroupObject.Name));
     AddParameter(cmd, pNVarChar(PermissionGroupBase.Property_Tag, 500, permissionGroupObject.Tag));
 }
 /// <summary>
 /// Fills PermissionGroup object
 /// </summary>
 /// <param name="permissionGroupObject">The object to be filled</param>
 /// <param name="reader">The reader to use to fill a single object</param>
 protected void FillObject(PermissionGroupBase permissionGroupObject, SqlDataReader reader)
 {
     FillObject(permissionGroupObject, reader, 0);
 }