Example #1
0
        public ActionResult ReportLayout(string name)
        {
            ReportHeader      header = new ReportHeaderService(_unitOfWork).GetReportHeaderByName(name);
            List <ReportLine> lines  = _ReportLineService.GetReportLineList(header.ReportHeaderId).ToList();

            Dictionary <int, string> DefaultValues = TempData["ReportLayoutDefaultValues"] as Dictionary <int, string>;

            TempData["ReportLayoutDefaultValues"] = DefaultValues;
            foreach (var item in lines)
            {
                if (DefaultValues != null && DefaultValues.ContainsKey(item.ReportLineId))
                {
                    item.DefaultValue = DefaultValues[item.ReportLineId];
                }
            }

            ReportMasterViewModel vm = new ReportMasterViewModel();

            if (TempData["closeOnSelectOption"] != null)
            {
                vm.closeOnSelect = (bool)TempData["closeOnSelectOption"];
            }

            vm.ReportHeader   = header;
            vm.ReportLine     = lines;
            vm.ReportHeaderId = header.ReportHeaderId;

            return(View(vm));
        }
Example #2
0
        public ActionResult PackingReportLayout(string name, int Id = 0)
        {
            ReportHeader      header = new ReportHeaderService(_unitOfWork).GetReportHeaderByName(name);
            List <ReportLine> lines  = _ReportLineService.GetReportLineList(header.ReportHeaderId).ToList();

            ReportMasterViewModel vm = new ReportMasterViewModel();

            vm.ReportHeader   = header;
            vm.ReportLine     = lines;
            vm.ReportHeaderId = header.ReportHeaderId;

            ViewBag.DataHeaderId = Id;
            return(View(vm));
        }
Example #3
0
        public ActionResult GridReportLayout(int?MenuId, string MenuName, int?DocTypeId)
        {
            Menu              menu   = new Menu();
            ReportHeader      header = null;
            List <ReportLine> lines  = new List <ReportLine>();

            if (MenuId != null)
            {
                menu   = new MenuService(_unitOfWork).Find((int)MenuId);
                header = new ReportHeaderService(_unitOfWork).GetReportHeaderByName(menu.MenuName);
                if (header != null)
                {
                    lines = new ReportLineService(_unitOfWork).GetReportLineList(header.ReportHeaderId).ToList();
                }
                else
                {
                    new GridReportService().GetGridReportByName(menu.MenuName, ref header, ref lines, null);
                }
            }
            else
            {
                new GridReportService().GetGridReportByName(MenuName, ref header, ref lines, null);
            }


            if (DocTypeId != null)
            {
                ReportLine ReportLineDocType = (from L in lines where L.FieldName == "DocumentType" select L).FirstOrDefault();
                ReportLineDocType.DefaultValue = DocTypeId.ToString();
            }


            Dictionary <int, string> DefaultValues = TempData["ReportLayoutDefaultValues"] as Dictionary <int, string>;

            TempData["ReportLayoutDefaultValues"] = DefaultValues;
            foreach (var item in lines)
            {
                if (DefaultValues != null && DefaultValues.ContainsKey(item.ReportLineId))
                {
                    item.DefaultValue = DefaultValues[item.ReportLineId];
                }
            }

            ReportMasterViewModel vm = new ReportMasterViewModel();

            if (TempData["closeOnSelectOption"] != null)
            {
                vm.closeOnSelect = (bool)TempData["closeOnSelectOption"];
            }

            vm.ReportHeader   = header;
            vm.ReportLine     = lines;
            vm.ReportHeaderId = header.ReportHeaderId;


            if (DocTypeId != null)
            {
                DocumentType DocType = db.DocumentType.Find(DocTypeId);
                vm.ReportTitle = DocType.DocumentTypeName + " Report";
            }

            vm.ReportHeaderCompanyDetail = new GridReportService().GetReportHeaderCompanyDetail();

            return(View(vm));
        }