Beispiel #1
0
        public ActionResult OceanExport()
        {
            CheckAccess();
            OceanReportMasterModel model = new OceanReportMasterModel();
            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 = "OceanExport", typeName = TypeName }));
            }
            if (Request["PeriodBegin"] == null || Request["ReSelect"] != null)
            {
                Session["OceanExportMasterReportData"] = 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["OceanExportReportSelection"] = ReportSelection;
                model = GetOceanExportMasterModel();

                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));
        }
Beispiel #2
0
        private OceanReportMasterModel GetOceanImportMasterModel()
        {
            ReportSelection selection    = (ReportSelection)Session["OceanImportReportSelection"];
            string          KeyFieldName = selection.CategorizeBy;

            Session["KeyFieldName"] = selection.CategorizeBy;

            OceanReportMasterModel model = new OceanReportMasterModel()
            {
                KeyFieldName = KeyFieldName
            };
            var data = GetOceanImportTransactionalData();

            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);
        }
Beispiel #3
0
        public ActionResult OceanImportMaster()
        {
            OceanReportMasterModel model = GetOceanImportMasterModel();

            return(PartialView("_OceanImportMaster", model));
        }