コード例 #1
0
        // Token: 0x060000A2 RID: 162 RVA: 0x0000913C File Offset: 0x0000733C
        public static T GetModel <T>(string prefix) where T : new()
        {
            T    t = (default(T) == null) ? Activator.CreateInstance <T>() : default(T);
            Type typeFromHandle = typeof(T);

            foreach (PropertyInfo propertyInfo in typeFromHandle.GetProperties())
            {
                if (propertyInfo != null && propertyInfo.CanWrite)
                {
                    string text = prefix + propertyInfo.Name;
                    if (text.ToLower() == prefix + "pageurl")
                    {
                        propertyInfo.SetValue(t, FPRequest.GetRawUrl(), null);
                    }
                    else if (HttpContext.Current.Request.QueryString[text] != null || HttpContext.Current.Request.Form[text] != null)
                    {
                        if (propertyInfo.PropertyType == typeof(string))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetString(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(int))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetInt(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(short))
                        {
                            propertyInfo.SetValue(t, short.Parse(FPRequest.GetInt(text).ToString()), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(DateTime))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetDateTime(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(decimal))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetDecimal(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(float))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetFloat(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(double))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetDouble(text), null);
                        }
                    }
                }
            }
            return(t);
        }
コード例 #2
0
        // Token: 0x060000A3 RID: 163 RVA: 0x000093EC File Offset: 0x000075EC
        public static T GetModel <T>(T model, string prefix)
        {
            Type type = model.GetType();

            foreach (PropertyInfo propertyInfo in type.GetProperties())
            {
                if (propertyInfo != null && propertyInfo.CanWrite)
                {
                    string text = prefix + propertyInfo.Name;
                    if (text.ToLower() == prefix + "pageurl")
                    {
                        propertyInfo.SetValue(model, FPRequest.GetRawUrl(), null);
                    }
                    else if (HttpContext.Current.Request.QueryString[text] != null || HttpContext.Current.Request.Form[text] != null)
                    {
                        if (propertyInfo.PropertyType == typeof(string))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetString(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(int))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetInt(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(DateTime))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetDateTime(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(decimal))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetDecimal(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(float))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetFloat(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(double))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetDouble(text), null);
                        }
                    }
                }
            }
            return(model);
        }
コード例 #3
0
 // Token: 0x0600009B RID: 155 RVA: 0x00009020 File Offset: 0x00007220
 public static decimal GetDecimal(string strName)
 {
     return(FPRequest.GetDecimal(strName, 0m));
 }