public void TestBorrarView() { var controller = new PerfilController(); var result = controller.Borrar() as ViewResult; Assert.AreEqual("Borrar", result.ViewName); }
protected void Page_Load(object sender, EventArgs e) { if (Session["lgn_id"] == null) { Session.Clear(); String lsScript = "parent.document.location.href = '../../default.aspx?acc=SES';"; Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", lsScript, true); } else { Session["lstPerfiles"] = PerfilController.GetAll(new PerfilBean { FlgHabilitado = "T" }); if (!IsPostBack) { string json = new System.IO.StreamReader(Request.InputStream).ReadToEnd(); Dictionary <string, string> dataJSON = JsonConvert.DeserializeObject <Dictionary <string, string> >(json); if (dataJSON != null) { String Codigo = dataJSON["CodCliente"].ToString(); CargaCombos(Codigo); String codInstalacion = dataJSON["codInstalacion"].ToString(); if (!String.IsNullOrEmpty(codInstalacion)) { MddlIdInstalacion.SelectedValue = codInstalacion.Trim(); MddlIdInstalacion.Attributes.Add("disabled", "disabled"); } } } } }
void Awake() { base.Awake(); perfilController = GetComponent <PerfilController>(); playController = GetComponent <PlayController>(); sesionController = GetComponent <SesionController>(); }
public void TestObtenerPerfilBorrarRedirect() { // Instancio el form con la llave NombrePerfil para que tenga un null. NameValueCollection form = new NameValueCollection(); form["NombrePerfil"] = "Prueba no null"; var controllercontext = new Mock <ControllerContext>(); controllercontext.Setup(frm => frm.HttpContext.Request.Form).Returns(form); PerfilController controller = new PerfilController(); controller.ControllerContext = controllercontext.Object; // Act var result = (RedirectToRouteResult)controller.ObtenerPerfilBorrar(); // Assert Assert.IsNotNull(result); // Hay que iterar hasta la segunda posicion para obtener el nombre del action. var redirectToActionName = result.RouteValues.Values.GetEnumerator(); redirectToActionName.MoveNext(); redirectToActionName.MoveNext(); Assert.AreEqual("ConfirmarBorrado", redirectToActionName.Current); }
protected void Page_Load(object sender, EventArgs e) { // Se não tiver usuario logado ele volta pra Home if (Session["usuario"] == null) { Response.Redirect("../Home.aspx"); } perfil = new PerfilBean(); perfcont = new PerfilController(); cursocont = new CursoController(); areacont = new AreaController(); unidadecont = new UnidadeController(); //Label com nome do usuario lbNome.Text = Session["usuario"].ToString(); int UsuarioId = int.Parse(Session["usuarioId"].ToString()); //verifica se o status do usuario esta ativo // if (Session["UsuarioStatus"].ToString() == "A") { try { //Verifica se ele é um administrador if (Session["UsuarioTipo"].ToString() == "A") { } else { //Verifica se o usuário fez o cadastro de perfil try { perfil = perfcont.ConsultarPerfilPorIdUsuario(UsuarioId); Session["PerfilId"] = perfil.Id_perfil; if (perfil == null) { Panel conteudo = new Panel(); lbtAlterarPerfil.Visible = false; Label lbcursounidade = new Label(); lbcursounidade.Text = "< div > Complete seu cadastro para receber opções de curso" + "<p><a class= " + "\"" + "btn btn-primary btn-lg" + "\"" + " href= " + "\"" + "Cadastro_Perfil.aspx" + "\"" + " role= " + "\"" + "button" + "\"" + " >Concluir Cadastro »</a></p></div>"; conteudo.Controls.Add(lbcursounidade); pnPerfil.Controls.Add(conteudo); } else { //carrega os cursos sugeridos Sugestoesdcurso(UsuarioId, perfil.Id_perfil); } } catch { } } } catch { } // } }
public void TestEditarNullPerfil() { PerfilController controller = new PerfilController(); ActionResult result = controller.Editar(""); Assert.IsNotNull(result); }
public Nuevo() { InitializeComponent(); EmpleadoController = new EmpleadoController("Empleados"); PerfilController = new PerfilController("Perfiles"); TurnoController = new TurnoController("Turnos"); HorarioController = new HorarioController("Horarios"); }
public override void SetupTest() { base.SetupTest(); this.controller = new PerfilController(); var context = new ControllerContext(this.moqHttpContext.Object, new RouteData(), this.controller); this.controller.ControllerContext = context; }
public void VerPerfiles() { PerfilController controller = new PerfilController(); ActionResult result = controller.VerPerfiles("Jose"); Assert.IsNotNull(result); }
public PerfilControllerTest() { _cacheMock = new Mock <IDistributedCache>(); _serviceMock = new Mock <IPerfilService>(); SetupInitialize(); _controller = new PerfilController(_cacheMock.Object, _serviceMock.Object); }
public void TestObtenerPerfilesNotNull() { // Arrange PerfilController controller = new PerfilController(); // Act ICollection <string> result = PerfilController.ObtenerPerfiles(); // Assert Assert.IsNotNull(result); }
public void TestCambiarNotNull() { // Arrange PerfilController controller = new PerfilController(); // Act ViewResult result = controller.Cambiar() as ViewResult; // Assert Assert.IsNotNull(result); }
public void Index() { // Arrange PerfilController controller = new PerfilController(); // Act ViewResult result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); }
public void GestionarPerfil() { // Arrange PerfilController controller = new PerfilController(); // Act ViewResult result = controller.gestionar_perfil() as ViewResult; // Assert Assert.IsNotNull(result); }
public Panel() { InitializeComponent(); UsuarioController = new UsuarioController("Usuarios"); ColorController = new ColorController("Colores"); ModeloController = new ModeloController("Modelos"); PerfilController = new PerfilController("Perfiles"); TurnoController = new TurnoController("Turnos"); HorarioController = new HorarioController("Horarios"); EmpleadoController = new EmpleadoController("Empleados"); }
private void pbExcluir_Click(object sender, EventArgs e) { DialogResult r = MessageBox.Show("O processo de exclusão é irreversivel, confirma excluir?", " ", MessageBoxButtons.OKCancel); if (r.Equals(DialogResult.OK)) { PerfilController c = new PerfilController(); c.delete((int)gridPerfil.CurrentRow.Cells[0].Value); atualizaTela(); } }
public void testIrA_Fail() { // Arrange PerfilController controller = new PerfilController(); // Act var result = controller.IrA("@") as ViewResult; // Assert Assert.IsNotNull(result); }
public void UsuarioActual() { // Arrange PerfilController controller = new PerfilController(); // Act Usuario result = controller.obtener_usuario_actual("2222222222") as Usuario; // Assert Assert.IsNotNull(result); }
public void ObtenerUsuarios() { // Arrange PerfilController controller = new PerfilController(); // Act List <Usuario> result = controller.obtener_usuarios() as List <Usuario>; // Assert Assert.IsNotNull(result); }
public void Buscar() { string estado = "A"; // Arrange PerfilController controller = new PerfilController(); // Act ViewResult result = controller.Buscar(estado) as ViewResult; // Assert Assert.IsNotNull(result); }
public void Eliminar() { string cedula = "0000000"; // Arrange PerfilController controller = new PerfilController(); // Act ViewResult result = controller.Eliminar(cedula) as ViewResult; // Assert Assert.IsNotNull(result); }
public void FiltrarUsuarios() { string filtro = "I"; // Arrange PerfilController controller = new PerfilController(); // Act List <Usuario> result = controller.filtrar_usuarios(filtro) as List <Usuario>; // Assert Assert.IsNotNull(result); }
public static List <ListItem> ComboMultPerfil() { List <ListItem> lstComboBean = PerfilController.GetAll(new PerfilBean { FlgHabilitado = "T" }).Select(x => new ListItem() { Text = x.Nombre, Value = x.Descripcion.ToString(), Selected = true, }).ToList(); return(lstComboBean); }
protected void Btcadastrar_Click(object sender, EventArgs e) { perfil = new PerfilBean(); perfil.Datanascimento = Txtdatanascimento.Text; perfil.Escolaridade = DDLescolaridade.SelectedValue; if (Convert.ToInt32(DDLcidade.SelectedValue) == 0) { Labelerro.Text = "Campo estado e cidade obrigatórios"; } else { cidade = new CidadeBean(); cidade.Id_cidade = Convert.ToInt32(DDLcidade.SelectedValue); usuario = new UsuarioBean(); usuario.Id = int.Parse(Session["usuarioId"].ToString()); //Mandando para o controler perfcont = new PerfilController(); usuCont = new UsuarioController(); try { cursocont = new CursoController(); usuario = usuCont.ConsultarUsuarioPorID(usuario.Id); int idperfil = perfcont.InserirNovoPerfil(usuario, perfil, cidade); perfil.Id_perfil = idperfil; for (int i = 0; i < cont; i++) { bool selecionado = CheckListArea.Items[i].Selected; if (selecionado == true) { area = new AreaBean(); area.Id = Convert.ToInt16(CheckListArea.Items[i].Value); perfcont.InserirPerfilArea(perfil, area); } } //Insere mais 1 ponto no curso indicado se o curso pertencer a area cursocont.InserirCursoIndicadoArea(perfil.Id_perfil, cidade.Id_cidade); Response.Redirect("Perfil.aspx"); } catch (Exception) { throw; } } }
private void CargaCombos() { try { var perfil = PerfilController.GetAll(new PerfilBean { FlgHabilitado = "T" }); Utility.ComboBuscar(ddlPerfil, perfil, "IdPerfil", "Descripcion"); } catch (Exception ex) { LogHelper.LogException(ex, "Error :" + this); throw new Exception("ERROR: " + ex.Message); } }
public IActionResult OnGet(string UsuarioURL) { UsuarioActual = HttpContext.Session.GetString(SessionKeyUsuario); if (UsuarioActual != null || UsuarioURL != null) { PerfilController = new PerfilController(); InformacionPersonal = PerfilController.RetornarDatosPerfil(UsuarioURL ?? UsuarioActual); ArticulosUsuario = PerfilController.RetornarArticulosMiembro(UsuarioURL ?? UsuarioActual); return(Page()); } return(RedirectToPage("/Cuenta/Registrar")); }
protected void lbtAlterarPerfil_Click(object sender, EventArgs e) { int UsuarioId = int.Parse(Session["usuarioId"].ToString()); perfcont = new PerfilController(); perfil = perfcont.ConsultarPerfilPorIdUsuario(UsuarioId); if (perfil == null) { Response.Redirect("Cadastro_Perfil.aspx"); } else { Response.Redirect("Alterar_Perfil.aspx"); } }
private void pbSalvar_Click(object sender, EventArgs e) { var perfil = new PERFIL(); if (!txtId.Text.Equals(string.Empty)) { perfil.id = int.Parse(txtId.Text); } perfil.nome = txtNome.Text; perfil.qtLivros = int.Parse(txtQtdLivros.Text); perfil.valorMulta = decimal.Parse(txtValorMulta.Text); perfil.diasParaEmprestimo = int.Parse(txtDiasEmprestimo.Text); PerfilController c = new PerfilController(); c.persist(perfil); this.Close(); }
public void CrearPerfil() { string cedula = "204450123"; string nombre = "Andrés"; string apellido = "Sancho"; string usuario = "Activo"; string fecha = "10/12/1997"; string contrasena = "12345678"; // Arrange PerfilController controller = new PerfilController(); // Act ViewResult result = controller.CrearPerfil(cedula, nombre, "Emilio", apellido, "Arroyo", fecha, fecha, " ", " ", usuario, contrasena) as ViewResult; // Assert Assert.IsNotNull(result); }
protected void Page_Load(object sender, EventArgs e) { if (Session["lgn_id"] == null) { Session.Clear(); string myScript = ConfigurationManager.AppSettings["URL_LOGIN"]; String lsScript = "parent.document.location.href = '" + myScript + "/default.aspx?acc=SES';"; Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", lsScript, true); } else { Session["lstPerfiles"] = PerfilController.GetAll(new PerfilBean { FlgHabilitado = "T" }); if (!IsPostBack) { string json = new System.IO.StreamReader(Request.InputStream).ReadToEnd(); Dictionary<string, string> dataJSON = JsonConvert.DeserializeObject<Dictionary<string, string>>(json); if (dataJSON != null ) { String Codigo = dataJSON["codigo"].ToString(); GrupoBean obj = GrupoController.Get(new GrupoBean { IDGrupo = int.Parse( dataJSON["codigo"].ToString()) }); myModalLabel.InnerText = "Editar " + Model.bean.IdiomaCultura.getMensaje(Model.bean.IdiomaCultura.WEB_GRUPO); if (obj != null) { CargaComboPadre(obj.IDGrupo); hdIdGrupo.Value = (obj.IDGrupo).ToString(); MtxtCodigo.Value = obj.Codigo; MtxtDescripcion.Value = obj.Nombre; MddlPadre.SelectedValue = obj.CodigoPadreGrupo; MtxtCodigo.Disabled = true; } } else { CargaComboPadre(0); myModalLabel.InnerText = "Crear " + Model.bean.IdiomaCultura.getMensaje(Model.bean.IdiomaCultura.WEB_GRUPO); } } } }