public ActionResult AirExport() { CheckAccess(); AirReportMasterModel model = new AirReportMasterModel(); bool forwardToPrint = false; string TypeName = ""; foreach (string typeName in GridViewExportHelper.ExportTypes.Keys) { if (Request.Params[typeName] != null) { TypeName = typeName; forwardToPrint = true; } } if (forwardToPrint) { return(RedirectToAction("ExportTo", new { Operation = "AirExport", typeName = TypeName })); } if (Request["PeriodBegin"] == null || Request["ReSelect"] != null) { Session["AirExportMasterReportData"] = null; ViewBag.IsSelected = false; } else { ReportSelection ReportSelection = new ReportSelection(); CultureInfo ci = new CultureInfo("en-US"); ReportSelection.PeriodBegin = Convert.ToDateTime(Request["PeriodBegin"], ci); ReportSelection.PeriodEnd = Convert.ToDateTime(Request["PeriodEnd"], ci); ReportSelection.CategorizeBy = Convert.ToString(Request["CategorizeBy"]); ReportSelection.WeightScale = Convert.ToString(Request["WeightScale"]); ReportSelection.AnalysisOn = Convert.ToString(Request["chkAnalysisOn"]); Session["AirExportReportSelection"] = ReportSelection; model = GetAirExportMasterModel(); model.PeriodBegin = ReportSelection.PeriodBegin; model.PeriodEnd = ReportSelection.PeriodEnd; model.CategorizeBy = ReportSelection.CategorizeBy; model.WeightScale = ReportSelection.WeightScale; model.AnalysisOn = ReportSelection.AnalysisOn; ViewBag.IsSelected = true; } return(View(model)); }
private AirReportMasterModel GetAirExportMasterModel() { ReportSelection selection = (ReportSelection)Session["AirExportReportSelection"]; string KeyFieldName = selection.CategorizeBy; Session["KeyFieldName"] = selection.CategorizeBy; AirReportMasterModel model = new AirReportMasterModel() { KeyFieldName = KeyFieldName }; var data = GetAirExportTransactionalData(); if (KeyFieldName == "Agent") { model.Elements = data.GroupBy(d => d.Agent).Select(grp => grp.First()).ToList(); } if (KeyFieldName == "Shipper") { model.Elements = data.GroupBy(d => d.Shipper).Select(grp => grp.First()).ToList(); } if (KeyFieldName == "Carrier") { model.Elements = data.GroupBy(d => d.Carrier).Select(grp => grp.First()).ToList(); } if (KeyFieldName == "Consignee") { model.Elements = data.GroupBy(d => d.Consignee).Select(grp => grp.First()).ToList(); } if (KeyFieldName == "Origin") { model.Elements = data.GroupBy(d => d.Origin).Select(grp => grp.First()).ToList(); } if (KeyFieldName == "Destination") { model.Elements = data.GroupBy(d => d.Destination).Select(grp => grp.First()).ToList(); } if (KeyFieldName == "Sale_Rep") { model.Elements = data.GroupBy(d => d.Sale_Rep).Select(grp => grp.First()).ToList(); } return(model); }
public ActionResult AirImportMaster() { AirReportMasterModel model = GetAirImportMasterModel(); return(PartialView("_AirImportMaster", model)); }