예제 #1
0
        public static TVar GetVariable <TVar>(string UserName,
                                              string ModuleName, string VarName, TVar DefaultValue)
        {
            UserVariable Var = new UserVariable();

            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));
            }
        }
예제 #2
0
 public void SetUserVariable(string UserName, string ModuleName,
                             string VarName, object Value)
 {
     UserVariable.SetVariable(UserName, ModuleName, VarName, Value);
 }
예제 #3
0
 public TVar GetUserVariable <TVar>(string UserName, string ModuleName,
                                    string VarName, TVar DefaultValue)
 {
     return(UserVariable.GetVariable <TVar>(UserName, ModuleName, VarName, DefaultValue));
 }