protected static FR_L3AS_GMSRfBS_1404_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3AS_GMSRfBS_1404 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L3AS_GMSRfBS_1404_Array(); #region Get_DailysalesOverall_for_TimePeriod P_L3AS_GDOfTP_1255 param = new P_L3AS_GDOfTP_1255(); param.DateFrom = Parameter.StartDate; param.DateTo = Parameter.EndDate; var dailysalesOverall = cls_Get_DailysalesOverall_for_TimePeriod.Invoke(Connection, Transaction, param, securityTicket).Result.ToList(); #endregion // 22.10.2014. - 01.10.2014 = 21days, we have to add 1 because we have to include both days var daysInBaseTimeSpan = (Parameter.EndDate - Parameter.StartDate).Days + 1; returnValue.Result = dailysalesOverall.Select(i => new L3AS_GMSRfBS_1404() { MSRB = Math.Round((i.OverallSoldQuantity / daysInBaseTimeSpan) * 30, 1), ProductID = i.Product_RefID }).ToArray(); return(returnValue); #endregion UserCode }
protected static FR_L3AS_GMSRfT_1215_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_L3AS_GMSRfT_1215_Array(); const double defaultConsideredDays = 90; #region GetConsideredDays var consDaysParam = new P_L2AS_GTASfSK_1313() { TenantApplicationSettingsKey = EnumUtils.GetEnumDescription(EApplicationSettings.MonthlySalesTimeSpan) }; var tenantAppSettings = cls_Get_Tenant_Application_Settings_for_SettingsKey.Invoke(Connection, Transaction, consDaysParam, securityTicket).Result; var consideredDays = defaultConsideredDays; if (tenantAppSettings != null) { double.TryParse(tenantAppSettings.DefaultValue, out consideredDays); double.TryParse(tenantAppSettings.ItemValue, out consideredDays); } #endregion #region Get_DailysalesOverall_for_TimePeriod P_L3AS_GDOfTP_1255 param = new P_L3AS_GDOfTP_1255(); param.DateFrom = DateTime.Now.AddDays(-consideredDays); param.DateTo = DateTime.Now; var dailysalesOverall = cls_Get_DailysalesOverall_for_TimePeriod.Invoke(Connection, Transaction, param, securityTicket).Result.ToList(); #endregion returnValue.Result = dailysalesOverall.Select(i => new L3AS_GMSRfT_1215() { MSR = Math.Round((i.OverallSoldQuantity / consideredDays) * 30, 1), ProductID = i.Product_RefID }).ToArray(); return(returnValue); #endregion UserCode }