示例#1
0
        public IActionResult Supplier()
        {
            AgentSearchViewModel model = new AgentSearchViewModel();

            #region Dropdown Binding
            AgentGetReq request     = new AgentGetReq();
            var         countrylist = masterProviders.GetAllCountries(token).Result;
            model.CountryList = countrylist;
            ProdTypeGetReq req = new ProdTypeGetReq();
            ProdTypeGetRes res = new ProdTypeGetRes();
            res = masterProviders.GetProdTypeByProdType(req, token).Result;
            model.ProductTypeList = res.ProductTypeList.OrderBy(x => x.Prodtype).ToList();
            #endregion

            return(View(model));
        }
示例#2
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;
            }
        }