Пример #1
0
        public void SetRoleUserVariable(string ProductName, string ModuleName,
                                        string VarName, object Value)
        {
            string TmpUser = _CurrentRole.Length == 0 ? string.Empty : _CurrentUser;

            RoleUserVariable.SetVariable(ProductName, _CurrentRole, TmpUser,
                                         ModuleName, VarName, Value);
        }
Пример #2
0
        public TVar GetRoleUserVariable <TVar>(string ProductName, string ModuleName,
                                               string VarName, TVar DefaultValue)
        {
            string TmpUser = _CurrentRole.Length == 0 ? string.Empty : _CurrentUser;

            return(RoleUserVariable.GetVariable <TVar>(ProductName, _CurrentRole,
                                                       TmpUser, ModuleName, VarName, DefaultValue));
        }
Пример #3
0
        public static TVar GetVariable <TVar>(string ProductName,
                                              string RoleName, string UserName,
                                              string ModuleName, string VarName, TVar DefaultValue)
        {
            RoleUserVariable Var = new RoleUserVariable();

            Var.ProductName = ProductName;
            Var.RoleName    = RoleName;
            Var.UserName    = UserName;
            Var.ModuleName  = ModuleName;
            Var.VarName     = VarName;

            if (!Var.LoadEntity(false))
            {
                return(DefaultValue);
            }

            Type tp = typeof(TVar);

            if (tp == typeof(Image))
            {
                if (Var.BinValue == null)
                {
                    return((TVar)(object)null);
                }
                else
                {
                    return((TVar)(object)Helper.ConvertByteArrayToImage(Var.BinValue));
                }
            }
            else if (tp == typeof(byte[]))
            {
                return((TVar)(object)Var.BinValue);
            }
            else
            {
                return(BaseUtility.ConvertFromString <TVar>(
                           (string)Var.VarValue));
            }
        }
Пример #4
0
        public static void SetVariable(string ProductName,
                                       string RoleName, string UserName,
                                       string ModuleName, string VarName, object VarValue)
        {
            DataPersistance  dp  = BaseFramework.GetDefaultDp();
            RoleUserVariable Var = new RoleUserVariable();

            Var.ProductName = ProductName;
            Var.RoleName    = RoleName;
            Var.UserName    = UserName;
            Var.ModuleName  = ModuleName;
            Var.VarName     = VarName;
            Var.VarValue    = string.Empty;
            if (VarValue == null)
            {
                Var.BinValue = null;
            }
            else
            {
                Type tp = VarValue.GetType();
                if (tp == typeof(Bitmap) ||
                    tp == typeof(Image))
                {
                    Helper.ConvertImageToByteArray((Image)VarValue);
                    Var.BinValue = Helper.ConvertImageToByteArray(
                        (Image)VarValue);
                }
                else if (tp == typeof(byte[]))
                {
                    Var.BinValue = (byte[])VarValue;
                }
                else
                {
                    Var.VarValue = BaseUtility.ConvertToString(VarValue);
                }
            }
            Var.Save();
        }
Пример #5
0
 public void SetRoleUserVariable(string ProductName, string RoleName,
                                 string UserName, string ModuleName, string VarName, object Value)
 {
     RoleUserVariable.SetVariable(ProductName, RoleName, UserName, ModuleName, VarName, Value);
 }
Пример #6
0
 public TVar GetRoleUserVariable <TVar>(string ProductName, string RoleName,
                                        string UserName, string ModuleName, string VarName, TVar DefaultValue)
 {
     return(RoleUserVariable.GetVariable <TVar>(ProductName, RoleName, UserName, ModuleName, VarName, DefaultValue));
 }