public ActionResult ActualizarEstadosVentas(FormCollection frm)
        {
            try
            { entUsuario u = new entUsuario();
              if (Session["usuario"] != null)
              {
                  u = (entUsuario)Session["usuario"];
              }
              int    idestado = 0, idasesor = 0;
              String desde = "", hasta = "";
              idestado = Convert.ToInt32(frm["select1"]);
              idasesor = Convert.ToInt32(frm["select2"]);
              desde    = frm["txtFehcaDesde"];
              hasta    = frm["txtFecHasta"];
              if (Session["ventas"] != null)
              {
                  Session.Remove("ventas");
              }
              Session["ventas"] = negPedido.Instancia.ListaComisiones(idasesor, desde, hasta, idestado);

              return(RedirectToAction("ActualizarEstadosVentas")); }
            catch (Exception e)
            {
                return(RedirectToAction("ActualizarEstadosVentas", new { mensaje = e.Message, identificador = 1 }));
            }
        }
        public entUsuario VerificarAcceso(String Usuario, String Password)
        {
            SqlCommand cmd = null;
            entUsuario u   = null;

            try{
                SqlConnection cn = Conexion.Instancia.conectar();
                cmd             = new SqlCommand("spVerificarAcceso", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@prmstrUsuario", Usuario);
                cmd.Parameters.AddWithValue("@prmstrPassword", Password);
                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    u               = new entUsuario();
                    u.idUsuario     = Convert.ToInt16(dr["idUsuario"]);
                    u.FechaCreacion = Convert.ToDateTime(dr["FechaCreacion"]);
                    u.UserName      = dr["UserName"].ToString();
                    u.Activo        = Convert.ToBoolean(dr["Activo"]);
                    entPersona p = new entPersona();
                    p.Nombres   = dr["Nombres"].ToString();
                    p.Apellidos = dr["APELLIDOs"].ToString();
                    p.DNI       = dr["DNI"].ToString();
                    p.Sexo      = dr["Sexo"].ToString();
                    u.Persona   = p;
                }
            }catch (Exception e) { throw e; }
            finally { cmd.Connection.Close(); }
            return(u);
        }
Example #3
0
        public static entUsuario Login(String user, String password)
        {
            entUsuario    objectUser = null;
            SqlCommand    cmd        = null;
            SqlDataReader dr         = null;

            try
            {
                Conexion      cn    = new Conexion();
                SqlConnection cnsql = cn.conectar();
                cmd = new SqlCommand("(nombre del proceso almacenado que se creo en la BD)", cnsql);
                cmd.Parameters.AddWithValue("@Username", user);
                cmd.Parameters.AddWithValue("@Password", password);
                cmd.CommandType = CommandType.StoredProcedure;
                cnsql.Open();
                dr         = cmd.ExecuteReader();
                objectUser = new entUsuario();
                dr.Read();
                objectUser.idUser   = Convert.ToInt32(dr["idUser"].ToString());
                objectUser.Name     = dr["Name"].ToString();
                objectUser.LastName = dr["LastName"].ToString();
                objectUser.User     = dr["User"].ToString();
                objectUser.Password = dr["Password"].ToString();
            }
            catch (Exception)
            {
                objectUser = null;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(objectUser);
        }
Example #4
0
        public DataTable buscarUsuario(entUsuario usuario)
        {
            DataTable dt = new DataTable();

            try
            {
                SqlConnection con = generarConexion();

                con.Open();                         // abro conexion

                SqlCommand com = new SqlCommand();  //inicializo el comando
                com.Connection  = con;              //asigno conexion al comando
                com.CommandText = "select * " +
                                  "from t_usuarios u " +
                                  "where u.usu_usuario = @usuario " +
                                  ";";                 //asigno la búsqueda sql al comando

                com.Parameters.Add(new SqlParameter("@usuario", usuario.USU_USUARIO));

                SqlDataAdapter da = new SqlDataAdapter(com);
                DataSet        ds = new DataSet();
                da.Fill(ds);
                dt = ds.Tables[0];
                con.Close();
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex + "Hubo un problema. Contáctese con su administrador.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(dt);
        }
        public ActionResult RegistroVenta(String mensaje, Int16?identificador)
        {
            try
            {
                ViewBag.mensaje       = mensaje;
                ViewBag.identificador = identificador;
                entUsuario u = (entUsuario)Session["usuario"];
                if (u != null)
                {
                    List <entTipDoc> lsTd = negTipDoc.Instancia.ListaTipDoc();
                    //var lsTipDoc = new SelectList(lsTd, "td_id", "td_nombre");
                    ViewBag.ListaTipDoc = lsTd;

                    List <entSegmento> lsSeg = negSegmento.Instancia.ListaSegmento();
                    //var lsTipDoc = new SelectList(lsTd, "td_id", "td_nombre");
                    ViewBag.ListaSegmento = lsSeg;
                    return(View());
                }
                else
                {
                    return(RedirectToAction("Index", "Inicio"));
                }
            }
            catch (ApplicationException x)
            {
                ViewBag.mensaje = x.Message;
                return(RedirectToAction("RegistroVenta", "AsesorVentasCampo", new { mensaje = x.Message, identificador = 1 }));
            }
            catch (Exception e)
            {
                return(RedirectToAction("RegistroVenta", "AsesorVentasCampo", new { mensaje = e.Message, identificador = 2 }));
            }
        }
Example #6
0
        //paso los parametros para la consulta del usuario y permitir su login
        public static entUsuario Login(String usuario, String contrasena)
        {
            entUsuario    obj = null;
            SqlCommand    cmd = null;
            SqlDataReader dr  = null;

            try
            {
                daoConexion   cn  = new daoConexion();
                SqlConnection cnx = cn.conectar();
                cmd = new SqlCommand("SP_VALIDAR_USUARIO", cnx);
                cmd.Parameters.AddWithValue("@usuario", usuario);
                cmd.Parameters.AddWithValue("@clave", contrasena);
                cmd.CommandType = CommandType.StoredProcedure;
                cnx.Open();
                dr  = cmd.ExecuteReader();
                obj = new entUsuario();
                dr.Read();
                obj.id      = Convert.ToInt32(dr["id"].ToString());
                obj.usuario = dr["usuario"].ToString();
                obj.clave   = dr["clave"].ToString();
                obj.nombre  = dr["nombre"].ToString();
            }
            catch (Exception ex)
            {
                //throw ex;
                obj = null;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(obj);
        }
Example #7
0
 public ActionResult Login(FormCollection frm)
 {
     try
     {
         String     Usuario    = frm["Usuario"].ToString();
         String     Contrasena = frm["Contrasena"].ToString();
         String     mensaje;
         entUsuario u = appUsuario.Instancia.VerificarAcceso(Usuario, Contrasena, out mensaje);
         if (mensaje.Equals(""))
         {
             Session["usuario"] = u;
             if (u.Rol.Equals("Administrador") || u.Rol.Equals("Trabajador"))
             {
                 return(RedirectToAction("Main", "Intranet"));
             }
             else if (u.Rol == "Cliente")
             {
                 return(RedirectToAction("Index"));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         else
         {
             ViewBag.mensaje = mensaje;
             return(View());
         }
     }
     catch (Exception e)
     {
         return(RedirectToAction("Index", "Error", new { mensaje = e.Message }));
     }
 }
Example #8
0
        private void btnBuscar_Click(object sender, EventArgs e)//listo creo
        {
            try
            {
                String     valor = txtBuscar.Text;
                entUsuario u     = null;
                u = negSeguridad.Instancia.BuscarUsuario(valor);

                txtnombre.Text       = u.Nombre_Usuario;
                txtUusuario.Text     = u.Nombre_Usuario;
                txtPassword.Text     = u.Password_Usuario;
                txtTelefono.Text     = u.Id_empleado.telefono_empleado;
                txtApepat.Text       = u.Id_empleado.apepat_empelado;
                txtApemat.Text       = u.Id_empleado.apemat_empleado;
                txtDireccion.Text    = u.Id_empleado.direccion_empleado;
                cboRol.SelectedIndex = u.Id_empleado.Id_rol.Id_Rol;

                ControlBotones(true, true, false, true, false, true);
                ac.BloquearText(this.panel1, false);
            }
            catch (ApplicationException ae) {
                MessageBox.Show(ae.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #9
0
        public entUsuario VerificarAcceso(String Usuario, String Password)
        {
            SqlCommand cmd = null;
            entUsuario u   = null;

            try
            {
                SqlConnection cn = Conexion.Instancia.conectar();
                cmd             = new SqlCommand("spVerificarAcceso", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@prmstrUsuario", Usuario);
                cmd.Parameters.AddWithValue("@prmstrPassword", Password);
                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    u               = new entUsuario();
                    u.idUsuario     = Convert.ToInt16(dr["idUsuario"]);
                    u.Nombres       = dr["Nombres"].ToString();
                    u.Apellidos     = dr["Apellidos"].ToString();
                    u.NombreUsuario = dr["NombreUsuario"].ToString();
                    u.ValidoHasta   = Convert.ToDateTime(dr["ValidoHasta"]);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            { cmd.Connection.Close(); }
            return(u);
        }
Example #10
0
        private void btnGuardar_Click(object sender, EventArgs e)//registrar usuario---cmabiar UPS
        {
            try
            {
                int         tipoedicion = 1;
                entUsuario  u           = new entUsuario();
                entEmpleado em          = new entEmpleado();
                entRol      r           = new entRol();
                r.Id_Rol              = Convert.ToInt32(cboRol.SelectedValue);
                em.Id_rol             = r;
                em.Nombre_empleado    = txtnombre.Text;
                em.apepat_empelado    = txtApepat.Text;
                em.apemat_empleado    = txtApemat.Text;
                em.direccion_empleado = txtDireccion.Text;
                em.telefono_empleado  = txtTelefono.Text;
                u.Id_empleado         = em;

                u.Nombre_Usuario   = txtUusuario.Text;
                u.Password_Usuario = txtPassword.Text;

                if (txtUusuario.Text != "")
                {
                    tipoedicion = 2; u.Id_Usuario = 0;
                }                                                                  //modificar: tipo de operacion
                int i = negSeguridad.Instancia.MantenimientoUsuario(u, tipoedicion);
                MessageBox.Show("¡Registro Correcto!", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ControlBotones(true, false, false, false, false, true);
                ac.BloquearText(this.panel1, false);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #11
0
 private void btnEliminar_Click(object sender, EventArgs e)//eliminar usuario-modificar ups
 {
     try
     {
         entUsuario  u  = new entUsuario();
         entEmpleado em = new entEmpleado();
         if (!txtUusuario.Equals(""))
         {
             u.Nombre_Usuario = txtUusuario.Text;
         }
         entRol r = new entRol();
         em.Id_rol     = r;
         u.Id_empleado = em;
         DialogResult res = MessageBox.Show("¿Desea eliminar el usuario seleccionado?", "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (res == DialogResult.Yes)
         {
             int result = negSeguridad.Instancia.MantenimientoUsuario(u, 3);//---
             MessageBox.Show("Usuario Eliminado con éxito", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         ControlBotones(true, false, false, false, false, true);
         ac.BloquearText(this.panel1, false);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #12
0
        public ActionResult InsertarReserva()
        {
            try
            {
                entUsuario u = (entUsuario)Session["usuario"];
                //ViewBag.usuario = u.idCliente.nombreCliente + " " + u.nomUsuario;
                if (u.tipo == true)
                {
                    List <entCliente> listarCliente = logCliente.Instancia.ListarCliente();
                    var lsCliente = new SelectList(listarCliente, "idCliente", "nombreCliente");

                    List <entTipoHabitacion> listarTipoHabitacion = logTipoHabitacion.Instancia.ListarTipoHabitacion();
                    var lsTipoHabitacion = new SelectList(listarTipoHabitacion, "idTipoHabitacion", "DesTipoHabitacion");

                    List <entHabitacion> listarHabitacion = logHabitacion.Instancia.ListarHabitacion();
                    var lsHabitacion = new SelectList(listarHabitacion, "idHabitacion", "numeroHabitacion");

                    ViewBag.ListaCliente        = lsCliente;
                    ViewBag.ListaTipoHabitacion = lsTipoHabitacion;
                    ViewBag.listaHabitacion     = lsHabitacion;
                    return(View());
                }
                else
                {
                    return(RedirectToAction("Index", "Login"));
                }
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
Example #13
0
        public ActionResult InsertarReservaUsuario()
        {
            try
            {
                entUsuario u = (entUsuario)Session["usuario"];
                if (u != null)
                {
                    List <entTipoHabitacion> listarTipoHabitacion = logTipoHabitacion.Instancia.ListarTipoHabitacion();
                    var lsTipoHabitacion = new SelectList(listarTipoHabitacion, "idTipoHabitacion", "DesTipoHabitacion");

                    List <entHabitacion> listarHabitacion = logHabitacion.Instancia.ListarHabitacion();
                    var lsHabitacion = new SelectList(listarHabitacion, "idHabitacion", "numeroHabitacion");

                    ViewBag.ListaTipoHabitacion = lsTipoHabitacion;
                    ViewBag.listaHabitacion     = lsHabitacion;

                    return(View());
                }
                else
                {
                    return(RedirectToAction("Index", "Login"));
                }
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
Example #14
0
        public static entUsuario Login(String usuario, String password)
        {
            entUsuario    obj = null;
            SqlCommand    cmd = null;
            SqlDataReader dr  = null;

            try
            {
                Conexion      cn  = new Conexion();
                SqlConnection cnx = cn.Conectar();
                cmd = new SqlCommand("VerificarUsuario", cnx);
                cmd.Parameters.AddWithValue("@Usuario", usuario);
                cmd.Parameters.AddWithValue("@Password", password);
                cmd.CommandType = CommandType.StoredProcedure;
                cnx.Open();
                dr  = cmd.ExecuteReader();
                obj = new entUsuario();
                dr.Read();
                obj.id       = Convert.ToInt32(dr["id"].ToString());
                obj.Nombre   = dr["Nombre"].ToString();
                obj.Apellido = dr["Apellido"].ToString();
                obj.correo   = dr["correo"].ToString();
                obj.Password = dr["Password"].ToString();
            }
            catch
            {
                obj = null;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(obj);
        }
Example #15
0
        public static int AgregarUsuario(entUsuario obj)
        {
            int        Indicador = 0;
            SqlCommand cmd       = null;

            try
            {
                Conexion      cn  = new Conexion();
                SqlConnection cnx = cn.Conectar();
                cmd = new SqlCommand("UsuarioInsert", cnx);
                cmd.Parameters.AddWithValue("@inNombre", obj.Nombre);
                cmd.Parameters.AddWithValue("@inPassword", obj.Password);
                cmd.Parameters.AddWithValue("@inTipoUsuario", obj.TipoUsuario);
                cmd.CommandType = CommandType.StoredProcedure;
                cnx.Open();
                cmd.ExecuteNonQuery();
                Indicador = 1;
            }
            catch (Exception e)
            {
                Indicador = 0;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(Indicador);
        }
Example #16
0
        public List <entUsuario> ListarUusariosConAsignacionCalls(Int32 user)
        {
            SqlCommand        cmd   = null;
            SqlDataReader     dr    = null;
            List <entUsuario> Lista = null;

            try{
                SqlConnection cn = Conexion.Instancia.Conectar();
                cmd = new SqlCommand("sp_ListaAsLlamadas", cn);
                cmd.Parameters.AddWithValue("@idsuper", user);
                cmd.CommandType = CommandType.StoredProcedure;
                cn.Open();
                dr    = cmd.ExecuteReader();
                Lista = new List <entUsuario>();
                while (dr.Read())
                {
                    entUsuario u = new entUsuario();
                    u.Usu_Id     = Convert.ToInt32(dr["AsiUsu_Usu_Trabajador_Id"]);
                    u.Usu_Codigo = dr["Usu_Codigo"].ToString();

                    entPersona p = new entPersona();
                    p.Per_Nombres   = dr["Per_Nombres"].ToString();
                    p.Per_Apellidos = dr["Per_Apellidos"].ToString();
                    u.Persona       = p;

                    u.Contador = Convert.ToInt32(dr["Asgnadas"]);
                    Lista.Add(u);
                }
            }
            catch (Exception ex) {
                throw ex;
            }finally { cmd.Connection.Close(); }
            return(Lista);
        }
Example #17
0
        public static entUsuario BuscarUsuario(String nombre)
        {
            entUsuario    obj = null;
            SqlCommand    cmd = null;
            SqlDataReader dr  = null;

            try
            {
                Conexion      cn  = new Conexion();
                SqlConnection cnx = cn.Conectar();
                cmd = new SqlCommand("BuscarUsuario", cnx);
                cmd.Parameters.AddWithValue("@inNombre", nombre);
                cmd.CommandType = CommandType.StoredProcedure;
                cnx.Open();
                dr  = cmd.ExecuteReader();
                obj = new entUsuario();
                dr.Read();
                obj.Nombre      = dr["Nombre"].ToString();
                obj.Password    = dr["Password"].ToString();
                obj.ID_Usuario  = Convert.ToInt32(dr["ID_Usuario"].ToString());
                obj.TipoUsuario = dr["TipoUsuario"].ToString();
            }
            catch
            {
                obj = null;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(obj);
        }
Example #18
0
 private void frmBoletaVenta_Load(object sender, EventArgs e)
 {
     try
     {
         CrearGrid();
         ContarItems();
         ac.LlenarCboTipDoc(this.gbCliente);
         ac.LlenarCboMoneda(this.gbCliente);
         ac.LlenarTipoPago(this.gbCliente);
         ControlBotones(true, false, false, false); btnBuscarXid.Enabled = false;
         //txtSubtotal.Text = 0.ToString(); txtDescuento.Text = 0.ToString(); txtTotal.Text = 0.ToString();
         us                 = negSeguridad.Instancia.BuscarUsario("Id", this.id_user.ToString());
         this.id_user       = us.Id_Usuario;
         txtCodUsuario.Text = us.Codigo_Usuario;
         CargarSerie_correlativo();
         btnAnular.Enabled = false;
         int idCliente = LocalBD.Instancia.ReturnIdCliente(0, 0);
         if (idCliente != 0)
         {
             btnBuscarCliente.Enabled = false; btnBuscarXid.Enabled = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #19
0
        public ActionResult GrabarPedido(int tipoPago)
        {
            if (Session["listaMenu"] != null || Session["listaProducto"] != null)
            {
                entUsuario  u  = (entUsuario)Session["usuario"];
                entCliente  c  = appCliente.Instancia.DevolverClienteLogin(u.UsuarioID);
                entTipoPago tp = new entTipoPago();
                tp.TipoPagoID = tipoPago;
                entPedido ped = new entPedido();
                ped.TipoPago   = tp;
                ped.TipoPedido = "Online";
                ped.Cliente    = c;

                List <entMenu> men = (List <entMenu>)Session["listaMenu"];

                List <entDetallePedido> pro = (List <entDetallePedido>)Session["listaProducto"];

                bool inserto = false;
                inserto = appPedido.Instancia.InsertarPedidoOnline(ped, men, pro);

                Session["listaMenu"]     = null;
                Session["listaProducto"] = null;
                return(RedirectToAction("Main", "Pedido"));
            }
            else
            {
                return(View());
            }
        }
 public entUsuario VerificarAcceso(String Usuario, String Password)
 {
     try
     {
         /*if (DateTime.Now.Hour > 23)
          * {
          *  throw new ApplicationException("No puede ingresar a esta hora");
          * }*/
         entUsuario u = datUsuario.Instancia.VerificarAcceso(Usuario, Password);
         if (u != null)
         {
             if (!u.estUsuario)
             {
                 throw new ApplicationException("Usuario ha sido dado de baja");
             }
         }
         else
         {
             throw new ApplicationException("Usuario o Password no Valido");
         }
         return(u);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public ActionResult ListaPedidosAsesoresCampo(Int32 IdAC, Int32 IdEs, String fdesde, String fhasta)
        {
            try
            {
                entUsuario u = (entUsuario)Session["usuario"];
                if (u != null)
                {
                    int    idestado = 0, idasesor = 0;
                    String desde = "", hasta = "";
                    idestado = Convert.ToInt32(IdEs);
                    idasesor = Convert.ToInt32(IdAC);
                    desde    = fdesde.ToString();
                    hasta    = fhasta.ToString();
                    if (Session["ventasAC"] != null)
                    {
                        Session.Remove("ventasAC");
                    }
                    Session["ventasAC"] = negPedido.Instancia.ListaComisiones(idasesor, desde, hasta, idestado);

                    return(PartialView());
                }
                else
                {
                    return(RedirectToAction("Index", "Inicio"));
                }
            }
            catch (Exception e)
            {
                return(RedirectToAction("ListaPedidosAsesoresCampo", "SupervisorInstalaciones", new { mensaje = e.Message, identificador = 2 }));
            }
        }
Example #22
0
        public ActionResult DelSupervisor(FormCollection form)
        {
            try
            {
                entUsuario us = (entUsuario)Session["usuario"];
                if (us != null)
                {
                    String     idUsuDel = form["txtUserId"];
                    Int16      idUser   = Convert.ToInt16(idUsuDel);
                    entUsuario u        = new entUsuario();
                    u.Usu_Id = idUser;
                    //para capturar el usuario en sesion////////////
                    entUsuario user             = (entUsuario)Session["usuario"];
                    String     userModificacion = user.Persona.NombreCompleto;

                    u.Usu_UsuarioModificacion = userModificacion;
                    ///////////////////////////////////////////
                    int i = negUsuario.Instancia.DelBloActSuper(u, 3);
                    return(RedirectToAction("ListaSupervisores", new { mensaje = "Se Elimino Satisfactoriamente", identificador = 3 }));
                }
                else
                {
                    return(RedirectToAction("Index", "Inicio"));
                }
            }
            catch (ApplicationException x)
            {
                ViewBag.mensaje = x.Message;
                return(RedirectToAction("ListaSupervisores", "Gerente", new { mensaje = x.Message, identificador = 1 }));
            }
            catch (Exception e)
            {
                return(RedirectToAction("ListaSupervisores", "Gerente", new { mensaje = e.Message, identificador = 2 }));
            }
        }
Example #23
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         entUsuario u = new entUsuario();
         u.Estado_Usuario = true;
         entSucursal s = new entSucursal();
         if (!txtIdusuario.Equals(""))
         {
             u.Id_Usuario = Convert.ToInt32(txtIdusuario.Text);
         }
         u.sucursal = s;
         entNivelAcceso na = new entNivelAcceso();
         u.nivel_acceso = na;
         DialogResult r = MessageBox.Show("¿Desea eliminar el usuario seleccionado?", "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (r == DialogResult.Yes)
         {
             int result = negSeguridad.Instancia.MantenimientoUsuario(u, 3);
             MessageBox.Show("Se Elimino usuario, paso a Estado: Inactivo", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         ControlBotones(true, false, false, false, false, true);
         ac.BloquearText(this.panel1, false);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #24
0
 public ActionResult DetalleSupervisor(Int32 SuperId)
 {
     try
     {
         entUsuario u = (entUsuario)Session["usuario"];
         if (u != null)
         {
             entUsuario us = negGerente.Instancia.DetalleSupervisor(SuperId);
             return(View(us));
         }
         else
         {
             return(RedirectToAction("Index", "Inicio"));
         }
     }
     catch (ApplicationException x)
     {
         ViewBag.mensaje = x.Message;
         return(RedirectToAction("ListaSupervisores", "Gerente", new { mensaje = x.Message, identificador = 1 }));
     }
     catch (Exception e)
     {
         return(RedirectToAction("ListaSupervisores", "Gerente", new { mensaje = e.Message, identificador = 2 }));
     }
 }
Example #25
0
        public ActionResult VerificarAcceso(FormCollection frm)
        {
            try
            {
                String     Usuario  = frm["txtUsuario"].ToString();
                String     Password = frm["txtPassword"].ToString();
                entUsuario u        = logUsuario.Instancia.VerificarNombreusuarioContrasenausuario(Usuario, Password);

                if (u.Residente != null)
                {
                    if (!u.Estadousuario)
                    {
                        return(RedirectToAction("IniciarSesion",
                                                new { msg = "Su usuario ha sido dado de baja" }));
                    }
                    AccesoController.ResidenteID   = u.Residente.ResidenteID;
                    AccesoController.Nombreusuario = u.Nombreusuario;
                    return(RedirectToAction("Index", "Home", new { }));
                }
                return(RedirectToAction("IniciarSesion", "Acceso"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("IniciarSesion", "Acceso", new { msgError = e.Message }));
            }
        }
Example #26
0
        public ActionResult InsSupervisor(String mensaje, Int16?identificador)
        {
            try
            {
                ViewBag.mensaje       = mensaje;
                ViewBag.identificador = identificador;
                entUsuario u = (entUsuario)Session["usuario"];
                if (u != null)
                {
                    List <entTipoUsuario> t = t = negTipoUsuario.Instancia.ListaTipoUsuarioSupervisores();
                    var lsTipoUsuario       = new SelectList(t, "TipUsu_Id", "TipUsu_Nombre");
                    ViewBag.ListaTipoUsuario = lsTipoUsuario;

                    List <entSucursal> s = negSucursal.Instancia.ListaSucursal();
                    var lsSucursal       = new SelectList(s, "Suc_Id", "Suc_Nombre");
                    ViewBag.ListaSucursal = lsSucursal;

                    return(View());
                }
                else
                {
                    return(RedirectToAction("Index", "Inicio"));
                }
            }
            catch (ApplicationException x)
            {
                ViewBag.mensaje = x.Message;
                return(RedirectToAction("ListaSupervisores", "Gerente", new { mensaje = x.Message, identificador = 1 }));
            }
            catch (Exception e)
            {
                return(RedirectToAction("ListaSupervisores", "Gerente", new { mensaje = e.Message, identificador = 2 }));
            }
        }
 private void btnIngresar_Click_1(object sender, EventArgs e)
 {
     try
     {
         entUsuario Usu = new entUsuario();
         Usu.idUsuario  = auxidUsuario;
         Usu.contrasena = txtContraseña.Text.Trim();
         //Usu.dni = int.Parse(txtDni.Text.Trim());
         Usu.nombre    = txtNombre.Text.Trim();
         Usu.apellidoP = txtAPaterno.Text.Trim();
         Usu.apellidoM = txtAMaterno.Text.Trim();
         Usu.edad      = int.Parse(txtEdad.Text.Trim());
         //if (cbSexo.SelectedItem.ToString() == "FEMENINO")
         //{
         //Usu.sexo = 'F';
         // }
         // else if (cbSexo.SelectedItem.ToString() == "MASCULINO")
         //  {
         //     Usu.sexo = 'M';
         // }
         Usu.telefono  = int.Parse(txtTelefono.Text.Trim());
         Usu.correo    = txtCorreo.Text.Trim();
         Usu.habilitar = true;
         logUsuario.Instancia.EditarUsuario(Usu);
         this.Hide();
         refCMostrarUsuario.abrir();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #28
0
        public static int ModificarUsuario(entUsuario obj, string nombreviejo, string passwordvieja)
        {
            int        Indicador = 0;
            SqlCommand cmd       = null;

            try
            {
                Conexion      cn  = new Conexion();
                SqlConnection cnx = cn.Conectar();
                cmd = new SqlCommand("UsuarioUpdateB", cnx);
                cmd.Parameters.AddWithValue("@inNombre", nombreviejo);
                cmd.Parameters.AddWithValue("@inPassword", passwordvieja);
                cmd.Parameters.AddWithValue("@inNewName", obj.Nombre);
                cmd.Parameters.AddWithValue("@inNewPassword", obj.Password);
                cmd.Parameters.AddWithValue("@inTipoUsuario", obj.TipoUsuario);
                cmd.CommandType = CommandType.StoredProcedure;
                cnx.Open();
                cmd.ExecuteNonQuery();
                Indicador = 1;
            }
            catch (Exception e)
            {
                Indicador = 0;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(Indicador);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["cliente"] != null)
                {
                    entUsuario c = (entUsuario)Session["cliente"];
                    lblNombres.Text      = c.UsuarioNombres;
                    lblNombre.Text       = c.UsuarioNombres;
                    lblApellidos.Text    = c.UsuarioApellidos;
                    lblApellido.Text     = c.UsuarioApellidos;
                    lblDni.Text          = c.UsuarioDNI;
                    lblLimiteLibros.Text = c.UsuarioLimiteLibros.ToString();
                }
            }

            try
            {
                lsvAutores.DataSource = negAutores.Instancia.ListarAutores();
                lsvAutores.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(@"<script languaje='javascript'>alert('" + ex + "');</script>");
            }
        }
Example #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            entUsuario obj0         = (entUsuario)Session["nombre"];
            int        ID_Propiedad = Convert.ToInt32(Request.QueryString["ID_Propiedad"]);

            if (obj0 != null)
            {
                if (Request.QueryString["ID_Propiedad"] != null)
                {
                    entProUsuario obj2 = negProUsuario.BuscarProUsuario(ID_Propiedad, obj0.ID_Usuario);
                    if (obj2 != null)
                    {
                        GridView1.DataSource = negRecibos.ListarRecibosPagos(ID_Propiedad);
                        GridView1.DataBind();
                    }
                    else
                    {
                        lblerror.Text    = "Dicha Propiedad no corresponde a este usuario";
                        lblerror.Visible = true;
                    }
                }
                else
                {
                    lblerror.Text    = "Error al buscar el ID de la propiedad";
                    lblerror.Visible = true;
                }
            }
            else
            {
                lblerror.Text    = "Esta vacio el objeto";
                lblerror.Visible = true;
            }
        }