Пример #1
0
        public static string SetAttributeValue(DersaSqlManager DM, string userName, AttributeOwnerType ownerType, string entityId, string attrName, int attrType, string attrValue)
        {
            string procName = "";

            switch (ownerType)
            {
            case AttributeOwnerType.Entity:
                procName = "ENTITY$SetAttribute";
                break;

            case AttributeOwnerType.Relation:
                procName = "RELATION$SetAttribute";
                break;
            }
            IParameterCollection Params = new ParameterCollection();

            Params.Add("@entity", entityId);
            Params.Add("@attr_name", attrName);
            Params.Add("@attr_value", attrValue);
            Params.Add("@login", userName);
            Params.Add("@password", Util.GetPassword(userName));
            Params.Add("@attr_type", attrType);
            int res = DM.ExecuteSPWithResult(procName, false, Params);

            if (res == 5)
            {
                Params["@attr_type"].Value  = 5;
                Params["@attr_value"].Value = Cryptor.Encrypt(attrValue, userName);
                res = DM.ExecuteSPWithResult(procName, false, Params);
            }
            return("");
        }
Пример #2
0
        public static int GetUserPermissions(string userName)
        {
            DersaSqlManager      M          = new DersaSqlManager();
            IParameterCollection UserParams = new ParameterCollection();

            UserParams.Add("@login", userName);
            UserParams.Add("@password", Util.GetPassword(userName));
            return(M.ExecuteSPWithResult("DERSA_USER$GetPermissions", false, UserParams));
        }