示例#1
0
        public static DateTime GetRequiredDateTimeViewState(StateBag viewState, string fieldName)
        {
            DateTime?returnValue = WebFormsHelper.GetDateTimeViewState(viewState, fieldName);

            if (!returnValue.HasValue)
            {
                throw new Exception(string.Format("Missing required ViewState DateTime value \"{0}\"", fieldName));
            }
            return(returnValue.Value);
        }
示例#2
0
        public static string GetStringParameter(string parameterName, string defaultValue)
        {
            string returnValue = WebFormsHelper.GetStringParameter(parameterName);

            if (string.IsNullOrEmpty(returnValue))
            {
                returnValue = defaultValue;
            }
            return(returnValue);
        }
示例#3
0
        public static DateTime GetRequiredDateTimeParameter(string parameterName)
        {
            DateTime?value = WebFormsHelper.GetDateTimeParameter(parameterName);

            if (!value.HasValue)
            {
                throw new Exception(string.Format("Missing {0} Parameter", parameterName));
            }
            return(value.Value);
        }
示例#4
0
        public static bool GetRequiredBoolViewState(StateBag viewState, string fieldName)
        {
            bool?returnValue = WebFormsHelper.GetBoolViewState(viewState, fieldName);

            if (!returnValue.HasValue)
            {
                throw new Exception(string.Format("Missing required ViewState boolean value \"{0}\"", fieldName));
            }
            return(returnValue.Value);
        }
示例#5
0
        public static string GetRequiredStringViewState(StateBag viewState, string fieldName)
        {
            string returnValue = WebFormsHelper.GetStringViewState(viewState, fieldName);

            if (string.IsNullOrEmpty(returnValue))
            {
                throw new Exception(string.Format("Missing required ViewState string value \"{0}\"", fieldName));
            }
            return(returnValue);
        }
示例#6
0
        public static T GetRequiredEnumViewState <T>(StateBag viewState, string fieldName) where T : struct
        {
            T?returnValue = WebFormsHelper.GetEnumViewState <T>(viewState, fieldName);

            if (!returnValue.HasValue)
            {
                throw new Exception(string.Format("Missing required ViewState {0} value \"{1}\"", typeof(T).Name, fieldName));
            }
            return(returnValue.Value);
        }
示例#7
0
        public static Guid GetRequiredGuidViewState(StateBag viewState, string fieldName)
        {
            Guid?returnValue = WebFormsHelper.GetGuidViewState(viewState, fieldName);

            if (!returnValue.HasValue)
            {
                throw new Exception(string.Format("Missing required ViewState GUID value \"{0}\"", fieldName));
            }
            return(returnValue.Value);
        }
示例#8
0
        public static string GetRequiredStringParameter(string parameterName)
        {
            string returnValue = WebFormsHelper.GetStringParameter(parameterName);

            if (string.IsNullOrEmpty(returnValue))
            {
                throw new Exception(string.Format("Missing {0} parameter", returnValue));
            }
            return(returnValue);
        }
示例#9
0
        public static int GetRequiredIntViewState(StateBag viewState, string fieldName)
        {
            int?returnValue = WebFormsHelper.GetIntViewState(viewState, fieldName);

            if (!returnValue.HasValue)
            {
                throw new Exception(string.Format("Missing required ViewState integer value \"{0}\"", fieldName));
            }
            return(returnValue.Value);
        }
示例#10
0
        public static int GetRequiredIntParameter(string parameterName)
        {
            int?value = WebFormsHelper.GetIntParameter(parameterName);

            if (!value.HasValue)
            {
                throw new Exception(string.Format("Missing {0} Parameter", parameterName));
            }
            return(value.Value);
        }
示例#11
0
        public static Guid GetRequiredGuidParameter(string parameterName)
        {
            Guid?guid = WebFormsHelper.GetGuidParameter(parameterName);

            if (!guid.HasValue)
            {
                throw new Exception(string.Format("Missing {0} Parameter", parameterName));
            }
            return(guid.Value);
        }
示例#12
0
        public static string GetStringParameter(StateBag viewState, string fieldName, string defaultValue)
        {
            string returnValue = WebFormsHelper.GetStringViewState(viewState, fieldName);

            if (string.IsNullOrEmpty(returnValue))
            {
                returnValue = defaultValue;
            }
            return(returnValue);
        }
示例#13
0
        public static Guid?GetGuidParameter(string parameterName)
        {
            Guid?  returnValue = null;
            string stringValue = WebFormsHelper.GetStringParameter(parameterName);

            if (!string.IsNullOrEmpty(stringValue))
            {
                Guid tempGuid;
                if (!GuidTryParse(stringValue, out tempGuid))
                {
                    throw new Exception(string.Format("Failed to parse Guid parameter \"{0}\" for value \"{1}\"", parameterName, stringValue));
                }
                returnValue = tempGuid;
            }
            return(returnValue);
        }
示例#14
0
        public static long?GetLongParameter(string parameterName)
        {
            long?  returnValue = null;
            string stringValue = WebFormsHelper.GetStringParameter(parameterName);

            if (!string.IsNullOrEmpty(stringValue))
            {
                long tempInt;
                if (!long.TryParse(stringValue, out tempInt))
                {
                    throw new Exception(string.Format("Failed to parse long parameter \"{0}\" for value \"{1}\"", parameterName, stringValue));
                }
                returnValue = tempInt;
            }
            return(returnValue);
        }
示例#15
0
 public Guid GetGuidViewState(string fieldName, Guid defaultValue)
 {
     return(WebFormsHelper.GetGuidViewState(this.ViewState, fieldName, defaultValue));
 }
示例#16
0
        public static DateTime GetDateTimeViewState(StateBag viewState, string fieldName, DateTime defaultValue)
        {
            DateTime?returnValue = WebFormsHelper.GetDateTimeViewState(viewState, fieldName);

            return(returnValue.GetValueOrDefault(defaultValue));
        }
示例#17
0
 protected void SetGuidViewState(string fieldName, Guid value)
 {
     WebFormsHelper.SetGuidViewState(this.ViewState, fieldName, value);
 }
示例#18
0
        public static int GetIntParameter(StateBag viewState, string fieldName, int defaultValue)
        {
            int?returnValue = WebFormsHelper.GetIntViewState(viewState, fieldName);

            return(returnValue.GetValueOrDefault(defaultValue));
        }
示例#19
0
 protected T GetEnumViewState <T>(string fieldName, T defaultValue) where T : struct
 {
     return(WebFormsHelper.GetEnumViewState <T>(this.ViewState, fieldName, defaultValue));
 }
示例#20
0
 protected void SetEnumViewState <T>(string fieldName, T value) where T : struct
 {
     WebFormsHelper.SetEnumViewState <T>(this.ViewState, fieldName, value);
 }
示例#21
0
 protected T GetRequiredEnumViewState <T>(string fieldName) where T : struct
 {
     return(WebFormsHelper.GetRequiredEnumViewState <T>(this.ViewState, fieldName));
 }
示例#22
0
 protected int?GetIntViewState(string fieldName)
 {
     return(WebFormsHelper.GetIntViewState(this.ViewState, fieldName));
 }
示例#23
0
        public static T GetEnumViewState <T>(StateBag viewState, string fieldName, T defaultValue) where T : struct
        {
            T?returnValue = WebFormsHelper.GetEnumViewState <T>(viewState, fieldName);

            return(returnValue.GetValueOrDefault(defaultValue));
        }
示例#24
0
 protected int GetIntViewState(string fieldName, int defaultValue)
 {
     return(WebFormsHelper.GetIntParameter(this.ViewState, fieldName, defaultValue));
 }
示例#25
0
        public static Guid GetGuidViewState(StateBag viewState, string fieldName, Guid defaultValue)
        {
            Guid?returnValue = WebFormsHelper.GetGuidViewState(viewState, fieldName);

            return(returnValue.GetValueOrDefault(defaultValue));
        }
示例#26
0
        public static bool GetBoolParameter(StateBag viewState, string fieldName, bool defaultValue)
        {
            bool?returnValue = WebFormsHelper.GetBoolViewState(viewState, fieldName);

            return(returnValue.GetValueOrDefault(defaultValue));
        }
示例#27
0
        public static bool GetBoolParameter(string parameterName, bool defaultValue)
        {
            bool?returnValue = WebFormsHelper.GetBoolParameter(parameterName);

            return(returnValue.GetValueOrDefault(defaultValue));
        }
示例#28
0
        public static DateTime GetDateTimeParameter(string parameterName, DateTime defaultValue)
        {
            DateTime?returnValue = WebFormsHelper.GetDateTimeParameter(parameterName);

            return(returnValue.GetValueOrDefault(defaultValue));
        }
示例#29
0
 protected Guid GetRequiredGuidViewState(string fieldName)
 {
     return(WebFormsHelper.GetRequiredGuidViewState(this.ViewState, fieldName));
 }
示例#30
0
        public static Guid GetGuidParameter(string parameterName, Guid defaultValue)
        {
            Guid?returnValue = WebFormsHelper.GetGuidParameter(parameterName);

            return(returnValue.GetValueOrDefault(defaultValue));
        }