Пример #1
0
        /// <summary>
        /// Updates a AccessPermission record and returns the number of records affected
        /// </summary>
        public static int Update(AccessPermissionDO DO)
        {
            SqlParameter _RegistrationID = new SqlParameter("RegistrationID", SqlDbType.Int);
            SqlParameter _SystemRoleID = new SqlParameter("SystemRoleID", SqlDbType.VarChar);
            
            _RegistrationID.Value = DO.RegistrationID;
            _SystemRoleID.Value = DO.SystemRoleID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _RegistrationID,
                _SystemRoleID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            return DataCommon.ExecuteScalar("[dbo].[AccessPermission_Update]", _params, pid);
        }
Пример #2
0
        /// <summary>
        /// Creates a new AccessPermission record using async
        /// </summary>
        public static async Task CreateAsync(AccessPermissionDO DO)
        {
            SqlParameter _RegistrationID = new SqlParameter("RegistrationID", SqlDbType.Int);
            SqlParameter _SystemRoleID = new SqlParameter("SystemRoleID", SqlDbType.VarChar);
            
            _RegistrationID.Value = DO.RegistrationID;
            _SystemRoleID.Value = DO.SystemRoleID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _RegistrationID,
                _SystemRoleID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            await DataCommon.ExecuteNonQueryAsync("[dbo].[AccessPermission_Insert]", _params, pid);
            
        }
Пример #3
0
        /// <summary>
        /// Selects AccessPermission records by SystemRole
        /// </summary>
        public static async Task<AccessPermissionDO[]> GetBySystemRoleAsync(String SystemRoleID)
        {

            SqlParameter _SystemRoleID = new SqlParameter("SystemRoleID", SqlDbType.VarChar);
			
            _SystemRoleID.Value = SystemRoleID;
			
            SqlParameter[] _params = new SqlParameter[] {
                _SystemRoleID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[AccessPermission_GetBySystemRole]", _params, pid);


            List<AccessPermissionDO> objs = new List<AccessPermissionDO>();
			
            while(sr.Read())
            {
                AccessPermissionDO obj = new AccessPermissionDO();
				
                obj.RegistrationID = sr.GetInt32(sr.GetOrdinal("RegistrationID"));
                obj.SystemRoleID = sr.GetString(sr.GetOrdinal("SystemRoleID"));
                

                objs.Add(obj);
            }

            return objs.ToArray();
        }
Пример #4
0
        /// <summary>
        /// Gets all AccessPermission records
        /// </summary>
        public static async Task<AccessPermissionDO[]> GetAllAsync()
        {

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[AccessPermission_GetAll]", new SqlParameter[] { }, pid);
            
            List<AccessPermissionDO> objs = new List<AccessPermissionDO>();
            
            while(sr.Read()){

                AccessPermissionDO obj = new AccessPermissionDO();
                
                obj.RegistrationID = sr.GetInt32(sr.GetOrdinal("RegistrationID"));
                obj.SystemRoleID = sr.GetString(sr.GetOrdinal("SystemRoleID"));
                


                objs.Add(obj);
            }

            return objs.ToArray();
        }