Example #1
0
        public ActionResult GetNotifierList(int consigneeId)
        {
            var notifierList = ListCommonHelper.GetNotifierList(consigneeId, "en");

            return(Json(notifierList.Select(x => new { Id = x.Key.ToString(), Value = x.Value })
                        .OrderBy(x => x.Value).ToList()));
        }
Example #2
0
        public ActionResult Add(int id = 0, byte orderFrom = 1)
        {
            #region Check Rights
            bool hasRights;
            if (orderFrom == 1) //Check export rights
            {
                if (id == 0)
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportQuotation, ActionEnum.Add);
                }
                else
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportQuotation, ActionEnum.Edit);
                }
            }
            else
            {
                if (id == 0)
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportQuotation, ActionEnum.Add);
                }
                else
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportQuotation, ActionEnum.Edit);
                }
            }


            if (!hasRights)
            {
                return(RedirectToAction("UnAuthorized", "Home"));
            }
            #endregion

            QuotationVm quotationsVm = QuotationHelper.GetQuotationInfo(id, orderFrom);

            ViewBag.CarrierList      = ListCommonHelper.GetCarrierList("en", 1);
            ViewBag.ShipperList      = ListCommonHelper.GetShipperList();
            ViewBag.ConsigneeList    = ListCommonHelper.GetConsigneeList();
            ViewBag.NotifierList     = ListCommonHelper.GetNotifierList(0);
            ViewBag.IncotermLib      = ListCommonHelper.GetIncotermLibList();
            ViewBag.Containers       = ListCommonHelper.GetContainerList();
            ViewData["PortList"]     = ListCommonHelper.GetPortsGrouped("en", 1);
            ViewData["CurrencyList"] = ListCommonHelper.GetCurrencyList();
            ViewBag.AgentList        = ListCommonHelper.GetAgentList();

            return(View(quotationsVm));
        }
        /// <summary>
        /// Get house bill .. in case of no house bills .. will fill its view model from operation data
        /// </summary>
        /// <param name="operationId"> int Operation Id </param>
        /// <param name="oprOrderFrom">byte Order From</param>
        /// <returns></returns>
        public ActionResult GetHbContent(int operationId, byte oprOrderFrom, int hbId = 0)
        {
            #region Check Rights
            bool hasRights;
            if (oprOrderFrom == 1) //Check export rights
            {
                if (hbId == 0)
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportHB, ActionEnum.Add);
                }
                else
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportHB, ActionEnum.Edit);
                }
            }
            else
            {
                if (hbId == 0)
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportHB, ActionEnum.Add);
                }
                else
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportHB, ActionEnum.Edit);
                }
            }

            if (!hasRights)
            {
                return(PartialView("~/Views/Shared/_UnAuthorized.cshtml"));
            }

            #endregion
            HouseBillVm houseBillVm = HouseBillHelper.GetHbContent(operationId, oprOrderFrom, hbId);
            ViewBag.ShipperList      = ListCommonHelper.GetShipperList();
            ViewBag.ConsigneeList    = ListCommonHelper.GetConsigneeList();
            ViewBag.IncotermLib      = ListCommonHelper.GetIncotermLibList();
            ViewBag.Containers       = ListCommonHelper.GetContainerList();
            ViewBag.PackageList      = ListCommonHelper.GetPackageTypeList();
            ViewData["PortList"]     = ListCommonHelper.GetPortsGrouped();
            ViewData["CurrencyList"] = ListCommonHelper.GetCurrencyList();
            ViewBag.AgentList        = ListCommonHelper.GetAgentList();
            ViewBag.OperationVm      = OperationHelper.GetOperationInfo(operationId);
            ViewBag.OperContainers   = OperationHelper.GetOperationContainers(operationId);
            ViewBag.SelectedHbCon    = HouseBillHelper.GetHousContainerByHouseID(hbId);
            ViewBag.NotifierList     = ListCommonHelper.GetNotifierList(0);
            return(PartialView("~/Views/Operation/_HouseBill.cshtml", houseBillVm));
        }
        /// <summary>
        /// Add export or import MBL operation
        /// </summary>
        /// <param name="orderFrom"> export --- import</param>
        /// <param name="id">operation id to load edit mode view</param>
        /// <param name="quoteId">quotation id in case of processing an exsiting quotation</param>
        /// <returns>the add operation view</returns>
        public ActionResult Add(string orderFrom = "export", int id = 0, int quoteId = 0)
        {
            #region Check Rights
            bool hasRights;
            if (orderFrom.ToLower() == "export") //Check export rights
            {
                if (quoteId != 0)                //process quotation check
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportQuotation, ActionEnum.ProcessToMBL);
                }
                else
                {
                    if (id == 0)
                    {
                        hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportMBL, ActionEnum.Add);
                    }
                    else
                    {
                        hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportMBL, ActionEnum.Edit);
                    }
                }
            }
            else
            {
                if (quoteId != 0) //process quotation check
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportQuotation, ActionEnum.ProcessToMBL);
                }
                else
                {
                    if (id == 0)
                    {
                        hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportMBL, ActionEnum.Add);
                    }
                    else
                    {
                        hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportMBL, ActionEnum.Edit);
                    }
                }
            }

            if (!hasRights)
            {
                return(RedirectToAction("UnAuthorized", "Home"));
            }

            #endregion

            byte orderFromInt = 0;
            if (orderFrom.ToLower() == "export")
            {
                ViewBag.OperationType = "Export";
                orderFromInt          = 1;
            }
            else if (orderFrom.ToLower() == "import")
            {
                ViewBag.OperationType = "Import";
                orderFromInt          = 2;
            }
            else
            {
                //Error Page
            }


            OperationVm operationVm = OperationHelper.GetOperationInfo(id, orderFromInt, quoteId);

            ViewBag.CarrierList      = ListCommonHelper.GetCarrierList();
            ViewBag.ShipperList      = ListCommonHelper.GetShipperList();
            ViewBag.ConsigneeList    = ListCommonHelper.GetConsigneeList();
            ViewBag.NotifierList     = ListCommonHelper.GetNotifierList(0);
            ViewBag.IncotermLib      = ListCommonHelper.GetIncotermLibList();
            ViewBag.Containers       = ListCommonHelper.GetContainerList();
            ViewBag.PackageList      = ListCommonHelper.GetPackageTypeList();
            ViewData["PortList"]     = ListCommonHelper.GetPortsGrouped();
            ViewData["CurrencyList"] = ListCommonHelper.GetCurrencyList();
            ViewBag.AgentList        = ListCommonHelper.GetAgentList();

            return(View(operationVm));
        }