Пример #1
0
        public ResponseResult <Parameter> GetParameter(string loginName)
        {
            var result = ResponseResult <Parameter> .Default();

            ParameterService parameterservice = new ParameterService();
            List <Parameter> parameters       = new List <Parameter>();

            try
            {
                if (string.IsNullOrEmpty(loginName))
                {
                    return(ResponseResult <Parameter> .Error("登录名称不能为空"));
                }
                else
                {
                    parameters = parameterservice.GetParameter(loginName);
                    result     = ResponseResult <Parameter> .Success(parameters, "获取成功");
                }
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <Parameter> .Error(ex.Message);
            }
            return(result);
        }
Пример #2
0
        public ActionResult ModelParametersEdit(string id)
        {
            var model = ParameterService.GetParameter(new Guid(id));

            model.Units = ParameterService.GetUnitsList();
            return(View(model));
        }
Пример #3
0
 public override object GetValue(string memberName, Type memberType)
 {
     memberType = Nullable.GetUnderlyingType(memberType) == null &&
                  memberType != typeof(string) &&
                  !memberType.IsArray
         ? typeof(Nullable <>).MakeGenericType(memberType)
         : memberType;
     return(s_parameterService.GetParameter(Name ?? memberName, memberType, (Separator ?? string.Empty).SingleOrDefault()));
 }
Пример #4
0
 public static T GetParameter <T>(string name, char?separator = null)
 {
     return((T)s_parameterService.GetParameter(name, typeof(T), separator));
 }
Пример #5
0
 /// <summary>
 /// Provides access to a command-line argument or environment variable switch.
 /// </summary>
 public static bool ParameterSwitch(string name)
 {
     return(s_parameterService.GetParameter <bool>(name));
 }