protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string param = Request.QueryString["id"]; if (param != null) { OrdenProducto opBuscar = new OrdenProducto(int.Parse(Request.QueryString["id"])); OrdenProducto ordenProducto = NegOrdenProducto.buscarOrdenProducto(opBuscar); txtFechaR.Attributes["placeholder"] = ordenProducto.Fecha_recepcion.ToString(); txtFechaE.Attributes["placeholder"] = ordenProducto.Fecha_emision.ToString(); txtEstado.Attributes["placeholder"] = ordenProducto.Estado.ToString(); txtTotal.Attributes["placeholder"] = ordenProducto.Total.ToString(); ddUsuario.SelectedValue = ordenProducto.Usuario_id.ToString(); ddProveedor.SelectedValue = ordenProducto.Proveedor_id.ToString(); } if (!IsPostBack) { ddUsuario.DataSource = NegUsuario.listarTodos(); ddUsuario.DataValueField = "id"; ddUsuario.DataTextField = "nombre_user"; ddUsuario.DataBind(); } if (!IsPostBack) { ddProveedor.DataSource = NegProveedor.listarTodos(); ddProveedor.DataValueField = "id"; ddProveedor.DataTextField = "nombre"; ddProveedor.DataBind(); } } }
private void Button_Inserir(object sender, RoutedEventArgs e) { if (senhatxt.Password == confsenhatxt.Password) { ModJogador x = new ModJogador(); x.Nome = nometxt.Text; x.Email = emailtxt.Text; x.Fone = fonetxt.Text; x.Senha = senhatxt.Password; x.Nascimento = DateTime.Parse(nasctxt.Text); x.NumCamisa = int.Parse(numcatxt.Text); x.IdEquipe = int.Parse(idtimetxt.Text); x.Posicao = posicaotxt.Text; NegJogador y = new NegJogador(); y.InsertJogador(x); nometxt.Text = ""; emailtxt.Text = ""; fonetxt.Text = ""; senhatxt.Password = ""; posicaotxt.Text = ""; numcatxt.Text = ""; confsenhatxt.Password = ""; foto = string.Empty; idtimetxt.Text = ""; nasctxt.Text = ""; NegUsuario nu = new NegUsuario(); nu.InsertUsuario(x); } else { MessageBox.Show("Senhas diferentes"); } }
private void Insert_Presidente(object sender, RoutedEventArgs e) { if (senha.Password == confsenha.Password) { ModPresidente x = new ModPresidente(); x.Nome = nomepretxt.Text; x.Email = emailpretxt.Text; x.Fone = fonepretxt.Text; x.Senha = senha.Password; x.Nascimento = DateTime.Parse(nascpretxt.Text); NegPresidente y = new NegPresidente(); y.InsertPresidente(x); nomepretxt.Text = ""; emailpretxt.Text = ""; fonepretxt.Text = ""; senha.Password = ""; confsenha.Password = ""; foto = string.Empty; idpretxt.Text = ""; nascpretxt.Text = ""; NegUsuario Nu = new NegUsuario(); Nu.InsertUsuario(x); } else { MessageBox.Show("Senhas diferentes"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddTipoUsuario.DataSource = NegUsuario.listarTipoUsuario(); ddTipoUsuario.DataValueField = "id"; ddTipoUsuario.DataTextField = "descripcion"; ddTipoUsuario.DataBind(); } }
private void button1_Click(object sender, EventArgs e) { EntUsuario obj = NegUsuario.Login(usuario.Text, password.Text); if (obj != null) { principal p = new principal(); p.Visible = true; this.Dispose(false); } else { MessageBox.Show("Usted no esta registrado"); } }
protected void BtnAceptar_Click(object sender, EventArgs e) { if (Txtusuario.Text != "" && Txtpass.Text != "") { EntUsuario obj = NegUsuario.Login(Txtusuario.Text, Txtpass.Text); if (obj != null) { Session["usuario"] = obj; Session["perfil"] = obj; Response.Redirect("FrmPrincipal.aspx"); } else { LblError.Text = "Usuario o Contraseña invalido"; LblError.Visible = true; } } else { LblError.Text = "Falta agregar datos"; LblError.Visible = true; } }
protected void btnEntrar_Click(object sender, EventArgs e) { if (txtUsuario.Text.Length < 1) { lblErrUsu.Text = "Debe ingresar un nombre de usuario."; lblErrUsu.Visible = true; return; } lblErrUsu.Visible = false; if (txtContraseña.Text.Length < 1) { lblErrCon.Text = "Debe ingresar una contraseña."; lblErrCon.Visible = true; return; } lblErrCon.Visible = false; Usuario usuario = new Usuario(txtUsuario.Text, txtContraseña.Text); Usuario reuser = NegUsuario.buscarUsuario(usuario); if (reuser.Id > 0) { if (usuario.Nombre_user.Equals(reuser.Nombre_user)) { if (usuario.Contrasena.Equals(reuser.Contrasena)) { Session["Id"] = reuser.Id; Session["Nombre_user"] = reuser.Nombre_user; Session["Contrasena"] = reuser.Contrasena; Session["Correo"] = reuser.Correo; Session["Nombre"] = reuser.Nombre; Session["Apellido"] = reuser.Apellido; Session["Fecha_nacimiento"] = reuser.Fecha_nacimiento; Session["Activo"] = reuser.Activo; Session["Tipo_usuario_id"] = reuser.Tipo_usuario_id; Response.Redirect("~/default.aspx"); return; } else { lblErrUsu.Text = "Nombre de usuario o contraseña incorrectos."; lblErrUsu.Visible = true; return; } } else { lblErrUsu.Text = "Nombre de usuario o contraseña incorrectos."; lblErrUsu.Visible = true; return; } } else { lblErrUsu.Text = "Nombre de usuario o contraseña incorrectos."; lblErrUsu.Visible = true; return; } }
protected void btnAgregar_Click(object sender, EventArgs e) { //if (txtDescripcion.Text.Length < 1) //{ // txtDescripcion.Text = txtDescripcion.Attributes["placeholder"]; //} //if (txtFechaV.Text.Length < 1) //{ // txtFechaV.Text = txtFechaV.Attributes["placeholder"]; //} //if (txtPrecio.Text.Length < 1) //{ // txtPrecio.Text = txtPrecio.Attributes["placeholder"]; //} //if (txtStock.Text.Length < 1) //{ // txtStock.Text = txtStock.Attributes["placeholder"]; //} int result; if (txtUsuario.Text.Length < 1) { lblErrUsu.Text = "Debe ingresar un nombre de usuario."; lblErrUsu.Visible = true; return; } else if (txtUsuario.Text.Length > 20) { lblErrUsu.Text = "Nombre de usuario demaciado largo."; lblErrUsu.Visible = true; return; } lblErrUsu.Visible = false; if (txtContra.Text.Length < 1) { lblErrCont.Text = "Debe ingresar una contraseña."; lblErrCont.Visible = true; return; } else if (txtContra.Text.Length > 50) { lblErrCont.Text = "Contraseña demaciado larga."; lblErrCont.Visible = true; return; } lblErrCont.Visible = false; if (txtCorreo.Text.Length < 1) { lblErrCorr.Text = "Debe ingresar un correo."; lblErrCorr.Visible = true; return; } else if (txtCorreo.Text.Length > 50) { lblErrCorr.Text = "Correo demaciado largo."; lblErrCorr.Visible = true; return; } lblErrCorr.Visible = false; if (txtNombre.Text.Length < 1) { lblErrNom.Text = "Debe ingresar un Nombre."; lblErrNom.Visible = true; return; } else if (txtNombre.Text.Length > 50) { lblErrNom.Text = "Nombre demaciado largo."; lblErrNom.Visible = true; return; } lblErrNom.Visible = false; if (txtApellido.Text.Length < 1) { lblErrApe.Text = "Debe ingresar un Apellido."; lblErrApe.Visible = true; return; } else if (txtApellido.Text.Length > 50) { lblErrApe.Text = "Apellido demaciado largo."; lblErrApe.Visible = true; return; } lblErrApe.Visible = false; if (txtFechaN.Text.Length < 1) { lblErrFN.Text = "Debe ingresar una fecha de vencimiento."; lblErrFN.Visible = true; return; } else if (txtFechaN.Text.Length > 40) { lblErrFN.Text = "Formato incorrecto en fecha de vencimiento."; lblErrFN.Visible = true; return; } lblErrFN.Visible = false; if (ddTipoUsuario.SelectedItem.Text.Equals("")) { lblErrTiU.Text = "Debe seleccionar un Tipo de Usuario."; lblErrTiU.Visible = true; return; } lblErrUsu.Visible = false; lblErrCont.Visible = false; lblErrCorr.Visible = false; lblErrNom.Visible = false; lblErrApe.Visible = false; lblErrFN.Visible = false; lblErrTiU.Visible = false; //string param = Request.QueryString["id"]; //if (param != null) //{ // Producto actProducto = new Producto(int.Parse(param), // txtDescripcion.Text, // DateTime.Parse(txtFechaV.Text).Date, // int.Parse(txtPrecio.Text), // int.Parse(txtStock.Text), // int.Parse(ddTipoProducto.SelectedValue.ToString())); // if (NegProducto.ActualizarProducto(actProducto)) // { // string script = "alert('Producto Actualizado.');"; // ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); // } // else // { // string script = "alert('Hubo un problema actualizando el Producto.');"; // ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); // } // Response.Redirect("listarProductos.aspx"); //} Usuario usuario = new Usuario( txtUsuario.Text, txtContra.Text, txtCorreo.Text, txtNombre.Text, txtApellido.Text, DateTime.Parse(txtFechaN.Text), '1', int.Parse(ddTipoUsuario.SelectedValue.ToString())); if (NegUsuario.CrearUsuario(usuario)) { string script = "alert('Usuario Creado.');"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); txtUsuario.Text = ""; txtContra.Text = ""; txtCorreo.Text = ""; txtNombre.Text = ""; txtApellido.Text = ""; txtFechaN.Text = ""; return; } else { string script = "alert('Ha ocurrido un problema creando el usuario.');"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); return; } }