Example #1
0
        public ActionResult Edit(DistributorManagementModel model, int id)
        {
            try
            {
                TravelSession sessionObj = AdminSessionStore.GetTravelSession();
                model.UpdatedBy = sessionObj.AppUserId;

                model.DistributorId = id;
                distributorManagementProvider.EditDistributedManagement(model);
                model = distributorManagementProvider.GetDistributorsModel(id);
                TempData["InfoMessage"] = "Distributor Updated 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));
            }
        }
        public ActionResult Edit(DistributorManagementModel model, int id)
        {
            TravelSession sessionObj = AdminSessionStore.GetTravelSession();

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

                model.DistributorId = id;
                distributorManagementProvider.EditDistributedManagement(model);

                SaveOrUpdateDistributorSetting(id, model, sessionObj);



                TempData["InfoMessage"] = "Distributor Updated Successfully.";
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                model               = distributorManagementProvider.GetDistributorsModel(id);
                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.MasterDealIdOfAirlines = provider.GetBranchOfficeMasterDealforDistributors(id, 1) != null?provider.GetBranchOfficeMasterDealforDistributors(id, 1).BranchDealMasterId : 0;

                model.MasterDealIdOfHotel = provider.GetBranchOfficeMasterDealforDistributors(id, 2) != null?provider.GetBranchOfficeMasterDealforDistributors(id, 2).BranchDealMasterId : 0;

                model.MasterDealNameListOfAirlines = provider.GetAllBranchDistributorDealListOfAirlines(sessionObj.LoginTypeId);
                model.MasterDealNameListOfHotels   = provider.GetAllBranchDistributorDealListOfHotels(sessionObj.LoginTypeId);
                ViewData["distributorClass"]       = new SelectList(provider.GetDistributorClass(), "DistributorClassId", "DistributorClassName");
                model.DistributorClassId           = provider.GeDistributorClass(id);
                TempData["ActionResponse"]         = ex.Message;

                return(View(model));
            }
        }