protected void btnGuardar_Click(object sender, EventArgs e) { string nombre = txtNombrePersona.Text.Trim(); string apellidos = txtApellidos.Text.Trim(); string usuario = txtUsuario.Text.Trim(); string contrasenna = txtContrasenna.Text.Trim(); int edad = int.Parse(txtEdad.Text.Trim()); ModelPersona persona = new ModelPersona(); persona.Nombrepersona = nombre; persona.Apellidopersona = apellidos; persona.Edad = edad; persona.Usuario = usuario; persona.Contrasenna = contrasenna; persona.Salt = ""; int resultado = persona.SP_crearMensajero(); if (resultado == 1) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alertaExito", "window.onload = function() {alert('Mensajero registrado');}", true); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alertaError", "window.onload = function() {alert('Mensajero no registrado');}", true); } }
// GET: Cipres public ActionResult InsertCipres(int id) { Vendedor = Vendedor.VendedorDetails(id); Cipres.Vendedor = id; Cipres.Nombre = Vendedor.Nombre + " " + Vendedor.Apellido1 + " " + Vendedor.Apellido2; Cipres.Codigo = Vendedor.Codigo; Cipres.Consecutivo = Vendedor.Consecutivo; Cipres.Cedula = Vendedor.Cedula; Cipres.FechaIngreso = Convert.ToDateTime(TempData["Fecha"]); if (Cipres.FechaIngreso.ToShortDateString().Equals("1/1/0001") != true) { Cipres.ListaCipres = Cipres.ListaInsertadosHoy(Convert.ToDateTime(TempData["Fecha"]), Cipres.Codigo); } else { Cipres.FechaIngreso = DateTime.Now; } return(View(Cipres)); }
// GET: Cipres public ActionResult InsertTroza(int id, int vendedor) { Vendedor = Vendedor.VendedorDetails(vendedor); Other.Vendedor = vendedor; Other.Tipo = id; Other.Nombre = Vendedor.Nombre + " " + Vendedor.Apellido1 + " " + Vendedor.Apellido2; Other.Codigo = Vendedor.Codigo; Other.Consecutivo = Vendedor.Consecutivo; Other.Cedula = Vendedor.Cedula; Other.FechaIngreso = Convert.ToDateTime(TempData["Fecha"]); if (Other.FechaIngreso.ToShortDateString().Equals("1/1/0001") != true) { Other.ListaOtros = Other.ListaInsertadosHoy(Other.FechaIngreso, Other.Codigo, Other.Tipo); } else { Other.FechaIngreso = DateTime.Now; Other.ListaOtros = new List <ModelOtherWood>(); } return(View(Other)); }
//METODO DE GUARDAR USUARIO protected void txtGuardar_Click(object sender, EventArgs e) { int cedulaUsuario = int.Parse(txtcedulaUsuario.Text.Trim()); string correoElectronico = txtnombreCompleto.Text.Trim(); int idRol = int.Parse(txtRol.Text.Trim()); string contrasenia = txtcontrasenna.Text.Trim(); //Para encriptar protocolo ICryptoService cryptoService = new PBKDF2(); //Generar algoritmo de encriptación string salt = cryptoService.GenerateSalt(); string contraseniaEncriptada = cryptoService.Compute(contrasenia); ModelPersona usuario = new ModelPersona(); usuario.cedulaAsociado = cedulaUsuario; usuario.correoElectronico = correoElectronico; usuario.idRol = idRol; usuario.contrasenna = contraseniaEncriptada; usuario.salt = salt; usuario.idEstadoDatos = 1; int resultado = usuario.CrearUsuario(); if (resultado == 1) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alertaExito", "window.onload = function() { alert('Mensajero registrado exitosamente.'); }", true); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alertaError", "window.onload = function() { alert('Opps!! Ocurrio un error al registrar el usuario.'); }", true); } }