public static RegulatorCMEQueryArguments Parse(NameValueCollection arguments) { RegulatorCMEQueryArguments args = new RegulatorCMEQueryArguments(); ParseTo(arguments, args); return(args); }
public static void ParseTo(NameValueCollection arguments, RegulatorCMEQueryArguments args) { arguments = arguments.ToLowercaseKey(); args.RegulatorCode = arguments.GetValueLowercaseKey <int>(RegulatorCodeArgument_Key, 0); args.StartDate = arguments.GetValueLowercaseKey <DateTime?>(StartDateArgument_Key, null); args.EndDate = arguments.GetValueLowercaseKey <DateTime?>(EndDateArgument_Key, null); args.CERSID = arguments.GetValueLowercaseKey <int?>(CERSIDArgument_Key, null); int temp; string[] statuses = arguments.GetValueLowercaseKey(Status_Key, string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string status in statuses) { if (int.TryParse(status, out temp)) { args.Statuses.Add((CMEDataStatus)temp); } } }