/// <summary> /// Creates the specified serial entry. /// </summary> /// <param name="serialEntry">The serial entry.</param> /// <param name="configuration">The configuration.</param> /// <param name="date">The date.</param> /// <param name="theDelegate">The delegate.</param> /// <returns></returns> public static UPSEQuotaHandler Create(UPSerialEntry serialEntry, ViewReference configuration, DateTime date, UPSEQuotaHandlerDelegate theDelegate) { try { return(new UPSEQuotaHandler(serialEntry, configuration, date, theDelegate)); } catch { return(null); } }
/// <summary> /// Initializes a new instance of the <see cref="UPSEQuotaHandler"/> class. /// </summary> /// <param name="serialEntry">The serial entry.</param> /// <param name="configuration">The configuration.</param> /// <param name="date">The date.</param> /// <param name="theDelegate">The delegate.</param> /// <exception cref="Exception"> /// ArticleConfigurationSearchAndList is null /// or /// QuotaSearchAndList is null /// </exception> private UPSEQuotaHandler(UPSerialEntry serialEntry, ViewReference configuration, DateTime date, UPSEQuotaHandlerDelegate theDelegate) { this.SerialEntry = serialEntry; this.Configuration = configuration; this.TheDelegate = theDelegate; this.Date = date; var configStore = ConfigurationUnitStore.DefaultStore; this.InitializeBaseConfigStore(configStore); this.InitializeMax(); this.ParentLinkString = this.Configuration.ContextValueForKey("ParentLink"); this.RequestOption = UPCRMDataStore.RequestOptionFromString( this.Configuration.ContextValueForKey("RequestOption"), UPRequestOption.FastestAvailable); this.ItemNumberFunctionName = this.Configuration.ContextValueForKey("ItemNumberFunctionName"); if (string.IsNullOrWhiteSpace(this.ItemNumberFunctionName)) { this.ItemNumberFunctionName = "ItemNumber"; } this.RowItemNumberFunctionName = this.Configuration.ContextValueForKey("RowItemNumberFunctionName"); if (string.IsNullOrWhiteSpace(this.RowItemNumberFunctionName)) { this.RowItemNumberFunctionName = this.ItemNumberFunctionName; } this.InitializeQuotaFieldNames(); var configName = this.Configuration.ContextValueForKey("QuotaLinkId"); if (!string.IsNullOrWhiteSpace(configName)) { int qLinkId = -1; int.TryParse(configName, out qLinkId); this.QuotaLinkId = qLinkId; } else { this.QuotaLinkId = -1; } this.InitializeConfigOptions(); configName = this.Configuration.ContextValueForKey("NewQuotaTemplateFilter"); if (!string.IsNullOrWhiteSpace(configName)) { this.QuotaTemplateFilter = configStore.FilterByName(configName); } }