public ActionResult Create(DistributorManagementModel model)
        {
            TravelSession sessionObj = AdminSessionStore.GetTravelSession();

            try
            {
                model.CreatedBy      = sessionObj.AppUserId;
                model.BranchOfficeId = sessionObj.LoginTypeId;

                int distributorid = distributorManagementProvider.SaveDistributorManagementModel(model);

                SaveOrUpdateDistributorSetting(distributorid, model, sessionObj);

                TempData["InfoMessage"] = "Distributor Created Successfully.";
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                model.Countries     = new SelectList(agentManagementProvider.GetCountry(), "CountryId", "CountryName", model.NativeCountryId);
                model.StatusOption  = new SelectList(agentManagementProvider.GetStatus(), "id", "Name", model.Status);
                model.Zones         = new SelectList(agentManagementProvider.GetZoneList(), "ZoneId", "ZoneName", model.ZoneId);
                model.Districts     = new SelectList(agentManagementProvider.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName", model.DistrictId);
                model.TimeZones     = new SelectList(agentManagementProvider.GetTimeZoneList(), "RecordID", "StandardName", model.TimeZoneId);
                model.BranchOffices = new SelectList(distributorManagementProvider.GetBranchOffices(), "BranchOfficeId", "BranchOfficeName", model.BranchOfficeId);

                model.MasterDealNameListOfAirlines = provider.GetAllBranchDistributorDealListOfAirlines(sessionObj.LoginTypeId);
                model.MasterDealNameListOfHotels   = provider.GetAllBranchDistributorDealListOfHotels(sessionObj.LoginTypeId);
                model.MasterDealNameListOfBus      = provider.GetAllBranchDistributorDealListOfBus(sessionObj.LoginTypeId);
                model.MasterDealNameListOfMobile   = provider.GetAllBranchDistributorDealListOfMobile(sessionObj.LoginTypeId);

                ViewData["distributorClass"] = new SelectList(provider.GetDistributorClass(), "DistributorClassId", "DistributorClassName");
                model.DistributorClassId     = provider.GeDistributorClass(sessionObj.LoginTypeId);

                TempData["ActionResponse"] = ex.Message;
                return(View(model));
            }
        }
Exemplo n.º 2
0
        public ActionResult Create(DistributorManagementModel model)
        {
            try
            {
                TravelSession sessionObj = AdminSessionStore.GetTravelSession();
                model.CreatedBy = sessionObj.AppUserId;

                distributorManagementProvider.SaveDistributorManagementModel(model);

                TempData["InfoMessage"] = "Distributor Created Successfully.";
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                model.Countries            = new SelectList(agentManagementProvider.GetCountry(), "CountryId", "CountryName", model.NativeCountryId);
                model.StatusOption         = new SelectList(agentManagementProvider.GetStatus(), "id", "Name", model.Status);
                model.Zones                = new SelectList(agentManagementProvider.GetZoneList(), "ZoneId", "ZoneName", model.ZoneId);
                model.Districts            = new SelectList(agentManagementProvider.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName", model.DistrictId);
                model.TimeZones            = new SelectList(agentManagementProvider.GetTimeZoneList(), "RecordID", "StandardName", model.TimeZoneId);
                model.BranchOffices        = new SelectList(distributorManagementProvider.GetBranchOffices(), "BranchOfficeId", "BranchOfficeName", model.BranchOfficeId);
                TempData["ActionResponse"] = ex.Message;
                return(View(model));
            }
        }