Exemplo n.º 1
0
        private void LoadReport()
        {
            DateTime today = DateTime.UtcNow;

            today = today.Subtract(today.TimeOfDay);

            int identityId = 0;

            int.TryParse(cboClient.SelectedValue, out identityId);

            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            Facade.IJob          facJob          = new Facade.Job();

            DataSet dsReport = facJob.GetJobPricingData(identityId, dteStartDate.SelectedDate.Value, dteEndDate.SelectedDate.Value);

            if (dsReport.Tables[1].Rows.Count == 0)
            {
                lblError.Text        = "No completed delivery and returns for client " + cboClient.Text + " for period " + dteStartDate.SelectedDate.Value.ToString("dd/MM/yy") + " to " + dteEndDate.SelectedDate.Value.ToString("dd/MM/yy");
                lblError.Visible     = true;
                reportViewer.Visible = false;
            }

            else
            {
                lblError.Visible = false;

                NameValueCollection reportParams = new NameValueCollection();

                reportParams.Add("IdentityID", cboClient.SelectedValue);
                reportParams.Add("StartDate", dteStartDate.SelectedDate.Value.ToString("dd/MM/yy"));
                reportParams.Add("EndDate", dteEndDate.SelectedDate.Value.ToString("dd/MM/yy"));

                // Configure the Session variables used to pass data to the report
                Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable]       = eReportType.JobPricing;
                Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable]  = dsReport;
                Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable]   = String.Empty;
                Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table1";
                Session[Orchestrator.Globals.Constants.ReportParamsSessionVariable]     = reportParams;

                if (cboClient.SelectedValue != "")
                {
                    reportViewer.IdentityId = int.Parse(cboClient.SelectedValue);
                }
                // Show the user control
                reportViewer.Visible = true;
            }
        }
Exemplo n.º 2
0
        private void btnExportToCSV_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                int identityId = 0;
                int.TryParse(cboClient.SelectedValue, out identityId);

                DateTime start = dteStartDate.SelectedDate.Value;
                start = start.Subtract(start.TimeOfDay);
                DateTime end = dteEndDate.SelectedDate.Value;
                end = end.Subtract(end.TimeOfDay).Add(new TimeSpan(23, 59, 59));
                Facade.IJob facJob = new Facade.Job();

                DataSet dsReport = facJob.GetJobPricingData(identityId, dteStartDate.SelectedDate.Value, dteEndDate.SelectedDate.Value);
                Session["__ExportDS"] = dsReport.Tables[1];
                Server.Transfer("../Reports/csvexport.aspx?filename=runpricing.csv");
            }
        }