public override void Set(string name, string elementValue) { DateTime dtTemp; switch (name.ToLower()) { case "startdate": if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp)) this._dtStart = new RequestHistoricElementDate("startDate", dtTemp); else throw new ArgumentException(string.Format("BEmu.Request.Set: Bad startDate format {0}, yyyyMMdd expected", elementValue)); break; case "enddate": if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp)) this._dtEnd = new RequestHistoricElementDate("endDate", dtTemp); else throw new ArgumentException(string.Format("BEmu.Request.Set: Bad endDate format {0}, yyyyMMdd expected", elementValue)); break; case "periodicityadjustment": string pAdjUpper = elementValue.ToUpper(); switch (pAdjUpper) { case "CALENDAR": this._periodicityAdjustment = HistDataPeriodicityAdjustment.calendar; break; case "FISCAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.fiscal; break; case "ACTUAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.actual; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityadjustment", elementValue)); } this._periodicityAdjustmentElement = new RequestHistoricElementString("periodicityAdjustment", pAdjUpper); break; case "periodicityselection": string pUpper = elementValue.ToUpper(); switch (pUpper) { case "WEEKLY": this._periodicity = HistDataPeriodicity.weekly; break; case "MONTHLY": this._periodicity = HistDataPeriodicity.monthly; break; case "QUARTERLY": this._periodicity = HistDataPeriodicity.quarterly; break; case "SEMI_ANNUALLY": this._periodicity = HistDataPeriodicity.semi_annually; break; case "YEARLY": this._periodicity = HistDataPeriodicity.yearly; break; case "DAILY": this._periodicity = HistDataPeriodicity.daily; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityselection", elementValue)); } this._periodicityElement = new RequestHistoricElementString("periodicitySelection", pUpper); break; case "pricingoption": string prUpper = elementValue.ToUpper(); switch (prUpper) { case "PRICING_OPTION_YIELD": this._pricingOption = PricingOption.yield; break; case "PRICING_OPTION_PRICE": this._pricingOption = PricingOption.price; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for pricingOption", elementValue)); } this._pricingOptionElement = new RequestHistoricElementString("pricingOption", prUpper); break; case "overrideoption": string strOpt = elementValue.ToUpper(); switch (strOpt) { case "OVERRIDE_OPTION_GPA": this._overrideOptions = OverrideOptions.averagePrice; break; case "OVERRIDE_OPTION_CLOSE": this._overrideOptions = OverrideOptions.closingPrice; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for overrideoption", elementValue)); } this._overrideOptionsElement = new RequestHistoricElementString("overrideOption", strOpt); break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: Element name {0} not supported", name)); } }
public override void Set(string name, string elementValue) { DateTime dtTemp; switch (name) { case "startDate": if (Types.DisplayFormats.HistoricalOrReferenceRequests.TryParseInput(elementValue, out dtTemp)) { this._dtStart = new HistoricRequestElementDate("startDate", dtTemp); } else { throw new ArgumentException(string.Format("BEmu.Request.Set: Bad startDate format {0}, yyyyMMdd expected", elementValue)); } break; case "endDate": if (Types.DisplayFormats.HistoricalOrReferenceRequests.TryParseInput(elementValue, out dtTemp)) { this._dtEnd = new HistoricRequestElementDate("endDate", dtTemp); } else { throw new ArgumentException(string.Format("BEmu.Request.Set: Bad endDate format {0}, yyyyMMdd expected", elementValue)); } break; case "periodicityAdjustment": switch (elementValue) { case "CALENDAR": this._periodicityAdjustment = HistDataPeriodicityAdjustment.calendar; break; case "FISCAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.fiscal; break; case "ACTUAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.actual; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityadjustment. These are case-sensitive.", elementValue)); } this._periodicityAdjustmentElement = new HistoricRequestElementString("periodicityAdjustment", elementValue); break; case "periodicitySelection": switch (elementValue) { case "WEEKLY": this._periodicity = HistDataPeriodicity.weekly; break; case "MONTHLY": this._periodicity = HistDataPeriodicity.monthly; break; case "QUARTERLY": this._periodicity = HistDataPeriodicity.quarterly; break; case "SEMI_ANNUALLY": this._periodicity = HistDataPeriodicity.semi_annually; break; case "YEARLY": this._periodicity = HistDataPeriodicity.yearly; break; case "DAILY": this._periodicity = HistDataPeriodicity.daily; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityselection. These are case-sensitive.", elementValue)); } this._periodicityElement = new HistoricRequestElementString("periodicitySelection", elementValue); break; case "pricingOption": switch (elementValue) { case "PRICING_OPTION_YIELD": this._pricingOption = PricingOption.yield; break; case "PRICING_OPTION_PRICE": this._pricingOption = PricingOption.price; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for pricingOption. These are case-sensitive.", elementValue)); } this._pricingOptionElement = new HistoricRequestElementString("pricingOption", elementValue); break; case "overrideOption": switch (elementValue) { case "OVERRIDE_OPTION_GPA": this._overrideOptions = OverrideOptions.averagePrice; break; case "OVERRIDE_OPTION_CLOSE": this._overrideOptions = OverrideOptions.closingPrice; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for overrideoption. These are case-sensitive.", elementValue)); } this._overrideOptionsElement = new HistoricRequestElementString("overrideOption", elementValue); break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: Element name {0} not supported. These are case-sensitive.", name)); } }
public override void Set(string name, string elementValue) { DateTime dtTemp; switch (name.ToLower()) { case "startdate": if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp)) { this._dtStart = new RequestHistoricElementDate("startDate", dtTemp); } else { throw new ArgumentException(string.Format("BEmu.Request.Set: Bad startDate format {0}, yyyyMMdd expected", elementValue)); } break; case "enddate": if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp)) { this._dtEnd = new RequestHistoricElementDate("endDate", dtTemp); } else { throw new ArgumentException(string.Format("BEmu.Request.Set: Bad endDate format {0}, yyyyMMdd expected", elementValue)); } break; case "periodicityadjustment": string pAdjUpper = elementValue.ToUpper(); switch (pAdjUpper) { case "CALENDAR": this._periodicityAdjustment = HistDataPeriodicityAdjustment.calendar; break; case "FISCAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.fiscal; break; case "ACTUAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.actual; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityadjustment", elementValue)); } this._periodicityAdjustmentElement = new RequestHistoricElementString("periodicityAdjustment", pAdjUpper); break; case "periodicityselection": string pUpper = elementValue.ToUpper(); switch (pUpper) { case "WEEKLY": this._periodicity = HistDataPeriodicity.weekly; break; case "MONTHLY": this._periodicity = HistDataPeriodicity.monthly; break; case "QUARTERLY": this._periodicity = HistDataPeriodicity.quarterly; break; case "SEMI_ANNUALLY": this._periodicity = HistDataPeriodicity.semi_annually; break; case "YEARLY": this._periodicity = HistDataPeriodicity.yearly; break; case "DAILY": this._periodicity = HistDataPeriodicity.daily; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityselection", elementValue)); } this._periodicityElement = new RequestHistoricElementString("periodicitySelection", pUpper); break; case "pricingoption": string prUpper = elementValue.ToUpper(); switch (prUpper) { case "PRICING_OPTION_YIELD": this._pricingOption = PricingOption.yield; break; case "PRICING_OPTION_PRICE": this._pricingOption = PricingOption.price; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for pricingOption", elementValue)); } this._pricingOptionElement = new RequestHistoricElementString("pricingOption", prUpper); break; case "overrideoption": string strOpt = elementValue.ToUpper(); switch (strOpt) { case "OVERRIDE_OPTION_GPA": this._overrideOptions = OverrideOptions.averagePrice; break; case "OVERRIDE_OPTION_CLOSE": this._overrideOptions = OverrideOptions.closingPrice; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for overrideoption", elementValue)); } this._overrideOptionsElement = new RequestHistoricElementString("overrideOption", strOpt); break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: Element name {0} not supported", name)); } }