예제 #1
0
        public List <Role2PrivilegeItem> LoadRole2PrivilegeItems()
        {
            string     sql = @"SELECT [RoleID]
				, [PrivilegeItemID]
				 FROM [BE_Role2PrivilegeItem]"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            List <Role2PrivilegeItem> ret = new List <Role2PrivilegeItem>();
            SqlDataReader             dr  = cmd.ExecuteReader();

            try
            {
                while (dr.Read())
                {
                    Role2PrivilegeItem iret = new Role2PrivilegeItem();
                    if (!Convert.IsDBNull(dr["RoleID"]))
                    {
                        iret.RoleID = (Guid)dr["RoleID"];
                    }
                    if (!Convert.IsDBNull(dr["PrivilegeItemID"]))
                    {
                        iret.PrivilegeItemID = (Guid)dr["PrivilegeItemID"];
                    }
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
예제 #2
0
        public int LoadRole2PrivilegeItemByRoleID_PrivilegeItemID(Role2PrivilegeItem obj)
        {
            string     sql = @"SELECT [RoleID]
				, [PrivilegeItemID]
                FROM [BE_Role2PrivilegeItem] WITH(NOLOCK) WHERE [RoleID]=@RoleID AND [PrivilegeItemID]=@PrivilegeItemID"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pRoleID = new SqlParameter("RoleID", Convert2DBnull(obj.RoleID));

            pRoleID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pRoleID);

            SqlParameter pPrivilegeItemID = new SqlParameter("PrivilegeItemID", Convert2DBnull(obj.PrivilegeItemID));

            pPrivilegeItemID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pPrivilegeItemID);

            int           ret = 0;
            SqlDataReader dr  = cmd.ExecuteReader();

            try
            {
                while (dr.Read())
                {
                    if (!Convert.IsDBNull(dr["RoleID"]))
                    {
                        obj.RoleID = (Guid)dr["RoleID"];
                    }
                    if (!Convert.IsDBNull(dr["PrivilegeItemID"]))
                    {
                        obj.PrivilegeItemID = (Guid)dr["PrivilegeItemID"];
                    }
                    ret += 1;
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
예제 #3
0
        public int InsertRole2PrivilegeItem(Role2PrivilegeItem obj)
        {
            string     sql = @"INSERT INTO[BE_Role2PrivilegeItem]([RoleID]
				, [PrivilegeItemID]
				) VALUES(@RoleID
				, @PrivilegeItemID
				)"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pRoleID = new SqlParameter("RoleID", Convert2DBnull(obj.RoleID));

            pRoleID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pRoleID);

            SqlParameter pPrivilegeItemID = new SqlParameter("PrivilegeItemID", Convert2DBnull(obj.PrivilegeItemID));

            pPrivilegeItemID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pPrivilegeItemID);

            return(cmd.ExecuteNonQuery());
        }
예제 #4
0
        public List <Role2PrivilegeItem> LoadRole2PrivilegeItemsByPrivilegeItemID(Guid privilegeItemID)
        {
            string     sql = @"SELECT [RoleID]
				, [PrivilegeItemID]
				 FROM [BE_Role2PrivilegeItem] WHERE [PrivilegeItemID]=@PrivilegeItemID"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pPrivilegeItemID = new SqlParameter("PrivilegeItemID", privilegeItemID);

            pPrivilegeItemID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pPrivilegeItemID);

            List <Role2PrivilegeItem> ret = new List <Role2PrivilegeItem>();
            SqlDataReader             dr  = cmd.ExecuteReader();

            try
            {
                while (dr.Read())
                {
                    Role2PrivilegeItem iret = new Role2PrivilegeItem();
                    if (!Convert.IsDBNull(dr["RoleID"]))
                    {
                        iret.RoleID = (Guid)dr["RoleID"];
                    }
                    if (!Convert.IsDBNull(dr["PrivilegeItemID"]))
                    {
                        iret.PrivilegeItemID = (Guid)dr["PrivilegeItemID"];
                    }
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }