private void btnProductReturns_Click(object sender, EventArgs e)
        {
            DateTime startDate = dtePRStartDate.SelectedDate.Value.Date;
            DateTime endDate   = dtePREndDate.SelectedDate.Value.Date.Add(new TimeSpan(23, 59, 59));

            Facade.IKPI facKPI   = new Orchestrator.Facade.KPI();
            DataSet     dsSource = facKPI.ProductReturns(startDate, endDate);

            CsvExport.Export(
                dsSource.Tables[0],
                "ProductReturns.csv",
                new CsvExport.ColumnMappings
            {
                { "OriginalCollectionPoint", "Despatch Point" },
                { "OriginalDeliveryOrderNumber", "Docket Number" },
                { "ReturnDeliveryDateTime", "Return Date", this.DateFormatter },
                { "RefusalType", "Refusal Type" },
                { "RefusalReceiptNumber", "Refusal Receipt Number" },
                { "RefusalNotes", "Refusal Notes" },
                { "ProductCode", "Product Code" },
                { "ProductName", "Product Name" },
                { "PackSize", "Pack Size" },
                { "QuantityRefused", "Quantity Refused" },
                { "ReturnDeliveryPoint", "Return To" },
                { "ReturnOrderRate", "ReturnOrderRate" },
            });
        }
        private void btnFactoryClearance_Click(object sender, EventArgs e)
        {
            DateTime startDate = dteFCStartDate.SelectedDate.Value.Date;
            DateTime endDate   = dteFCEndDate.SelectedDate.Value.Date.Add(new TimeSpan(23, 59, 59));

            Facade.IKPI facKPI   = new Orchestrator.Facade.KPI();
            DataSet     dsSource = facKPI.FactoryClearance(startDate, endDate);

            CsvExport.Export(
                dsSource.Tables[0],
                "FactoryClearance.csv",
                new CsvExport.ColumnMappings
            {
                { "MemberName", "Member" },
                { "CollectionPoint", "Collection Point" },
                { "LoadCount", "Load Count" },
            });
        }
        private DataSet GetData()
        {
            string orderStates = GetOrderStates();
            string cacheKey    = this.UniqueID + orderStates + StartDate.ToString() + "||" + EndDate.ToString();

            DataSet dsKPI = null;

            if (Cache[cacheKey] == null)
            {
                Orchestrator.Facade.IKPI facKPI = new Orchestrator.Facade.KPI();
                dsKPI = facKPI.GetOrdersByStateForPeriod(StartDate, EndDate, orderStates);
                Cache.Add(cacheKey, dsKPI, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 15, 00), CacheItemPriority.Normal, null);
            }
            else
            {
                dsKPI = (DataSet)Cache[cacheKey];
            }

            return(dsKPI);
        }