public ActionResult Index() { ViewBag.Groups = new List <string>(); var user = (WindowsPrincipal)User; LARCA2.Business.Services.UsuariosBLL repositorioUsuarios = new LARCA2.Business.Services.UsuariosBLL(); LARCA2.Business.Services.RolesBLL repositorioRoles = new LARCA2.Business.Services.RolesBLL(); LARCA20_Users usuario = repositorioUsuarios.TraerPorNombreDeUsuario(user.Identity.Name.Split(Convert.ToChar("\\"))[1]); //var list = GetAllGroupNames(); //ViewBag.Groups = list; if (usuario == null) { return(RedirectToAction("InvalidUser", "Home")); } /* var lista = new List<string>(); * string manager = ""; * string username = user.Identity.Name.Split(Convert.ToChar("\\"))[1]; * using (var forest = Forest.GetCurrentForest()) * { * foreach (Domain domain in forest.Domains) * { * var userdomain = domain.Name.Split(Convert.ToChar("."))[0].ToUpper(); * * List<string> gruposEncontrados = new List<string>(); * // Creamos un objeto DirectoryEntry para conectarnos al directorio activo * DirectoryEntry adsRoot = new DirectoryEntry("LDAP://" + userdomain); * // Creamos un objeto DirectorySearcher para hacer una búsqueda en el directorio activo * DirectorySearcher adsSearch = new DirectorySearcher(adsRoot); * adsSearch.PropertiesToLoad.Add("manager"); * * // Ponemos como filtro que busque el usuario actual * adsSearch.Filter = "samAccountName=" + username; * * SearchResult oResult; * // Extraemos la primera coincidencia * oResult = adsSearch.FindOne(); * manager = oResult.Properties["manager"][0].ToString(); * if (oResult != null) * { * break; * } * } * }*/ Session["Usuario"] = usuario; ViewData["Modal"] = "<script language='javascript' type='text/javascript'>$('#modalTest').modal('show')</script>"; //ViewData["Modal"] = "<script language='javascript' type='text/javascript'>alert('" + manager + "');</script>"; ViewBag.Message = "QA Version."; return(View()); }
public SMOScopeViewModel() { bu = "0"; smo = "0"; mesSeleccionado = "0"; RCBLL = new LARCA2.Business.Services.RCClassificationBLL(); MBLL = new LARCA2.Business.Services.MasterDataBLL(); Level4BLL = new LARCA2.Business.Services.Level4BLL(); LARCA2.Business.Services.Level4BLL L4BLL = new LARCA2.Business.Services.Level4BLL(); ResponsiblesBLL = new LARCA2.Business.Services.ResponsablesBLL(); BUList = new List <SelectListItem>(); SMOList = new List <SelectListItem>(); L4List = new List <SelectListItem>(); dropdownMeses = new List <SelectListItem>(); dropdownMeses.Add(new SelectListItem { Text = "Current Month", Value = "0", Selected = true }); BUList.Add(new SelectListItem { Text = "Choose a valid BU", Value = "0", Selected = true }); SMOList.Add(new SelectListItem { Text = "Choose a valid SMO", Value = "0", Selected = true }); foreach (LARCA2.Data.DatabaseModels.LARCA20_MasterData md in MBLL.Todos().Where(x => x.Data == "BU")) { BUList.Add(new SelectListItem { Text = md.DataFin, Value = md.id.ToString() }); } foreach (LARCA2.Data.DatabaseModels.LARCA20_MasterData md in MBLL.Todos().Where(x => x.Data == "SMO")) { SMOList.Add(new SelectListItem { Text = md.DataFin, Value = md.id.ToString() }); } L4List.Add(new SelectListItem { Text = "Other", Value = "0" }); foreach (LARCA2.Data.DatabaseModels.LARCA20_Level4 md in L4BLL.Todos()) { L4List.Add(new SelectListItem { Text = md.name, Value = md.Id.ToString() }); } // LARCA2.Business.Services.SMOScopeBLL repo = new LARCA2.Business.Services.SMOScopeBLL(); LARCA2.Business.Services.UsuariosBLL repoUsuarios = new LARCA2.Business.Services.UsuariosBLL(); LARCA2.Business.Services.ResponsablesBLL repoResponsables = new LARCA2.Business.Services.ResponsablesBLL(); Level4BLL.Todos(); // this.RegistrosSMO = repo.Todos(); // this.EditablesSMO = this.RegistrosSMO; this.Responsables = new List <SelectListItem>(); List <LARCA2.Data.DatabaseModels.LARCA20_Users> listaDeUsuarios = repoUsuarios.Todos(); this.Responsables.Add(new SelectListItem { Text = "Choose a valid Owner:", Value = "0" }); foreach (LARCA2.Data.DatabaseModels.LARCA20_Responsable user in repoResponsables.Todos()) { this.Responsables.Add(new SelectListItem { Text = listaDeUsuarios.Where(u => u.Id == user.RefIdUser).FirstOrDefault().user_name, Value = user.Id.ToString() }); } }
public UserSearchForm() { UsuariosBLL = new LARCA2.Business.Services.UsuariosBLL(); }