public JsonResult CheckDuplicateMobileNumber(string MobileNumber) { bool flag; flag = _agentProvider.CheckDuplicateMobileNumber(MobileNumber); JsonResult res = new JsonResult { Data = flag }; return(res); }
public ActionResult Create(AgentModel model, List <AgentBankModel> AgentBankModel, int[] ChkSettingId, int[] ChkProductId, FormCollection fc) { TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"]; model.BranchOfficeId = 1; model.DistributorId = 1; model.CreatedbyUser = obj.AppUserId; model.CreatedBy = LogedUserId; model.CreatedDate = CurrentDate; model.AgentStatusid = 1; model.EmailId = model.EmailId.Trim(';'); if (!_rep.CheckDuplicateEmail(model.Email)) { TempData["ErrorMessage"] = "Registration failed! Email already exists, please re-enter and try again"; AgentModel viewmodel = new AgentModel { ProductBaseRoleList = _rep.GetProductList(), ReferredByList = _rep.GetAllGetSalesAgentList(), MEsNameList = _rep.GetAllGetSalesAgentList(), }; ViewData["Countrylist"] = new SelectList(_rep.GetCountry(), "CountryId", "CountryName", 0); ViewData["Status"] = new SelectList(_rep.GetStatus(), "id", "Name", 1); ViewData["AirlineGroup"] = new SelectList(_rep.GetAirlineGroup(), "AirlineGroupId", "AirlineGroupName"); ViewData["RoleAssign"] = new SelectList("", "RoleName", "RoleName", ""); ViewData["AgentTypes"] = new SelectList(_rep.GetAgentType(), "AgentTypeId", "AgentTypeName"); ViewData["AgentZone"] = new SelectList(_rep.GetZoneList(), "ZoneId", "ZoneName"); ViewData["AgentDistrict"] = new SelectList(_rep.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName"); ViewData["Banks"] = new SelectList(_rep.GetbankInformation(), "BankId", "BankName"); ViewData["BankBranches"] = new SelectList(_rep.GetbankBranchInformation(), "BankBranchId", "BranchName"); ViewData["BankAccountTypes"] = new SelectList(_rep.GetbankAccountType(), "BankAccountTypeId", "AccountTypeName"); ViewData["TimeZones"] = new SelectList(_rep.GetTimeZoneList(), "RecordID", "StandardName", 66); return(View("Create", viewmodel)); } else { if (!string.IsNullOrEmpty(model.MobileNo) && !_rep.CheckDuplicateMobileNumber(model.MobileNo)) { TempData["ErrorMessage"] = "Registration failed! Mobile Number already exists, please re-enter and try again"; AgentModel viewmodel = new AgentModel { ProductBaseRoleList = _rep.GetProductList(), ReferredByList = _rep.GetAllGetSalesAgentList(), }; ViewData["Countrylist"] = new SelectList(_rep.GetCountry(), "CountryId", "CountryName", 0); ViewData["Status"] = new SelectList(_rep.GetStatus(), "id", "Name", 1); ViewData["AirlineGroup"] = new SelectList(_rep.GetAirlineGroup(), "AirlineGroupId", "AirlineGroupName"); ViewData["RoleAssign"] = new SelectList("", "RoleName", "RoleName", ""); ViewData["AgentTypes"] = new SelectList(_rep.GetAgentType(), "AgentTypeId", "AgentTypeName"); ViewData["AgentZone"] = new SelectList(_rep.GetZoneList(), "ZoneId", "ZoneName"); ViewData["AgentDistrict"] = new SelectList(_rep.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName"); ViewData["Banks"] = new SelectList(_rep.GetbankInformation(), "BankId", "BankName"); ViewData["BankBranches"] = new SelectList(_rep.GetbankBranchInformation(), "BankBranchId", "BranchName"); ViewData["BankAccountTypes"] = new SelectList(_rep.GetbankAccountType(), "BankAccountTypeId", "AccountTypeName"); ViewData["TimeZones"] = new SelectList(_rep.GetTimeZoneList(), "RecordID", "StandardName", 66); return(View("Create", viewmodel)); } else { _res = _rep.Create(model, AgentBankModel, ChkProductId, fc); TempData["InfoMessage"] = _res.ActionMessage; if (_res.ErrNumber == 0) { return(RedirectToAction("Index")); } else { AgentModel viewmodel = new AgentModel { ProductBaseRoleList = _rep.GetProductList(), ReferredByList = _rep.GetAllGetSalesAgentList(), MEsNameList = _rep.GetAllGetSalesAgentList(), }; TempData["ErrorMessage"] = "Registration failed! Either Enter Username or Your passwords must match, please re-enter and try again"; ViewData["Countrylist"] = new SelectList(_rep.GetCountry(), "CountryId", "CountryName", 0); ViewData["Status"] = new SelectList(_rep.GetStatus(), "id", "Name", 1); ViewData["AirlineGroup"] = new SelectList(_rep.GetAirlineGroup(), "AirlineGroupId", "AirlineGroupName"); ViewData["RoleAssign"] = new SelectList("", "RoleName", "RoleName", ""); ViewData["AgentTypes"] = new SelectList(_rep.GetAgentType(), "AgentTypeId", "AgentTypeName"); ViewData["AgentZone"] = new SelectList(_rep.GetZoneList(), "ZoneId", "ZoneName"); ViewData["AgentDistrict"] = new SelectList(_rep.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName"); ViewData["Banks"] = new SelectList(_rep.GetbankInformation(), "BankId", "BankName"); ViewData["BankBranches"] = new SelectList(_rep.GetbankBranchInformation(), "BankBranchId", "BranchName"); ViewData["BankAccountTypes"] = new SelectList(_rep.GetbankAccountType(), "BankAccountTypeId", "AccountTypeName"); ViewData["TimeZones"] = new SelectList(_rep.GetTimeZoneList(), "RecordID", "StandardName", 66); return(View("Create", viewmodel)); } } } }
public ActionResult Create(BranchOfficeManagementModel model, FormCollection fc) { TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"]; model.CreatedBy = obj.AppUserId; model.Email = model.Email.Trim(';'); model.NativeCountryList = new SelectList(_repAgManagement.GetCountry(), "CountryId", "CountryName", 0); model.StatusList = new SelectList(_repAgManagement.GetStatus(), "id", "Name", 1); model.ZoneList = new SelectList(_repAgManagement.GetZoneList(), "ZoneId", "ZoneName"); model.DistrictList = new SelectList(_repAgManagement.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName"); model.TimeZoneList = new SelectList(_repAgManagement.GetTimeZoneList(), "RecordID", "StandardName", 66); try { if (!ser.CheckDuplicateBranchName(model.BranchOffice)) { TempData["ErrorMessage"] = "Registration failed! Branch Name already exists, please re-enter and try again"; return(View("Create", model)); } if (!ser.CheckDuplicateEmail(model.Email)) { TempData["ErrorMessage"] = "Registration failed! Email already exists, please re-enter and try again"; return(View("Create", model)); } if (model.Password != model.ConfirmPassword) { TempData["ErrorMessage"] = "Password and Confirm Password doesnot match, please re-enter and try again"; return(View("Create", model)); } else { if (!string.IsNullOrEmpty(model.MobileNo) && !_repAgManagement.CheckDuplicateMobileNumber(model.MobileNo)) { TempData["ErrorMessage"] = "Registration failed! Mobile Number already exists, please re-enter and try again"; return(View("Create", model)); } else { int branchofficeid = ser.Create(model); model.MasterDealNameListOfAirlines = provider.GetBranchAllDealListOfAirlines(); model.MasterDealNameListOfHotels = provider.GetAllDealListOfHotel(); model.MasterDealNameListOfBus = provider.GetAllDealListOfBus(); model.MasterDealNameListOfMobile = provider.GetAllDealListOfMobile(); ViewData["branchClass"] = new SelectList(provider.GetBranchClass(), "BranchClassId", "BranchClassName"); model.BranchClassId = provider.GeBranchClass(obj.LoginTypeId); SaveOrUpdateBranchSetting(branchofficeid, model, obj); TempData["SuccessMessage"] = "Branch office created successfully ."; return(RedirectToAction("Index")); } } } catch (Exception ex) { TempData["ActionResponse"] = ex.Message; model.NativeCountryList = new SelectList(_repAgManagement.GetCountry(), "CountryId", "CountryName", 0); model.StatusList = new SelectList(_repAgManagement.GetStatus(), "id", "Name", 1); model.ZoneList = new SelectList(_repAgManagement.GetZoneList(), "ZoneId", "ZoneName"); model.DistrictList = new SelectList(_repAgManagement.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName"); model.TimeZoneList = new SelectList(_repAgManagement.GetTimeZoneList(), "RecordID", "StandardName", 66); return(View("Create", model)); } }