private void PrepareSystemUserModel(SystemUserModel model) { var roles = m_SystemUserService.GetAllRoles(false); if (model.Id.IsNotEmpty()) { var userRoles = m_SystemUserService.GetUserRoles(model.Id, false); if (userRoles.IsNotNullOrEmpty()) { model.SelectedRoleIds = userRoles.Select(p => p.RoleId).ToArray(); } } if (roles.IsNotNullOrEmpty()) { roles.ForEach(p => model.AvailableRoles.Add(new SelectListItem { Text = p.Name, Value = p.Id.ToString(), Selected = model.SelectedRoleIds.IsNotNullOrEmpty() && model.SelectedRoleIds.Contains(p.Id) })); } var availableDesignations = m_DesignationService.GetDesignations(countryProg.Id); if (availableDesignations.IsNotNullOrEmpty()) { availableDesignations.ForEach(p => model.AvailableDesignation.Add(new SelectListItem { Text = p.Name, Value = p.Id.ToString(), Selected = model.SelectedDesignationId == p.Id })); } var availableCountrySuboffices = m_CountrySubOfficeService.GetCountrySubOffices1(countryProg.Id); if (availableCountrySuboffices.IsNotNullOrEmpty()) { availableCountrySuboffices.OrderBy(p => p.countryProgramme.ProgrammeName) .ForEach(p => model.AvailableCountrySubOffices.Add(new SelectListItem { Text = p.countrySubOffice.Name, Value = p.countrySubOffice.Id.ToString(), Selected = p.countrySubOffice.Id == model.SelectedCountrySubOfficeId })); } var financeLimits = m_budgetService.GetFinanceLimits(countryProg.Id); model.Password = ""; model.FinanceLimits = new SelectList(financeLimits, "Id", "Name"); }
// // GET: ListView public ActionResult ListView(string search = "") { List <CountrySubOfficeService.CountrySubOfficeView> ctrySubOffices = ctrySubOfficeService.GetCountrySubOffices1(countryProg.Id, search); return(View("ListView", ctrySubOffices)); }