Exemplo n.º 1
0
        public IActionResult Others()
        {
            OthersViewModel model = new OthersViewModel();

            try
            {
                string ReturnView  = "";
                string QRFID       = Request.Query["QRFId"].ToString();
                string SaveType    = Request.Query["SaveType"].ToString();
                string PositionId  = Request.Query["PositionId"];
                string ProductType = Request.Query["ProductType"];
                bool   IsClone     = Convert.ToBoolean(Request.Query["IsClone"]);
                model.OthersLocalGuide.QRFID   = QRFID;
                model.MenuViewModel.QRFID      = QRFID;
                model.MenuViewModel.PositionId = PositionId;
                if (ProductType.ToLower() == "guide")
                {
                    model.MenuViewModel.MenuName = "LocalGuide";
                }
                PositionGetReq positionGetReq = new PositionGetReq {
                    QRFID = QRFID, IsClone = IsClone
                };
                if (!string.IsNullOrEmpty(PositionId) && PositionId.Substring(0, 8) != "00000000")
                {
                    positionGetReq.PositionId = PositionId;
                }
                else
                {
                    if (string.IsNullOrEmpty(ProductType) || ProductType.ToLower() == "guide")
                    {
                        positionGetReq.ProductType.Add(new ProductType {
                            ProdType = "Guide"
                        });
                        positionGetReq.ProductType.Add(new ProductType {
                            ProdType = "Assistant"
                        });
                    }
                    else if (!string.IsNullOrWhiteSpace(ProductType) && (ProductType.ToLower() == "other" || ProductType.ToLower() == "fee"))
                    {
                        positionGetReq.ProductType.Add(new ProductType {
                            ProdType = "Other"
                        });
                        positionGetReq.ProductType.Add(new ProductType {
                            ProdType = "Fee"
                        });
                    }
                    else
                    {
                        positionGetReq.ProductType.Add(new ProductType {
                            ProdType = ProductType
                        });
                    }
                }

                PositionGetRes positionGetRes = positionProviders.GetPosition(positionGetReq, token).Result;

                SalesQuoteLibrary quoteLibrary = new SalesQuoteLibrary(_configuration);
                NewQuoteViewModel modelQuote   = new NewQuoteViewModel {
                    QRFID = model.MenuViewModel.QRFID
                };
                bool GetStatus = quoteLibrary.GetQRFAgentByQRFId(_configuration, token, ref modelQuote);
                if (GetStatus)
                {
                    model.TourInfoHeaderViewModel = modelQuote.TourInfoHeaderViewModel;
                }

                positionMapping.OthersLocalGuideGet(positionGetRes, ref model, token);

                switch (string.IsNullOrEmpty(ProductType) ? "" : ProductType.ToLower())
                {
                case "guide": ReturnView = "_OthersLocalGuide"; break;

                case "visa": ReturnView = "_OthersVisa"; break;

                case "insurance": ReturnView = "_OthersInsurance"; break;

                case "other": ReturnView = "_OthersMiscellaneous"; break;

                default: ReturnView = "_OthersLocalGuide"; break;
                }

                if (string.IsNullOrEmpty(PositionId) || PositionId.Substring(0, 8) == "00000000")
                {
                    if (!string.IsNullOrEmpty(SaveType) && SaveType.ToLower() == "full")
                    {
                        model.OthersLocalGuide.SaveType = "success";
                        return(PartialView(ReturnView, model.OthersLocalGuide));
                    }
                    else
                    {
                        return(View(model));
                    }
                }
                else
                {
                    return(PartialView(ReturnView, model.OthersLocalGuide));
                }
            }
            catch (Exception ex)
            {
                return(View(model));
            }
        }