コード例 #1
0
        public override void Ejecutar()
        {
            try
            {
                baseUsuario = FabricaDAO.CrearDAOUsuario();
                usuario     = (Usuario)baseUsuario.ConsultarPorNombre(usuario);

                baseAmigo    = FabricaDAO.CrearDAOAmigo();
                amigo.Activo = usuario.Id;
                baseAmigo.AceptarNotificacion(amigo);

                log.Info("Id:" + amigo.Pasivo + " Nombre: " + usuario.NombreUsuario);
            }
            catch (BaseDeDatosExcepcion e)
            {
                e.DatosAsociados = "Id:" + amigo.Pasivo + " Nombre: " + usuario.NombreUsuario;
                log.Error(e.Mensaje + "|" + e.DatosAsociados);
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }
            catch (CasteoInvalidoExcepcion e)
            {
                log.Warn(e.Mensaje);
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }
        }
コード例 #2
0
 protected void btnModificacion_Click(object sender, EventArgs e)
 {
     if (IsValid)
     {
         usuario                    = new UsuarioModelo();
         usuario.id_usuario         = Convert.ToInt32(Session[Session.SessionID + "idItemSelected"]);
         usuario.nombre             = tbNombre.Text;
         usuario.usuario_code1      = tbUsuario_code1.Text;
         usuario.email              = tbEmail.Text;
         usuario.password           = tbPassword.Text;
         usuario.usuario_tipo       = Convert.ToInt32(selectTipoUsuario.Value);
         usuario.usuario_habilitado = 1;
         DAOUsuario dao = new DAOUsuario();
         if (dao.ModificarUsuario(usuario, "modificacion"))
         {
             confirmacionEstado.CssClass = "text-success";
             confirmacionEstado.Text     = "usuario modificada correctamente";
         }
         else
         {
             confirmacionEstado.CssClass = "text-danger";
             confirmacionEstado.Text     = "usuario NO SE PUDO modificar correctamente";
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Metodo para obtener los roles del suaruio
        /// autor=Facu
        /// </summary>
        /// <param name="Largo de la clave"></param>
        /// <returns></returns>
        public string[] obtenerRolesDelUsuario(string email)
        {
            DAOUsuario daoUsuario = new DAOUsuario();
            Usuario    usuario    = daoUsuario.obtenerUsuarioPorEmail(email);

            return(new string[] { usuario.tipoUsuario.nombre });
        }
コード例 #4
0
    void nuevaVenta()
    {
        if (Session["venta"] != null)
        {
            Producto individual = new Producto();
            datosAbono = new DataTable();
            datosAbono = (Session["venta"] as DataTable);

            foreach (DataRow row in datosAbono.Rows)
            {
                Venta venta = new Venta();
                venta.Idcliente    = Convert.ToInt32(row["idcliente"]);
                venta.Producto     = JsonConvert.DeserializeObject <List <Producto> >(Convert.ToString(row["descripcion"]));
                Session["refresh"] = venta.Producto;
                venta.Idvendedor   = Convert.ToInt32(row["idvendedor"]);
                venta.Fecha        = Convert.ToDateTime(row["fecha"]);
                venta.Precio       = Convert.ToDouble(row["precio"]);
                venta.Sede         = Convert.ToString(row["sede"]);
                DAOUsuario dAO = new DAOUsuario();
                dAO.crearVenta(venta, JsonConvert.SerializeObject(venta.Producto));

#pragma warning disable CS0618 // Type or member is obsolete
                RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('Se ha convertido en venta.');</script>");
#pragma warning restore CS0618 // Type or member is obsolete
                this.actualizarInventario();
            }

            Response.Redirect("../Tienda/VistaFactura.aspx");
        }
    }
コード例 #5
0
        public ActionResult ModificarOficinaPOST(Oficina model, string lugar)
        {
            string name    = TempData["username"].ToString();
            string nameRol = TempData["rol"].ToString();
            int    codUser = Int32.Parse(TempData["codUser"].ToString());

            ViewBag.name         = name;
            ViewBag.rol          = nameRol;
            TempData["username"] = name;
            TempData["rol"]      = nameRol;
            TempData["codUser"]  = codUser;

            DAOUsuario dataU  = DAOUsuario.getInstance();
            string     today  = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss tt");
            string     accion = "Modificando Oficina " + model.cod;

            dataU.insertarAccion(codUser, 3, today, accion);

            int        codlugar = Int32.Parse(lugar);
            OficinaDAO data     = OficinaDAO.getInstance();

            data.modificarOficina(model.cod, model.nombre, model.capacidad, model.correo, model.almacenamiento, codlugar);
            List <Oficina> oficinas = data.obtenerOficinas();

            return(View("~/Views/Oficinas/IndexOficina.cshtml", oficinas));
        }
コード例 #6
0
        public ActionResult AgregarRol(Rol model)
        {
            string name    = TempData["username"].ToString();
            string nameRol = TempData["rol"].ToString();
            int    codUser = Int32.Parse(TempData["codUser"].ToString());

            ViewBag.name         = name;
            ViewBag.rol          = nameRol;
            TempData["username"] = name;
            TempData["rol"]      = nameRol;
            TempData["codUser"]  = codUser;

            DAOUsuario dataU  = DAOUsuario.getInstance();
            string     today  = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss tt");
            string     accion = "Registro Rol " + model.Nombre;

            dataU.insertarAccion(codUser, 1, today, accion);

            DAORol data = DAORol.getInstance();

            data.insertarRol(model.Nombre);
            List <Rol> Roles = data.obtenerRol();

            return(View("~/Views/Rol/IndexRol.cshtml", Roles));
        }
コード例 #7
0
        public DataTable buscarUsuario(string id)
        {
            DAOUsuario dAOUsuario = new DAOUsuario();
            DataTable  usuario    = dAOUsuario.buscarUsuario(id);

            return(usuario);
        }
コード例 #8
0
        public void ModificarPassUsuario(string usuario_sistema, string passAnterior, string passNueva)
        {
            //busca info del usuario
            try
            {
                IDAOUsuario iDaoUsuario = new DAOUsuario();

                byte[] usr    = Convert.FromBase64String(usuario_sistema); // obtiene usuario
                byte[] pws    = Convert.FromBase64String(passAnterior);    // obtiene password
                byte[] pwsNew = Convert.FromBase64String(passNueva);       //obtiene password nueva

                RespuestaBD resp = iDaoUsuario.EditarPassword(
                    Encriptacion.Desencriptar(usr),
                    Encriptacion.EncriptarContraseña(Encriptacion.Desencriptar(pwsNew), Encriptacion.Desencriptar(usr)),
                    Encriptacion.EncriptarContraseña(Encriptacion.Desencriptar(pws), Encriptacion.Desencriptar(usr))
                    );
                if (resp.EXISTE_ERROR)
                {
                    throw new Exception(resp.MENSAJE);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(new Util().ObtenerMsjExcepcion(ex));
            }
        }
コード例 #9
0
        public override void Ejecutar()
        {
            //faltan verificaciones
            DAOUsuario dao = FabricaDAO.CrearDAOUsuario();

            dao.AgregarNuevo(Entidad);
        }
コード例 #10
0
        public DataTable eliminarUsuario(string id, string SessionID)
        {
            DAOUsuario dAOUsuario = new DAOUsuario();
            DataTable  usuario    = dAOUsuario.eliminarUsuario(id, SessionID);

            return(usuario);
        }
コード例 #11
0
        Decimal VT = 0;//VARIAVEL GLOBAL PARA CALCULAR VALOR TOTAL DOS PRODUTOS POR QUANITDADE
        public NovaVenda()
        {
            InitializeComponent();

            // USUARIO
            DAOUsuario   usuario       = new DAOUsuario();
            UsuarioModel usuarioLogado = new UsuarioModel();

            usuarioLogado   = usuario.PegarUsuarioLogado();
            LblUsuario.Text = usuarioLogado.Nome;

            //DATA
            Controller tempo = new Controller();
            String     hora  = tempo.PegarDiaeHora();

            LblTestedata.Text = Convert.ToString(hora);

            //INICAR TABELA CAIXA
            String data = tempo.PegarDiaMesAnoAtual();

            DAOCaixa daocaixa = new DAOCaixa();

            daocaixa.IniciarCaixa(Convert.ToString(data));

            //ZERAR TABELA TEMP
            DAOVENDATEMP temp = new DAOVENDATEMP();

            temp.ZerarTabela();
        }
コード例 #12
0
 public ValidarAcessoUsuario(IDAO _daoUsuario,
                             UserManager <Usuario> userManager, SignInManager <Usuario> signInManager)
 {
     daoUsuario     = (DAOUsuario)_daoUsuario;
     _userManager   = userManager;
     _signInManager = signInManager;
 }
コード例 #13
0
        // Grabar los datos de la venta.
        public int grabar(Venta miVenta, IList <DetalleVenta> misDetalles, DatosFacturacion misDatos)
        {
            int registrosAfectados = 0;

            try
            {
                // Grabando cliente.
                var miDaoCliente = DAOCliente.crearDAO();
                registrosAfectados = miDaoCliente.agregar(miVenta);
                // grabando usuario.
                var miDaoUsuario = DAOUsuario.crearDAO();
                registrosAfectados = miDaoUsuario.agregar(miVenta);
                // Grabar el ejemplar.
                var miDaoEjemplar = DAOEjemplar.crearDAO();
                registrosAfectados = miDaoEjemplar.agregar(misDetalles);
                // Grabando venta.
                var miDaoVenta = DAOVenta.crearDAO();
                registrosAfectados = miDaoVenta.agregar(miVenta, misDetalles);
                // Grabando los datos de facturacion si corresponde el tipo de documento.
                if (miVenta.IdTipoDocumento == 2)
                {
                    var miDaoDatosFactura = DAODatosFacturacion.crearDAO();
                    registrosAfectados = miDaoDatosFactura.agregar(misDatos, miVenta.IdVenta);
                }
            }
            catch
            {
                throw;
            }
            return(registrosAfectados);
        }
コード例 #14
0
        public void SetCliente(int r)
        {
            DAOUsuario dAO      = new DAOUsuario();
            int        id       = r;
            DataTable  clientes = dAO.verClientesEditar(id);

            if (clientes != null && r > 0)
            {
                foreach (DataRow row in clientes.Rows)
                {
                    clientico.Cedula    = Convert.ToInt32(row["cedula"]);
                    clientico.Nombre    = Convert.ToString(row["nombre"]);
                    clientico.Apellido  = Convert.ToString(row["apellido"]);
                    clientico.Direccion = Convert.ToString(row["direccion"]);
                    clientico.Telefono  = Convert.ToInt64(row["telefono"]);
                }
            }
            else
            {
                clientico.Cedula    = 0;
                clientico.Nombre    = "";
                clientico.Apellido  = "";
                clientico.Direccion = "";
                clientico.Telefono  = 0;
            }
        }
コード例 #15
0
        private void botonBaja_Click(object sender, System.EventArgs e)
        {
            if (dataGridUsuario.CurrentRow == null)
            {
                MessageBox.Show("Seleccione un Usuario a dar de baja.",
                                "", MessageBoxButtons.OK);
                return;
            }
            if ((bool)dataGridUsuario.CurrentRow.Cells["campoBaja"].Value)
            {
                MessageBox.Show("Usuario ya deshabilitado.",
                                "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            string       usrDelete = dataGridUsuario.CurrentRow.Cells["usr"].Value.ToString();
            DialogResult dr        = MessageBox.Show("Desea dar de Baja al usuario " + usrDelete + "?",
                                                     "", MessageBoxButtons.YesNo);

            switch (dr)
            {
            case DialogResult.Yes:
                DAOUsuario.borrar(usrDelete);
                updateGrid();
                break;

            case DialogResult.No: break;
            }
        }
コード例 #16
0
ファイル: AgregarSede.aspx.cs プロジェクト: isaacGomez-p/SCA
    protected void B_AgregarSede_Click(object sender, EventArgs e)
    {
        bool resultadoSede   = Regex.IsMatch(TB_NombreSede.Text, @"^[a-zA-Z]+$");
        bool resultadoCiudad = Regex.IsMatch(TB_Ciudad.Text, @"^[a-zA-Z]+$");

        if (validarLlenoSede() == true)
        {
            if (resultadoSede == true)
            {
                if (resultadoCiudad == true)
                {
                    Sede       sede = new Sede();
                    DAOUsuario dAO  = new DAOUsuario();

                    sede.NombreSede = TB_NombreSede.Text;
                    sede.Ciudad     = TB_Ciudad.Text;
                    sede.Direccion  = TB_Direccion.Text;

                    if (dAO.crearSede(sede) == true)
                    {
#pragma warning disable CS0618 // Type or member is obsolete
                        RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('Sede creada exitosamente. ');</script>");
#pragma warning restore CS0618 // Type or member is obsolete
                    }
                    else
                    {
                        dAO.editarAgregarSedeNuevamente(sede.NombreSede, sede.Ciudad);
#pragma warning disable CS0618 // Type or member is obsolete
                        RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('Ya hay una sede en esta ciudad.  ');</script>");
                        return;

#pragma warning restore CS0618 // Type or member is obsolete
                    };

                    TB_Ciudad.Text     = "";
                    TB_NombreSede.Text = "";
                    TB_Direccion.Text  = "";
                    GridView1.DataBind();
                }
                else
                {
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
                    RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('Ingrese solo letras en la ciudad de la sede. ');</script>");
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
                }
            }
            else
            {
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
                RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('Ingrese solo letras en el nombre de la sede.');</script>");
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
            }
        }
        else
        {
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('Ingrese todos los datos. ');</script>");
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
        }
    }
コード例 #17
0
        }//NA TELA DE LOGIN - QUANDO O USUÁRO CLICA EM LOGIN

        public bool Cadastrar(String nome, String senha, String confSenha)
        {
            if (senha != confSenha)
            {
                Erro TelaDeErro = new Erro("002", "As senhas são diferentes", "Digite as senhas iguais.", "", "", "", "");
                TelaDeErro.Show();
                return(false);//NAÕ CADASTROU
            }
            else
            {
                bool UsuarioExiste = false;

                DAOUsuario dao = new DAOUsuario();
                UsuarioExiste = dao.ValidaNomeUsuario(nome);

                if (UsuarioExiste == true)
                {
                    Erro TelaDeErro = new Erro("003", "Já existe um usuário cadastrado com esse nome, não é possível cadastrar com o mesmo nome", "Tente novamente com outro usuário.", "", "", "", "");
                    TelaDeErro.Show();
                    return(false);//NAÕ CADASTROU
                }
                else
                {
                    dao.InserirUsuario(nome, senha);
                    return(true);//CADASTROU
                }
            }
        }//VERIFICA SE SENHAS SÃO IGUAIS
コード例 #18
0
        public ActionResult EliminarOficina(Oficina model)
        {
            string name    = TempData["username"].ToString();
            string nameRol = TempData["rol"].ToString();
            int    codUser = Int32.Parse(TempData["codUser"].ToString());

            ViewBag.name         = name;
            ViewBag.rol          = nameRol;
            TempData["username"] = name;
            TempData["rol"]      = nameRol;
            TempData["codUser"]  = codUser;

            DAOUsuario dataU  = DAOUsuario.getInstance();
            string     today  = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss tt");
            string     accion = "Eliminar Oficina " + model.cod;

            dataU.insertarAccion(codUser, 4, today, accion);

            //int cod = Int32.Parse(model.cod);
            OficinaDAO data = OficinaDAO.getInstance();

            data.eliminarOficina(model.cod);
            DAOTelefono data3 = DAOTelefono.getInstance();

            data3.eliminarTelefonoOfic(model.cod);
            List <Oficina> oficinas = data.obtenerOficinas();

            return(View("~/Views/Oficinas/IndexOficina.cshtml", oficinas));
        }
コード例 #19
0
ファイル: Login.cs プロジェクト: csalgadolizana/Examen-CSharp
 private void btnIngresar_Click(object sender, EventArgs e)
 {
     try
     {
         string     nombreUser = txtUser.Text;
         string     contra     = txtPass.Text;
         DAOUsuario usuarioDAO = new DAOUsuario();
         usuario    user       = usuarioDAO.login(nombreUser, contra);
         if (user != null)
         {
             LoginInfo.username = nombreUser;
             LoginInfo.pass     = contra;
             LoginInfo.Tipo     = user.tipo.Value;
             MessageBox.Show("Bienvenido " + nombreUser);
             FormMenu menu = new FormMenu();
             menu.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("Nombre de usuario o clave incorrecta", "Uupps!!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("err -> " + ex.Message);
         throw;
     }
 }
コード例 #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString.Count > 0)
        {
            DAOUsuario user = new DAOUsuario();
            DataTable  info = user.obtenerUsusarioToken(Request.QueryString[0]);

            if (int.Parse(info.Rows[0][0].ToString()) == -1)
            {
                this.RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('El Token es invalido. Genere uno nuevo');window.location=\"Loggin.aspx\"</script>");
            }
            else if (int.Parse(info.Rows[0][0].ToString()) == -1)
            {
                this.RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('El Token esta vencido. Genere uno nuevo');window.location=\"Loggin.aspx\"</script>");
            }
            else
            {
                Session["user_id"] = int.Parse(info.Rows[0][0].ToString());
            }
        }

        else
        {
            Response.Redirect("Loggin.aspx");
        }
    }
コード例 #21
0
        private void botonBajaLogica_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult Opcion;
                Opcion = MessageBox.Show("Realmente Desea dar de baja definitiva al Usuario", "Sistema de Aerolineas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                if (Opcion == DialogResult.OK)
                {
                    int Codigo;

                    foreach (DataGridViewRow row in dataListadoUsuarios.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            Codigo = Convert.ToInt32(row.Cells[1].Value);
                            DAOUsuario.darDeBajaUsuario(Codigo);
                        }
                    }
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }

            checkBoxbajaLogica1.Checked = false;
        }
コード例 #22
0
    protected void puntospositivos_Click1(object sender, ImageClickEventArgs e)
    {
        int index_he   = int.Parse(Session["id_herramienta"].ToString());
        int index_user = int.Parse(Session["user_id"].ToString());

        EDHerramienta  her    = new EDHerramienta();
        DAOHerramienta puntos = new DAOHerramienta();
        DAOUsuario     punt   = new DAOUsuario();



        her.Id_herramienta = index_he;
        her.Id_user        = index_user;
        her.Puntos         = 2;


        punt.aprobarPuntos(her);
        if (punt.aprobarPuntos(her).Rows.Count > 0)
        {
            this.RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('Ya dio puntos');</script>");
        }
        else
        {
            puntos.agregarPuntos(her);
            Response.Redirect("muestra_win.aspx");
        }
    }
コード例 #23
0
    protected void B_Conflicto_Click(object sender, EventArgs e)
    {
        DAOUsuario dAO      = new DAOUsuario();
        Pedido     devolver = new Pedido();
        DateTime   fechaHoy = DateTime.Now;

        devolver.Sede   = Convert.ToString(Session["sede"]);
        devolver.Fecha  = fechaHoy.ToString("d");
        devolver.Estado = false;
        dAO.crearPedido(devolver, TB_Observación.Text);
        DataTable id = new DataTable();

        id = dAO.verUltimoId();
        if (id.Rows.Count > 0)
        {
            foreach (DataRow rowe in id.Rows)
            {
                devolver.Idpedido = Convert.ToInt32(rowe["f_verultimoid"]);
            }

            foreach (GridViewRow row in GV_Devolver.Rows)
            {
                Asignacion temp = new Asignacion();
                temp.Referencia = Convert.ToString(((Label)row.Cells[0].FindControl("L_Referencia")).Text);
                temp.Talla      = Convert.ToDouble(((Label)row.Cells[1].FindControl("L_Talla")).Text);
                temp.Cantidad   = Convert.ToInt32(((Label)row.Cells[1].FindControl("L_Cantidad")).Text);
                dAO.crearPedidos(temp, devolver.Idpedido);
            }
        }
        TB_Observación.Text    = "";
        GV_Devolver.DataSource = null;
        GV_Devolver.DataBind();
    }
コード例 #24
0
        /// <summary>
        /// autor=Flor
        /// Método para tomar los datos de la pantalla y crear la entidad Usuario
        /// </summary>
        /// <param name="apellido"></param>
        /// <param name="nombre"></param>
        /// <param name="mail"></param>
        /// <param name="telefono"></param>
        /// <param name="contrasenia"></param>
        /// <returns>Usuario</returns>
        public string registrarUsuario(string nombre, string mail, string contrasenia)
        {
            try
            {
                Usuario u = new Usuario
                {
                    nombre      = nombre,
                    email       = mail,
                    contrasenia = encriptarContrasenia(contrasenia),
                    codigo      = crearCodigo(),
                    tipoUsuario = new TipoUsuario {
                        idTipoUsuario = 1, nombre = "Administrador"
                    }
                };

                DAOUsuario gestorBD = new DAOUsuario();
                gestorBD.registrarUsuario(u);//guarda en la BD
                return(u.codigo);
            }
            catch (Exception e)
            {
                if (e.Message.Contains("No se puede insertar una clave duplicada"))
                {
                    throw new Exception("El usuario con el mail: " + mail + " Ya se encuentra registrado. Por favor ingrese una cuenta de correo diferente.");
                }
                else
                {
                    throw new Exception(e.Message);
                }
            }


            ;
        }
コード例 #25
0
        public NovaEncomenda()
        {
            InitializeComponent();

            //DATA
            Controller tempo = new Controller();
            String     hora  = tempo.PegarDiaeHora();

            TxtDataEntrada.Text = Convert.ToString(hora);
            TxtDataEntrega.Text = Convert.ToString(hora);
            LblTestedata.Text   = Convert.ToString(hora);

            //USUARIO
            DAOUsuario   usuario = new DAOUsuario();
            UsuarioModel us      = new UsuarioModel();

            us = usuario.PegarUsuarioLogado();
            LblUsuario.Text = us.Nome;


            //INICAR TABELA CAIXA
            String data = tempo.PegarDiaMesAnoAtual();

            DAOCaixa daocaixa = new DAOCaixa();

            daocaixa.IniciarCaixa(Convert.ToString(data));
        }
コード例 #26
0
        public ActionResult ModificarUsuario(Usuario model)
        {
            string name    = TempData["username"].ToString();
            string nameRol = TempData["rol"].ToString();
            int    codUser = Int32.Parse(TempData["codUser"].ToString());

            ViewBag.name         = name;
            ViewBag.rol          = nameRol;
            TempData["username"] = name;
            TempData["rol"]      = nameRol;
            TempData["codUser"]  = codUser;

            DAOUsuario dataU  = DAOUsuario.getInstance();
            string     today  = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss tt");
            string     accion = "Modifico Usuario " + model.cod;

            dataU.insertarAccion(codUser, 3, today, accion);

            DAOUsuario data = DAOUsuario.getInstance();

            data.modificarUsuario(model.cod, model.username, model.contrasena, model.Rol);
            List <Usuario> Usuarios = data.obtenerUsuario();

            return(View("~/Views/Usuario/IndexUsuario.cshtml", Usuarios));
        }
コード例 #27
0
    protected void B_Recuperar_Click(object sender, EventArgs e)
    {
        DAOUsuario dao = new DAOUsuario();

        System.Data.DataTable validez = dao.generarToken(TB_User_Name.Text);
        if (int.Parse(validez.Rows[0]["id"].ToString()) > 0)
        {
            EUserToken token = new EUserToken();
            token.Id        = int.Parse(validez.Rows[0]["id"].ToString());
            token.Nombre    = validez.Rows[0]["nombre"].ToString();
            token.User_name = validez.Rows[0]["user_name"].ToString();
            token.Estado    = int.Parse(validez.Rows[0]["estado"].ToString());
            token.Correo    = validez.Rows[0]["correo"].ToString();
            token.Fecha     = DateTime.Now.ToFileTimeUtc();

            String userToken = encriptar(JsonConvert.SerializeObject(token));
            dao.almacenarToken(userToken, token.Id);

            Correo correo = new Correo();

            String mensaje = "su link de acceso es: " + "http://localhost:2175/View/RecuperarContraseña.aspx?" + userToken;
            correo.enviarCorreo(token.Correo, userToken, mensaje);

            L_Mensaje.Text = "Su nueva contraseña ha sido enviada a su correo";
        }
        else if (int.Parse(validez.Rows[0]["id"].ToString()) == -2)
        {
            L_Mensaje.Text = "Ya extsite un token, por favor verifique su correo.";
        }
        else
        {
            L_Mensaje.Text = "El usurio digitado no existe";
        }
    }
コード例 #28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            DAOUsuario usu = new DAOUsuario();

            if (txtNombre.Text != "Nombre" && txtApellido.Text != "Apellidos" && txtUsername.Text != "Username" &&
                txtContraseña.Text != "Contraseña" && txtConfirmar.Text != "Confirmar Contraseña")
            {
                if (verificarContraseña(txtContraseña.Text))
                {
                    if (txtContraseña.Text == txtConfirmar.Text)
                    {
                        Usuario nuevo = new Usuario(txtNombre.Text, txtApellido.Text, txtUsername.Text,
                                                    txtContraseña.Text, "Cliente");
                        usu.registrar(nuevo);

                        txtNombre.Text     = "registro";
                        txtApellido.Text   = "Apellidos";
                        txtUsername.Text   = "UserName";
                        txtContraseña.Text = "Contraseña";
                        txtConfirmar.Text  = "Confirmar Contraseña";
                    }
                    else
                    {
                        MessageBox.Show("Las contraseñas no coinciden");
                    }
                }
            }
            else
            {
                MessageBox.Show("Alguno de los espacios esta en blanco, favor de verificar");
            }
        }
コード例 #29
0
 public void ActualizarUsuario(VMUsuario Usuario)
 {
     try
     {
         IDAOUsuario iDaoUsuario = new DAOUsuario();
         RespuestaBD resp        = iDaoUsuario.EditarUsuario(
             Usuario.Usuario_sistema,
             Usuario.Password,
             Usuario.Nombre,
             Usuario.Apellido_paterno,
             Usuario.Apellido_materno,
             Usuario.Correo,
             Usuario.Celular,
             Usuario.Extension,
             Usuario.FechaDeVencimiento,
             Usuario.IdEstatus
             );
         if (resp.EXISTE_ERROR)
         {
             throw new Exception(resp.MENSAJE);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(new Util().ObtenerMsjExcepcion(ex));
     }
 }
コード例 #30
0
    void Seleccionar_Producto(int r)
    {
        DAOUsuario dAO       = new DAOUsuario();
        Producto   producto  = new Producto();
        int        refe      = r;
        DataTable  productos = dAO.verProductosEditar(refe);

        if (productos != null)
        {
            foreach (DataRow row in productos.Rows)
            {
                producto.ReferenciaProducto = Convert.ToString(row["referenciaproducto"]);
                producto.Cantidad           = Convert.ToInt64(row["cantidad"]);
                producto.Talla  = Convert.ToDouble(row["talla"]);
                producto.Precio = Convert.ToDouble(row["precio"]);
            }
        }
        Session["compara"]            = Convert.ToString(producto.Cantidad);
        TB_EditarReferencia.Text      = producto.ReferenciaProducto;
        TB_EditarCantidad.Text        = Convert.ToString(producto.Cantidad);
        TB_EditarPrecio.Text          = Convert.ToString(producto.Precio);
        DL_EditarTallas.SelectedValue = Convert.ToString(producto.Talla);
        B_EditarProducto.Enabled      = true;
        B_Cancelar.Enabled            = true;
    }
コード例 #31
0
ファイル: TelaLogin.cs プロジェクト: jfpsb/VandaConfeccoes
 public TelaLogin()
 {
     InitializeComponent();
     DAOUsuario = new DAOUsuario(listSession);
     DAOPermissoesUsuario = new DAO<Permissoes_Usuario>(listSession);
 }
コード例 #32
0
 public DeletarUsuário()
 {
     InitializeComponent();
     DaoUsuario = new DAOUsuario(listSession);
 }