Exemplo n.º 1
0
        public IActionResult SupplierDetail(string CompanyId)
        {
            try
            {
                if (UserRoles.Contains("Administrator"))
                {
                    ViewBag.IsAllowToEdit = true;
                }

                AgentSearchViewModel model = new AgentSearchViewModel();
                request           = new AgentGetReq();
                response          = new AgentGetRes();
                request.CompanyId = CompanyId;
                response          = agentProviders.GetAgentDetailedInfo(request, token).Result;
                if (response != null)
                {
                    bool issupplier = false; if (response.AgentDetails.Issupplier == null || response.AgentDetails.Issupplier == false)
                    {
                        issupplier = false;
                    }
                    else
                    {
                        issupplier = true;
                    }
                    model.AgentDetails.CompanyId        = response.AgentDetails.Company_Id;
                    model.AgentDetails.CompanyName      = response.AgentDetails.Name;
                    model.AgentDetails.CompanyCode      = response.AgentDetails.CompanyCode;
                    model.AgentDetails.Street           = response.AgentDetails.Street;
                    model.AgentDetails.Street2          = response.AgentDetails.Street2;
                    model.AgentDetails.Street3          = response.AgentDetails.Street3;
                    model.AgentDetails.Zipcode          = response.AgentDetails.Zipcode;
                    model.AgentDetails.SalesOfficesList = response.AgentDetails.SalesOffices;
                    model.AgentDetails.Issubagent       = response.AgentDetails.Issubagent.HasValue ? response.AgentDetails.Issubagent.Value : false;
                    model.AgentDetails.B2C              = response.AgentDetails.B2C.HasValue ? response.AgentDetails.B2C.Value : false;
                    model.AgentDetails.LogoFilePath     = response.AgentDetails.LogoFilePath;
                    model.AgentDetails.CountryId        = response.AgentDetails.Country_Id;
                    model.AgentDetails.CountryName      = response.AgentDetails.CountryName;
                    model.AgentDetails.CityId           = response.AgentDetails.City_Id;
                    model.AgentDetails.CityName         = response.AgentDetails.CityName;
                    model.AgentDetails.SalesOffices     = response.AgentDetails.ParentAgent_Id;
                    model.AgentDetails.SalesOfficesName = response.AgentDetails.ParentAgent_Name;
                    model.AgentDetails.Issupplier       = issupplier;
                    model.AgentDetails.Status           = (response.AgentDetails.STATUS == "" || response.AgentDetails.STATUS == " ") ? "Active" : "Inactive";
                    if (response.AgentDetails.SalesOffices == null)
                    {
                        model.AgentDetails.SalesOfficesList = new List <ChildrenCompanies>();
                    }

                    #region Get country and city list from masters
                    var countrylist = masterProviders.GetAllCountries(token).Result;
                    var countryId   = response.AgentDetails.Country_Id;
                    model.AgentDetails.CountryList = countrylist;
                    var citylist = masterProviders.GetAllCitiesByCountryId(countryId, token).Result;
                    model.AgentDetails.CityList = citylist;
                    #endregion
                }

                return(View("AgentDetail", model));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public IActionResult NewQuote()
        {
            try
            {
                string QRFID             = Request.Query["QRFId"];
                string SubStep           = Convert.ToString(Request.Query["SubStep"]);
                string Module            = Request.Query["Module"];
                string PartnerEntityCode = Request.Query["PartnerEntityCode"];
                string Application       = Request.Query["Application"];
                string Operation         = Request.Query["Operation"];
                string CompanyId         = Request.Query["CompanyId"];
                string ContactId         = Request.Query["ContactId"];

                if (!string.IsNullOrEmpty(SubStep) && SubStep == "Routing")
                {
                    NewQuoteViewModel model = GetRoutingDetails(QRFID);
                    return(PartialView("_QuoteRouting", model.mdlQuoteRoutingViewModel));
                }
                else if (!string.IsNullOrEmpty(SubStep) && SubStep == "Margins")
                {
                    bool IsCostingMargin    = Convert.ToBoolean(Request.Query["IsCostingMargin"]);
                    NewQuoteViewModel model = GetMarginDetails(QRFID, IsCostingMargin);
                    TempData["IsCostingMargin"] = IsCostingMargin;
                    return(PartialView("_QuoteMargins", model.mdlQuoteMarginViewModel));
                }
                else
                {
                    NewQuoteViewModel model = new NewQuoteViewModel();
                    bool GetStatus          = false;
                    model.mdlMenuViewModel.QRFID                       = QRFID;
                    model.mdlQuoteAgentInfoViewModel.Module            = Module;
                    model.mdlQuoteAgentInfoViewModel.PartnerEntityCode = PartnerEntityCode;
                    model.mdlQuoteAgentInfoViewModel.Application       = Application;
                    model.mdlQuoteAgentInfoViewModel.Operation         = Operation;
                    SalesQuoteLibrary quoteLibrary = new SalesQuoteLibrary(_configuration);
                    #region Agent Info
                    if (!string.IsNullOrEmpty(QRFID))
                    {
                        QuoteThirdPartyGetReq modelreq = new QuoteThirdPartyGetReq();
                        model.QRFID    = QRFID;
                        modelreq.QrfID = QRFID;
                        model.mdlQuoteDateRangeViewModel.QRFID = QRFID;
                        GetStatus = quoteLibrary.GetQRFAgentByQRFId(_configuration, token, ref model);

                        QuoteThirdPartyGetRes response = salesProviders.GetPartnerQuoteDetails(modelreq, token).Result;
                        if (response != null)
                        {
                            model.mdlQuoteAgentInfoViewModel.Module            = response?.PartnerEntityName;
                            model.mdlQuoteAgentInfoViewModel.PartnerEntityCode = response?.PartnerEntityCode;
                            model.mdlQuoteAgentInfoViewModel.Application       = response?.ApplicationName?.ToLower();
                        }
                    }
                    else if (!string.IsNullOrEmpty(ContactId) && !string.IsNullOrEmpty(CompanyId))
                    {
                        model.mdlQuoteAgentInfoViewModel.AgentId = CompanyId;
                        var agentInfo = agentProviders.GetAgentDetailedInfo(new AgentGetReq()
                        {
                            CompanyId = CompanyId
                        }, token).Result;
                        model.mdlQuoteAgentInfoViewModel.AgentName     = agentInfo.AgentDetails.Name;
                        model.mdlQuoteAgentInfoViewModel.ContactPerson = ContactId;
                        var contactInfo = agentInfo.AgentDetails.ContactDetails.Where(a => a.Contact_Id == ContactId).FirstOrDefault();
                        model.mdlQuoteAgentInfoViewModel.Email    = contactInfo.MAIL;
                        model.mdlQuoteAgentInfoViewModel.MobileNo = contactInfo.MOBILE;
                    }

                    quoteLibrary.LoadQuoteAgentInfo(_configuration, token, ref model, ckUserEmailId, ckUserCompanyId);
                    #endregion

                    if (model.mdlQuoteAgentInfoViewModel.ContactPersonList.Count == 0)
                    {
                        model.mdlQuoteAgentInfoViewModel.MobileNo = "";
                        model.mdlQuoteAgentInfoViewModel.Email    = "";
                    }

                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }