public void GenerateList(List <Privilege> allPrivileges) { AllPrivileges = new List <CheckBoxModel>(); if (Role == null) { throw new NullReferenceException("Role must be not null to generate List for View Model"); } foreach (var priv in allPrivileges) { var roleHasPrivilege = new CheckBoxModel(); roleHasPrivilege.DisplayText = priv.PrivilegeName; roleHasPrivilege.CheckBoxNames = "privileges"; roleHasPrivilege.TableDisplayName = "Име на Привилегија"; if (priv.PrivilegeID != null) { roleHasPrivilege.ItemID = priv.PrivilegeID; } roleHasPrivilege.CheckBoxChecked = Role.RoleHasPrivilege(priv.PrivilegeName); AllPrivileges.Add(roleHasPrivilege); } }
public async Task <IActionResult> OnGetAsync(string id) { if (id == null) { return(NotFound()); } IdentityUser = await _userManager.FindByIdAsync(id); if (IdentityUser == null) { return(NotFound()); } ReadOnlyPermission = new CheckBoxModel { DisplayName = "Read Only" }; ReadOnlyPermission.IsChecked = await _userManager.IsInRoleAsync(IdentityUser, Constants.ReadOnlyRole); ReadWritePermission = new CheckBoxModel { DisplayName = "Read/Write" }; ReadWritePermission.IsChecked = await _userManager.IsInRoleAsync(IdentityUser, Constants.ReadWriteRole); return(Page()); }
public void GenerateList(List <Role> allRoles) { UserRoles = new List <CheckBoxModel>(); if (User == null) { throw new NullReferenceException("User must be not null to generate List for View Model"); } foreach (var role in allRoles) { var userHasRole = new CheckBoxModel(); userHasRole.TableDisplayName = "Име на Улога"; userHasRole.CheckBoxNames = "roles"; userHasRole.DisplayText = role.RoleName; if (role.RoleID != null) { userHasRole.ItemID = role.RoleID; } userHasRole.CheckBoxChecked = User.UserHasRole(role.RoleName); UserRoles.Add(userHasRole); } }
private void DecodeUIInit() { //rsaOpenCheckBox = new CheckBoxModel(true, false); //AdditionalBitsCheckBox = new CheckBoxModel(true,false); SmartHidingCheckBox = new CheckBoxModel(true, false); //AttributeHiding = new CheckBoxModel(true, false); }
private void UIInit() { FullPathToOrigFile = ""; CountLettersIsCanHide = 0.ToString(); CountLettersForHide = 0.ToString(); TextForHide = ""; KeyStatusColor = new SolidColorBrush(Colors.Black); KeyStatus = ""; IsTextForHideEnabled = false; IsHideInformationButtonEnabled = false; RSACheckBox = new CheckBoxModel(); VisibleColorCheckBox = new CheckBoxModel(); AdditionalBitsCheckBox = new CheckBoxModel(); RandomCheckBox = new CheckBoxModel(); SmartHidingCheckBox = new CheckBoxModel(); AttributeHidingCheckBox = new CheckBoxModel(); HashingMD5CheckBox = new CheckBoxModel(); HashingSHA512CheckBox = new CheckBoxModel(); AESCheckBox = new CheckBoxModel(); TwoFishCheckBox = new CheckBoxModel(); ShifrElGamalCheckBox = new CheckBoxModel(); }
public CheckBoxControlViewModel(CheckBoxModel checkBoxModel) { Id = checkBoxModel.Id; Label = checkBoxModel.Label; //не тру, доработать //Size = Convert.ToInt32(textBoxModel.Size); //BindedData = ""; }
private void LbSidebar_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.RemovedItems.Count != 0 || e.AddedItems.Count == 0) { return; } CheckBoxModel t = (CheckBoxModel)e.AddedItems[0]; if (t.Enabled) { t.Checked = !t.Checked; } LbDir.SelectedIndex = -1; }
private void DecodeUIInit() { rsaOpenCheckBox = new CheckBoxModel(true, false); AdditionalBitsCheckBox = new CheckBoxModel(true, false); SmartHidingCheckBox = new CheckBoxModel(true, false); // ShifrElGamalCheckBox = new CheckBoxModel(true, false); HashingSHA512 = new CheckBoxModel(true, false); HashingMD5 = new CheckBoxModel(true, false); AesOpenCheckBox = new CheckBoxModel(true, false); TwoFishCheckBox = new CheckBoxModel(true, false); }
public CheckBoxModel GetMasterData(BaseViewModel model) { CheckBoxModel DataModel; IUnitOfWork uwork = new UnitOfWork(); IEstimationSpecializedFieldService SpecializedService = new EstimationSpecializedFieldService(new EstimationSpecializedFieldRepository(uwork)); ICurrentStateService CurrentStateService = new CurrentStateService(new CurrentStateRepository(uwork)); IMasterStaffSoftwareSkillService SoftwareService = new MasterStaffSoftwareSkillService(new MasterStaffSoftwareSkillRepository(uwork)); DataModel = new CheckBoxModel(); DataModel.SpecializedFieldList = SpecializedService.GetAllEstimationSpecializedFieldList(model); DataModel.CurrentStateList = CurrentStateService.GetAllCurrentStateList(model); DataModel.SoftwareSkillList = SoftwareService.GetStaffSoftwareSkill(model); return(DataModel); }
// // GET: /Acciones/ public ActionResult Index(string sortOrder, string sortType, FormCollection formData) { ViewData["NoDataFound"] = "No tiene acciones pendientes."; ViewData["Title"] = "Acciones Pendientes"; //Cargo los datos de delegaciones y responsables. var delegaciones = db.aspnet_Delegaciones.Select(d => new { d.DelegacionID, d.Descripcion }); ViewData["Delegaciones"] = delegaciones.AsEnumerable().OrderBy(d => d.Descripcion).ToDictionary(d => d.DelegacionID, d => d.Descripcion); IEnumerable <aspnet_Users> usuarios; if (User.IsInRole("Administrador")) { usuarios = from u in db.aspnet_Users select u; } else { usuarios = from u in db.aspnet_Users from r in u.aspnet_Roles.DefaultIfEmpty() where r.RoleName != "Administrador" || r.RoleName == null select u; } ViewData["Responsables"] = usuarios.AsEnumerable().OrderBy(u => u.UserName).Where(u => (ProfileBase.Create(u.UserName))["AplicacionesGM"].ToString().Split(',').Contains("1")).Distinct().ToDictionary(u => u.UserId, u => u.UserName); //Cargo las acciones IEnumerable <aspnet_Acciones> Accion = getAcciones(sortOrder, sortType, ViewData["Title"].ToString(), formData); //Cargo los datos para los Checks del buscador var origenes = db.aspnet_Origenes.Select(o => new { o.OrigenID, o.Descripcion }); var departamentos = db.aspnet_Departamentos.Select(d => new { d.DepartamentoID, d.Descripcion }); CheckBoxModel chkOrigenes = new CheckBoxModel(origenes.AsEnumerable().OrderBy(o => o.Descripcion).ToDictionary(o => o.OrigenID.ToString(), o => o.Descripcion), new List <string>()); ViewData["chkOrigenes"] = chkOrigenes; CheckBoxModel chkDepartamentos = new CheckBoxModel(departamentos.AsEnumerable().OrderBy(d => d.Descripcion).ToDictionary(d => d.DepartamentoID.ToString(), d => d.Descripcion), new List <string>()); ViewData["chkDepartamentos"] = chkDepartamentos; CheckBoxModel chkDelegaciones = new CheckBoxModel(delegaciones.AsEnumerable().OrderBy(d => d.Descripcion).ToDictionary(d => d.DelegacionID.ToString(), d => d.Descripcion), new List <string>()); ViewData["chkDelegaciones"] = chkDelegaciones; CheckBoxModel chkResponsables = new CheckBoxModel(usuarios.AsEnumerable().OrderBy(u => u.UserName).Where(u => (ProfileBase.Create(u.UserName))["AplicacionesGM"].ToString().Split(',').Contains("1")).Distinct().ToDictionary(u => u.UserId.ToString(), u => u.UserName), new List <string>()); ViewData["chkResponsables"] = chkResponsables; return(View(Accion)); }
public static string CreateCheckBoxModel(CheckBoxModel model, int level = 0) { string buffer = string.Empty; buffer += CreateXMLElement(nameof(XMLElements.StartBlock), level: level); buffer += CreateXMLElement(nameof(XMLElements.CreateType), nameof(XMLElements.CheckBox)); buffer += CreateXMLElement("Id", model.ID); buffer += CreateXMLElement("Name", model.Name, false); buffer += CreateXMLElement("TextTrue", model.TextTrue); buffer += CreateXMLElement("TextFalse", model.TextFalse); buffer += CreateXMLElement("IsEnabled", model.IsEnabled); buffer += CreateXMLElement("IsVisible", model.IsVisible); buffer += CreateXMLElement("IsLabelVisible", model.IsLabelVisible); buffer += CreateXMLElement("MinWidth", model.MinWidth, !model.MinWidth.Equals(0)); buffer += CreateXMLElement(nameof(XMLElements.EndBlock)); return(buffer); }
public void WhenCheckBoxInvoked_ThenViewModelIsUpdated(string key, string value) { var values = new Dictionary <string, string>() { { key, value } }; var component = new Checkbox(); component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext(); ViewViewComponentResult result = component.Invoke(values) as ViewViewComponentResult; CheckBoxModel resultModel = (CheckBoxModel)result.ViewData.Model; //Assert Assert.AreEqual(value, ViewComponentTestHelper.GetPropertyValue(resultModel, key)); }
public DataContextSpisok() { SelectFileControl = new SelectFile(); SelectListControl = new SelectList(); ShemeDocument = new ShemeMethod(TestUserControl); XmlFile = new ListViewModelXmlFileGenerateMethod(ConfigFile.FileSpisok); TextBoxFileModel = new TextBoxModelMethod(); ModelSnuOne = new ModelSnuOneFormNameListMethod(); CheckBoxModel = new CheckBoxModel(); CommandFormirovanie command = new CommandFormirovanie(); Transfer = new DelegateCommand(() => { XmlFile.MoveFile(ConfigFile.PathInn); }); SelectFile = new DelegateCommand(delegate { command.SelectFileSlsx(TextBoxFileModel, ModelSnuOne); }); FormirovanieXml = new DelegateCommand((delegate { command.FormirovanieXml(ModelSnuOne, TextBoxFileModel, ShemeDocument, CheckBoxModel, ConfigFile.FileSpisok, XmlFile); })); }
// // GET: /Acciones/Edit/5 public ActionResult Edit(int id) { aspnet_Acciones modified = db.aspnet_Acciones.FirstOrDefault(a => a.AccionesID == id); var dptos = db.aspnet_Departamentos.Select(d => new { d.DepartamentoID, d.Descripcion }); SelectList list = new SelectList(dptos.AsEnumerable(), "DepartamentoID", "Descripcion", modified.DepartamentoID); ViewData["DepartamentoID"] = list; var origenes = db.aspnet_Origenes.Select(o => new { o.OrigenID, o.Descripcion }); list = new SelectList(origenes.AsEnumerable(), "OrigenID", "Descripcion", modified.OrigenID); ViewData["OrigenID"] = list; var delegaciones = db.aspnet_Delegaciones.Select(d => new { d.DelegacionID, d.Descripcion }); CheckBoxModel chkDelegaciones = new CheckBoxModel(delegaciones.AsEnumerable().OrderBy(d => d.Descripcion).ToDictionary(d => d.DelegacionID.ToString(), d => d.Descripcion), new List <string>()); ViewData["chkDelegaciones"] = chkDelegaciones; IEnumerable <aspnet_Users> usuarios; if (User.IsInRole("Administrador")) { usuarios = from u in db.aspnet_Users select u; } else { usuarios = from u in db.aspnet_Users from r in u.aspnet_Roles.DefaultIfEmpty() where r.RoleName != "Administrador" || r.RoleName == null select u; } CheckBoxModel chkResponsables = new CheckBoxModel(usuarios.AsEnumerable().Where(u => (ProfileBase.Create(u.UserName))["AplicacionesGM"].ToString().Split(',').Contains("1")).Distinct().OrderBy(u => u.UserName).ToDictionary(u => u.UserId.ToString(), u => u.UserName), new List <string>()); ViewData["chkResponsables"] = chkResponsables; return(View(modified)); }
public ActionResult ChooseRooms(int bookingId) { List <Room> rooms = db.Rooms.ToList(); var AvailableRooms = new List <CheckBoxModel>(); Booking booking = dbBooking.Bookings.Find(bookingId); foreach (var room in rooms) { var roomBookings = from t in dbRoomBooking.RoomBookings select t; roomBookings = roomBookings.Where(rb => rb.RoomId == room.RoomId); // in roomBookings extragen rezervarile facute pentru camera curenta bool ok = true; foreach (var roombooking in roomBookings)//pentru fiecare rezervare verificam daca intervalul se suprapune cu cel curet { var bookings = from t in dbBooking.Bookings select t; bookings = bookings.Where(b => b.BookingId == roombooking.BookingId); //extragem datele pentru rezervarile camerei respective bookings = bookings.Where(b => (b.CheckIn.CompareTo(booking.CheckIn) >= 0 && b.CheckIn.CompareTo(booking.CheckOut) <= 0) || (b.CheckOut.CompareTo(booking.CheckIn) > 0 && b.CheckOut.CompareTo(booking.CheckOut) < 0) || (b.CheckIn.CompareTo(booking.CheckIn) <= 0 && b.CheckOut.CompareTo(booking.CheckOut) >= 0) ); //verificam daca sunt rezervari ce se suprapun if (bookings.Count() > 0) //exista rezervari ce se suprapun { ok = false; } } if (ok)// nu avem rezervari ce se suprapun { string name = room.RoomNumber.ToString() + " " + room.Type + " " + room.Rate.ToString() + " $"; CheckBoxModel checkBox = new CheckBoxModel { BookingId = booking.BookingId, Id = room.RoomId, Name = name, Checked = false }; AvailableRooms.Add(checkBox); } } return(View(AvailableRooms)); }
public static List <object> GetObjects(string configFileName) { var controls = new List <object>(); //@"..\..\Resources\YamlConfig.yaml" StreamReader sr = new StreamReader(configFileName); string text = sr.ReadToEnd(); var input = new StringReader(text); // Load the stream var yaml = new YamlStream(); yaml.Load(input); // Examine the stream var mapping = (YamlMappingNode)yaml.Documents[0].RootNode; var items = (YamlSequenceNode)mapping.Children[new YamlScalarNode("form-elements")]; foreach (YamlMappingNode item in items) { var type = item.Children[new YamlScalarNode("type")]; switch (type.ToString()) { case "textbox": { var textboxItem = new TextBoxModel() { Id = item.Children[new YamlScalarNode("id")].ToString(), Caption = item.Children[new YamlScalarNode("caption")].ToString(), Size = item.Children[new YamlScalarNode("size")].ToString() }; controls.Add(textboxItem); break; } case "checkbox": { var checkboxItem = new CheckBoxModel() { Id = item.Children[new YamlScalarNode("id")].ToString(), Label = item.Children[new YamlScalarNode("label")].ToString(), Size = item.Children[new YamlScalarNode("size")].ToString() }; controls.Add(checkboxItem); break; } case "radiobuttons": { var optionListItems = (YamlSequenceNode)item.Children[new YamlScalarNode("optionList")]; var list = new List <string>(); foreach (YamlScalarNode x in optionListItems) { list.Add(x.ToString()); } var radiobuttonsItem = new RadioButtonGroupModel() { Id = item.Children[new YamlScalarNode("id")].ToString(), Label = item.Children[new YamlScalarNode("label")].ToString(), Orientation = item.Children[new YamlScalarNode("orientation")].ToString(), OptionList = list }; controls.Add(radiobuttonsItem); break; } } } return(controls); }
/// <summary> /// Формирование списков xml по схеме!!! /// </summary> /// <param name="modelsnuone">Выбор модели Сериализации файла</param> /// <param name="textboxfilemodel">Модель файла</param> /// <param name="shemedocument">Модель схем</param> /// <param name="checkBoxModel">Модель заголовка</param> /// <param name="path">Путь сохранение xml</param> /// <param name="xmlmodel">ListView для отражения xml</param> public void FormirovanieXml(ModelSnuOneFormNameListProperty modelsnuone, TextBoxModelMethod textboxfilemodel, ShemeMethod shemedocument, CheckBoxModel checkBoxModel, string path, ListViewModelXmlFileGenerateMethod xmlmodel) { XmlConvert convert = new XmlConvert(); if (shemedocument.IsValidation()) { switch (shemedocument.Shema.Shemes) { case "SnuOneForm": if (textboxfilemodel.IsValidation() && modelsnuone.IsValidation()) { xmlmodel.UpdateOn(); Task.Run((delegate { try { convert.ConvertListSnuOneForm(textboxfilemodel.Path, modelsnuone.SelectList.Listletter, modelsnuone.SelectColumnLetter.ColumnName, checkBoxModel.IsCheced, string.Join(null, path, "Inn.xml")); xmlmodel.AddXmlFile(path); xmlmodel.UpdateOff(); } catch (Exception e) { MessageBox.Show(e.Message); } })); } break; case "TreatmentFpd": if (textboxfilemodel.IsValidation() && modelsnuone.IsValidation() && checkBoxModel.IsValidation()) { xmlmodel.UpdateOn(); Task.Run((delegate { try { convert.ConvertListFpdReg(textboxfilemodel.Path, modelsnuone.SelectList.Listletter, modelsnuone.SelectColumnLetter.ColumnName, checkBoxModel.SelectIntRow, string.Join(null, path, "Fpd.xml")); xmlmodel.AddXmlFile(path); xmlmodel.UpdateOff(); } catch (Exception e) { MessageBox.Show(e.Message); } })); } break; case "FullInnCount": if (textboxfilemodel.IsValidation() && modelsnuone.IsValidation() && checkBoxModel.IsValidation()) { xmlmodel.UpdateOn(); Task.Run((delegate { try { convert.ConvertInnMassList(textboxfilemodel.Path, modelsnuone.SelectList.Listletter, modelsnuone.SelectColumnLetter.ColumnName, checkBoxModel.SelectIntRow, checkBoxModel.Colelementcollection, string.Join(null, path, "InnFull.xml")); xmlmodel.AddXmlFile(path); xmlmodel.UpdateOff(); } catch (Exception e) { MessageBox.Show(e.Message); } })); } break; case "FidZorI": if (textboxfilemodel.IsValidation() && modelsnuone.IsValidation()) { xmlmodel.UpdateOn(); Task.Run((delegate { try { convert.SerializFidZorI(textboxfilemodel.Path, modelsnuone.SelectList.Listletter, modelsnuone.SelectColumnLetter.ColumnName, checkBoxModel.IsCheced, string.Join(null, path, "Fid.xml")); xmlmodel.AddXmlFile(path); xmlmodel.UpdateOff(); } catch (Exception e) { MessageBox.Show(e.Message); } })); } break; case "FidFace": if (textboxfilemodel.IsValidation() && modelsnuone.IsValidation()) { xmlmodel.UpdateOn(); Task.Run(delegate { try { convert.ConvertFidFace(textboxfilemodel.Path, modelsnuone.SelectList.Listletter, modelsnuone.SelectColumnLetter.ColumnName, checkBoxModel.IsCheced, string.Join(null, path, "FidFace.xml")); xmlmodel.AddXmlFile(path); xmlmodel.UpdateOff(); } catch (Exception e) { MessageBox.Show(e.Message); } }); } break; case "IdZaprosVisual": if (textboxfilemodel.IsValidation() && modelsnuone.IsValidation()) { xmlmodel.UpdateOn(); Task.Run(delegate { try { convert.ConvertIdVisual(textboxfilemodel.Path, modelsnuone.SelectList.Listletter, modelsnuone.SelectColumnLetter.ColumnName, checkBoxModel.IsCheced, string.Join(null, path, "IdZaprosVisual.xml")); xmlmodel.AddXmlFile(path); xmlmodel.UpdateOff(); } catch (Exception e) { MessageBox.Show(e.Message); } }); } break; } } }
public IActionResult CheckBox(CheckBoxModel model) { return(View(model)); }
private void DecodeUIInit() { AdditionalBitsCheckBox = new CheckBoxModel(true, false); }
public async Task <ActionResult> Delete(string Id) { ViewBag.Colors = from o in data.ProductColors select new { Id = o.Id, Name = o.ProductColorName }; var _product = await data.Products.FindAsync(Id); List <CheckBoxModel> cbCategoriesList = new List <CheckBoxModel>(); List <CheckBoxModel> cbGenderList = new List <CheckBoxModel>(); foreach (var x in data.ProductCategories) { var IsSelected = false; if (_product.ProductCategories.Where(i => i.Id == x.Id).Count() == 1) { IsSelected = true; } else { IsSelected = false; } CheckBoxModel cb = new Models.CheckBoxModel() { Id = x.Id.ToString(), IsSelected = IsSelected, Label = x.CategoryName }; cbCategoriesList.Add(cb); } foreach (var x in common.GetGenders()) { var IsSelected = false; if (_product.ProductsInGenders.Where(i => i.Gender == x).Count() == 1) { IsSelected = true; } else { IsSelected = false; } CheckBoxModel cb = new CheckBoxModel() { Id = x, IsSelected = IsSelected, Label = x }; cbGenderList.Add(cb); } var _tmpImages = from o in _product.ProductDetails select o.ProductDetailImages; List <NewIMageModel> _images = new List <NewIMageModel>(); foreach (var x in _tmpImages) { foreach (var y in x) { NewIMageModel _imgModel = new NewIMageModel() { Id = y.Id, Url = y.ImageUrl }; _images.Add(_imgModel); } } NewProductModel model = new NewProductModel() { Id = _product.Id, Amount = _product.Amount, Description = _product.Description, Name = _product.ProductName, ColordId = _product.ProductDetails.Select(i => i.ProductColor.Id).First(), MeasurementId = _product.ProductDetails.Select(i => i.ProductMeasurement.Id).First(), Categories = cbCategoriesList, Genders = cbGenderList, Images = _images }; string[] catArray = cbCategoriesList.Where(i => i.IsSelected).Select(i => i.Id).ToArray(); ViewBag.Measurements = await(from p in data.ProductMeasurements. Where(a => catArray.Contains(a.ProductCategoryId.ToString())) select new { Id = p.Id, Name = p.MeasurementName, Value = p.MeasurementValue, }).ToListAsync(); ViewBag.Brands = from o in data.ProductBrands select new { Id = o.Id, Name = o.Name }; ViewBag.Colors = from o in data.ProductColors select new { Id = o.Id, Color = o.ProductColorName }; return(View(model)); }
private void PopulateFormModelData(EstandarFormModel formModel, Estandar estandar) { if (estandar != null) { formModel.Id = estandar.Id; formModel.Codigo = estandar.Codigo; formModel.Descripcion = estandar.Descripcion; formModel.NotasEspeciales = estandar.NotasEspeciales; formModel.Nombre = estandar.Nombre; formModel.GrupoEstandar = estandar.GrupoEstandar.Id; formModel.TipoEstandar = estandar.TipoEstandar; formModel.Categoria = estandar.Categoria.Id; formModel.Nivel = estandar.Nivel.Id; formModel.Estado = estandar.Estado.Id; formModel.Clasificacion = estandar.Clasificacion.Id; } var grupoItems = new List <SelectListItem>(); var grupoTypes = _estandarService.GetGruposList(); foreach (var grupoEstandar in grupoTypes) { var selectItem = new SelectListItem { Text = grupoEstandar.Nombre, Value = grupoEstandar.Id.ToString() }; if (grupoEstandar.Id == formModel.GrupoEstandar) { selectItem.Selected = true; } grupoItems.Add(selectItem); } formModel.GrupoEstandares = grupoItems; var tipoItems = Enum.GetValues(typeof(TipoEstandar)).Cast <int>() .Select(e => new SelectListItem() { Text = Enum.GetName(typeof(TipoEstandar), e), Value = e.ToString() }).ToList(); foreach (var selectListItem in tipoItems) { if (selectListItem.Value == formModel.TipoEstandar.ToString()) { selectListItem.Selected = true; } } formModel.TipoEstandares = tipoItems; var estadoItems = new List <SelectListItem>(); var estadoTypes = _statusService.GetItems(GrupoStatus.Global); foreach (var estadoType in estadoTypes) { var selectItem = new SelectListItem { Text = estadoType.Nombre, Value = estadoType.Id.ToString() }; if (estadoType.Id == formModel.Estado) { selectItem.Selected = true; } estadoItems.Add(selectItem); } formModel.Estados = estadoItems; var nivelItems = new List <SelectListItem>(); var nivelTypes = _estandarService.GetNivelList(); foreach (var nivel in nivelTypes) { var selectItem = new SelectListItem { Text = nivel.Nombre, Value = nivel.Id.ToString() }; if (nivel.Id == formModel.Nivel) { selectItem.Selected = true; } nivelItems.Add(selectItem); } formModel.Niveles = nivelItems; var categoriaItems = new List <SelectListItem>(); var categoriaTypes = _estandarService.GetCategoriaList(); foreach (var categoria in categoriaTypes) { var selectItem = new SelectListItem { Text = categoria.Nombre, Value = categoria.Id.ToString() }; if (categoria.Id == formModel.Categoria) { selectItem.Selected = true; } categoriaItems.Add(selectItem); } formModel.Categorias = categoriaItems; var clasificacionesItems = new List <SelectListItem>(); var clasificacionesTypes = _estandarService.GetClasificacionList(); foreach (var clasificacion in clasificacionesTypes) { var selectItem = new SelectListItem { Text = clasificacion.Nombre, Value = clasificacion.Id.ToString() }; if (clasificacion.Id == formModel.Clasificacion) { selectItem.Selected = true; } clasificacionesItems.Add(selectItem); } formModel.Clasificaciones = clasificacionesItems; var sistemas = _estandarService.GetSistemaList(); var checkItems = new List <CheckBoxModel>(); foreach (var sistema in sistemas) { var checkItem = new CheckBoxModel { Value = sistema.Id, Text = sistema.Nombre }; if (estandar != null) { checkItem.IsChecked = estandar.Sistemas.Contains(sistema); } checkItems.Add(checkItem); } formModel.Sistemas = new CheckBoxList { CheckBoxItems = checkItems }; var tipoLocales = _localService.GetTiposList(); var checkLocalItems = new List <CheckBoxModel>(); foreach (var tipoLocal in tipoLocales) { var checkItem = new CheckBoxModel { Value = tipoLocal.Id, Text = tipoLocal.Detalle }; if (estandar != null) { checkItem.IsChecked = estandar.TipoLocales.Contains(tipoLocal); } checkLocalItems.Add(checkItem); } formModel.TipoLocales = new CheckBoxList { CheckBoxItems = checkLocalItems }; }