Example #1
0
        public List <PartnerRole2PrivilegeItem> LoadPartnerRole2PrivilegeItems()
        {
            string     sql = @"SELECT [RoleID]
				, [PrivilegeItemID]
				 FROM [BE_PartnerRole2PrivilegeItem]"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

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

            try
            {
                while (dr.Read())
                {
                    PartnerRole2PrivilegeItem iret = new PartnerRole2PrivilegeItem();
                    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);
        }
Example #2
0
        public int LoadPartnerRole2PrivilegeItemByRoleID_PrivilegeItemID(PartnerRole2PrivilegeItem obj)
        {
            string     sql = @"SELECT [RoleID]
				, [PrivilegeItemID]
                FROM [BE_PartnerRole2PrivilegeItem] 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);
        }
Example #3
0
        public int InsertPartnerRole2PrivilegeItem(PartnerRole2PrivilegeItem obj)
        {
            string     sql = @"INSERT INTO[BE_PartnerRole2PrivilegeItem]([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());
        }
Example #4
0
        public List <PartnerRole2PrivilegeItem> LoadPartnerRole2PrivilegeItemsByPrivilegeItemID(Guid privilegeItemID)
        {
            string     sql = @"SELECT [RoleID]
				, [PrivilegeItemID]
				 FROM [BE_PartnerRole2PrivilegeItem] 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 <PartnerRole2PrivilegeItem> ret = new List <PartnerRole2PrivilegeItem>();
            SqlDataReader dr = cmd.ExecuteReader();

            try
            {
                while (dr.Read())
                {
                    PartnerRole2PrivilegeItem iret = new PartnerRole2PrivilegeItem();
                    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);
        }