//--------------------------------------------------------------------------------------- protected void btnRefresh_Click(object sender, EventArgs e) { int resourceId = 0; bool driverOrVehicle = false; if (this.VehiclesRadioButton.Checked) { int.TryParse(this.cboVehicle.SelectedValue, out resourceId); driverOrVehicle = true; } else if (this.DriversRadioButton.Checked) { int.TryParse(this.cboDriver.SelectedValue, out resourceId); driverOrVehicle = false; } Facade.IInstruction facInstruction = new Orchestrator.Facade.Instruction(); DataSet dsRouteDeviation = facInstruction.GetRouteDeviationReport(resourceId, driverOrVehicle, dteStartDate.SelectedDate.Value, dteEndDate.SelectedDate.Value, Convert.ToInt32(this.txtDeviationPerc.Value.Value), Convert.ToInt32(this.txtEstimatedDistance.Value.Value)); NameValueCollection reportParams = new NameValueCollection(); 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.RouteDeviation; Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable] = dsRouteDeviation; Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable] = String.Empty; Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table"; Session[Orchestrator.Globals.Constants.ReportParamsSessionVariable] = reportParams; // Show the user control reportViewer.Visible = true; }
//--------------------------------------------------------------------------------------- protected void btnExport_Click(object sender, EventArgs e) { int resourceId = 0; bool driverOrVehicle = false; if (this.VehiclesRadioButton.Checked) { int.TryParse(this.cboVehicle.SelectedValue, out resourceId); driverOrVehicle = true; } else if (this.DriversRadioButton.Checked) { int.TryParse(this.cboDriver.SelectedValue, out resourceId); driverOrVehicle = false; } Facade.IInstruction facInstruction = new Orchestrator.Facade.Instruction(); DataSet dsRouteDeviation = facInstruction.GetRouteDeviationReport(resourceId, driverOrVehicle, dteStartDate.SelectedDate.Value, dteEndDate.SelectedDate.Value, Convert.ToInt32(this.txtDeviationPerc.Value.Value), Convert.ToInt32(this.txtEstimatedDistance.Value.Value)); Session["__ExportDS"] = dsRouteDeviation.Tables[0]; Response.Redirect("../reports/csvexport.aspx?filename=RouteDeviationByDateRange" + resourceId.ToString() + ".CSV"); }