Ejemplo n.º 1
0
        private void RescatarPedidos()
        {
            lblGarzon.Text = ContraseñaAdmin.contraseñaAdmin;
            lblMesa.Text   = e;
            seguardo       = true;
            NegocioMesa me  = new NegocioMesa();
            Mesa        mes = me.buscarMesa(int.Parse(lblMesa.Text));

            HoraL.Text = mes._llegada;

            NegocioCuenta cu = new NegocioCuenta();

            mostrar = cu.getCuentaxMesa(mes._ID_Mesa).GetEnumerator();
            bool borrarprimero = true;

            while (mostrar.MoveNext())
            {
                Cuenta cli = (Cuenta)mostrar.Current;
                if (borrarprimero == true)
                {
                    tcCuentas.TabPages.Clear();
                }
                agregarCuenta(cli._nombre, cli._ID_Cuenta);
                cuentas.Add(cli._ID_Cuenta);
                borrarprimero = false;
            }
        }
Ejemplo n.º 2
0
        public ActionResult DetalleCuenta()
        {
            var integ = new IntegridadDatos();

            if ((String)Session["PerfilUsuario"] != null && integ.ValidarExistencia("SEG_Usuario") == 1)
            {
                try
                {
                    var ln = new NegocioCuenta();

                    var idUsuario = (String)Session["IdUsuario"];

                    // Traduce páginas de CUENTA.
                    TraducirPagina((String)Session["IdiomaApp"]);

                    return(View(ln.InformacionCuenta(idUsuario)));
                }
                catch
                {
                    var aud = new Auditoria();
                    aud.grabarBitacora(DateTime.Now, "SISTEMA", "ERROR CUENTA", "ERROR LEVE", "Error al consultar el detalle de cuenta.");
                    return(RedirectToAction("Index", "Home"));
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
        // GET: Excepciones
        public ActionResult Index()
        {
            var ln = new NegocioCuenta();

            TraducirPagina((String)Session["IdiomaApp"]);

            var criticidad = "LEVE";

            if ((String)Session["UsrLogin"] == null || (String)Session["UsrLogin"] == "")
            {
                Session["UsrLogin"] = "******";
                criticidad          = "GRAVE";
            }

            var aud = new Auditoria();

            aud.grabarBitacora(DateTime.Now, (String)Session["UsrLogin"], "EXCEPCIÓN", criticidad, (String)Session["Excepcion"]);

            ln.ActivarCuentaUsuario((String)Session["UsrLogin"]);

            Session["IdUsuario"]          = null;
            Session["NombreUsuario"]      = null;
            Session["PerfilUsuario"]      = null;
            Session["EmailUsuario"]       = null;
            Session["CodUsuario"]         = null;
            Session["DireccionUsuario"]   = null;
            Session["RazonSocialUsuario"] = null;

            Session["UsrLogin"] = null;

            Session["ErrorLogin"] = null;

            return(View());
        }
Ejemplo n.º 4
0
        protected void btnConsulta_Click(object sender, EventArgs e)
        {
            Reportes        reportes        = new Reportes();
            NegocioCuenta   negocioCuenta   = new NegocioCuenta();
            NegocioEmpleado negocioEmpleado = new NegocioEmpleado();
            int             id = negocioEmpleado.retornarDepartamentoByRut(negocioEmpleado.retornarRutByCuentaID(negocioCuenta.retornarID(Session["usuario"].ToString())));

            foreach (var item in reportes.reportePorTipoPermisoDeUnidadInterna(id))
            {
                TableRow  tableRow     = new TableRow();
                TableCell nombreUnidad = new TableCell();
                TableCell tipoPermiso  = new TableCell();
                TableCell cantidad     = new TableCell();
                tablaEstadoPermisos.Rows.Add(tableRow);
                nombreUnidad.Text = item.nombreUnidad;
                tipoPermiso.Text  = item.nombreTipoPermiso;
                cantidad.Text     = item.cantidadPermisos.ToString();

                tableRow.Cells.Add(nombreUnidad);
                tableRow.Cells.Add(tipoPermiso);
                tableRow.Cells.Add(cantidad);
            }

            this.containerTabla.Attributes.Remove("hidden");
        }
Ejemplo n.º 5
0
        public ActionResult VerPermisosUsuario(int idUsr)
        {
            var integ = new IntegridadDatos();

            if ((String)Session["PerfilUsuario"] == "WebMaster" && integ.ValidarExistencia("SEG_Permisos") == 1 && integ.ValidarExistencia("SEG_DetallePermisos") == 1)
            {
                try
                {
                    var ln = new NegocioCuenta();

                    // Traduce páginas de CUENTA.
                    TraducirPagina((String)Session["IdiomaApp"]);

                    return(View(ln.VerDetallePermisosUsuario(idUsr)));
                }
                catch
                {
                    var aud = new Auditoria();
                    aud.grabarBitacora(DateTime.Now, "SISTEMA", "ERROR PERMISOS", "ERROR LEVE", "Error al consultar los permisos de usuario.");
                    return(RedirectToAction("Index", "Home"));
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult Index()
        {
            var integ = new IntegridadDatos();

            if ((String)Session["PerfilUsuario"] == "Administrativo" && integ.ValidarExistencia("SEG_Usuario") == 1)
            {
                try
                {
                    var ln = new NegocioCuenta();

                    //Traducir Página CLientes.
                    TraducirPagina((String)Session["IdiomaApp"]);

                    var consulta = ln.ListarUsuariosPorPerfil(3);

                    Session["ConsultaBitacora"] = consulta;

                    return(View(consulta));
                }

                catch
                {
                    var aud = new Auditoria();
                    aud.grabarBitacora(DateTime.Now, "SISTEMA", "ERROR CLIENTES", "ERROR LEVE", "Error al consultar clientes.");
                    return(RedirectToAction("Index", "Home"));
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 7
0
        public ActionResult Index()
        {
            if ((String)Session["PerfilUsuario"] != null)
            {
                var aud = new Auditoria();

                var ln = new NegocioCuenta();

                aud.grabarBitacora(DateTime.Now, (String)Session["UsrLogin"], "CIERRE DE SESIÓN", "INFO", "El Usuario ha cerrado sesión.");

                //ln.ActivarCuentaUsuario((String)Session["UsrLogin"]);

                Session["ItemsCarrito"] = 0;

                Session["ErrorLogin"]       = null;
                Session["IdUsuario"]        = null;
                Session["NombreUsuario"]    = null;
                Session["PerfilUsuario"]    = null;
                Session["EmailUsuario"]     = null;
                Session["DireccionUsuario"] = null;

                Session["UsrLogin"] = null;

                Session["ErrorLogin"] = null;
                Session["Excepcion"]  = null;
            }

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 8
0
        public ActionResult ListarUsuarios()
        {
            var integ = new IntegridadDatos();

            if ((String)Session["PerfilUsuario"] == "WebMaster" && integ.ValidarExistencia("SEG_Usuario") == 1)
            {
                try
                {
                    var ln = new NegocioCuenta();

                    // Traduce páginas de CUENTA.
                    TraducirPagina((String)Session["IdiomaApp"]);

                    return(View(ln.ListarUsuarios()));
                }
                catch
                {
                    var aud = new Auditoria();
                    aud.grabarBitacora(DateTime.Now, "SISTEMA", "ERROR USUARIO", "ERROR LEVE", "Error al consultar los Usuarios.");
                    return(RedirectToAction("Index", "Home"));
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 9
0
        private void guardarexistente()
        {
            try
            {
                int iddecuenta = 0;

                NegocioCuenta_Producto cue  = new NegocioCuenta_Producto();
                NegocioCuenta          cu   = new NegocioCuenta();
                NegocioProducto        prod = new NegocioProducto();

                foreach (int item in cuentas)
                {
                    iddecuenta = item;
                    Cuenta    cuent = cu.buscarCuenta(iddecuenta);
                    ArrayList cep   = cue.getCuenta_ProductoxCuenta1(cuent._ID_Cuenta);

                    foreach (Cuenta_Producto cp in cep)
                    {
                        cue.eliminarCuenta_Producto(cp._ID_Lista);
                    }

                    cu.eliminarCuenta(cuent._ID_Cuenta);
                }
                Grabar();
            }
            catch
            {
                MessageBox.Show("Error de sobreescribir asegurece de que" +
                                "todos los datos fueron ingresados correctamente.", "Error de comanda", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["funcionario"] == null)
                {
                    FormsAuthentication.SignOut();
                    Response.Redirect("../../Default.aspx");
                }
                else
                {
                    NegocioEmpleado  negocioEmpleado  = new NegocioEmpleado();
                    NegocioSolicitud negocioSolicitud = new NegocioSolicitud();
                    NegocioCuenta    negocioCuenta    = new NegocioCuenta();

                    string usuario = Session["usuario"].ToString();
                    string rut     = negocioEmpleado.retornarRutByCuentaID(negocioCuenta.retornarID(usuario));

                    if (negocioSolicitud.listadoFiltradoByID(rut).Count > 0)
                    {
                        cargarListado(rut);
                        containerTabla.Attributes.Remove("hidden");
                    }
                    else
                    {
                        cargarDialogo();
                    }
                }
            }
        }
Ejemplo n.º 11
0
        protected void btnFinalizarPermiso_Click(object sender, EventArgs e)
        {
            Solicitud        newSolicitud     = new Solicitud();
            NegocioSolicitud negocioSolicitud = new NegocioSolicitud();
            NegocioEmpleado  negocioEmpleado  = new NegocioEmpleado();
            NegocioCuenta    negocioCuenta    = new NegocioCuenta();
            string           cuenta           = Session["usuario"].ToString();

            newSolicitud.idSolicitud = negocioSolicitud.listado().Count + 1;

            var codigo = string.Concat(DateTime.Now.ToString("yyyyMMdd"), newSolicitud.idSolicitud);


            newSolicitud.codigoDocumento = string.Concat(DateTime.Now.ToString("yyyyMMdd"), newSolicitud.idSolicitud);
            newSolicitud.idTipoPermiso   = Convert.ToInt32(cmbTipoPermiso.SelectedItem.Value);
            newSolicitud.descripcion     = txtDetalleSolicitud.Text;
            newSolicitud.fechaSolicitud  = DateTime.Today;
            newSolicitud.fechaInicio     = Convert.ToDateTime(txtDate1.Text, CultureInfo.InvariantCulture);
            newSolicitud.fechaTermino    = Convert.ToDateTime(txtDate2.Text, CultureInfo.InvariantCulture);
            newSolicitud.idEstado        = 4;
            newSolicitud.rutAutorizante  = "";
            newSolicitud.rutSolicitante  = negocioEmpleado.retornarRutByCuentaID(negocioCuenta.retornarID(cuenta));
            newSolicitud.idMotivo        = Convert.ToInt32(cmbMotivo.SelectedItem.Value);

            if (negocioSolicitud.crearSolicitud(newSolicitud))
            {
                limpiarFormulario();
            }

            txtCod.Text = codigo;
            envioCorre(newSolicitud);
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", script, false);
        }
Ejemplo n.º 12
0
        private void btnDeshacerComanda_Click(object sender, EventArgs en)
        {
            bool eliminar = deshacerComanda();

            if (eliminar != false)
            {
                lblGarzon.Text = ContraseñaAdmin.contraseñaAdmin;
                lblMesa.Text   = e;
                NegocioMesa me  = new NegocioMesa();
                Mesa        mes = me.buscarMesa(int.Parse(lblMesa.Text));

                HoraL.Text = horaLlegada.ToString();

                NegocioCuenta cu = new NegocioCuenta();
                mostrar = cu.getCuentaxMesa(mes._ID_Mesa).GetEnumerator();
                while (mostrar.MoveNext())
                {
                    Cuenta cli = (Cuenta)mostrar.Current;
                    if (mostrar == null)
                    {
                        tcCuentas.TabPages.Clear();
                    }
                }
                Pagar.cerrarmesa = true;
            }
            this.Close();
        }
Ejemplo n.º 13
0
        public ActionResult Index(string fecha, string fechaFin, string usr)
        {
            var integ = new IntegridadDatos();

            if ((String)Session["PerfilUsuario"] == "Administrativo" && integ.ValidarExistencia("SEG_Usuario") == 1)
            {
                try
                {
                    var ln = new NegocioCuenta();

                    //Traducir Página CLIENTE.
                    TraducirPagina((String)Session["IdiomaApp"]);

                    Session["ErrorFiltroCliente"] = null;

                    if (fecha == "" && fechaFin != "")
                    {
                        fechaFin = "";

                        Session["ErrorFiltroCliente"] = ViewBag.BITACORA_WARNING_SIN_FECHA_INICIO;
                    }

                    if (fecha != "" && fechaFin != "")
                    {
                        DateTime fechaDate = DateTime.Parse(fecha);

                        DateTime fechaFinDate = DateTime.Parse(fechaFin);

                        if (fechaDate >= fechaFinDate)
                        {
                            fecha    = "";
                            fechaFin = "";

                            Session["ErrorFiltroCliente"] = ViewBag.BITACORA_WARNING_FECHAS_MAL;
                        }
                    }

                    if (fecha == "" && usr == "")
                    {
                        return(View(ln.ListarUsuariosPorPerfil(3)));
                    }

                    var consulta = ln.ListarClientesPorFiltro(fecha, fechaFin, usr);

                    Session["ConsultaCliente"] = consulta;

                    return(View(consulta));
                }
                catch
                {
                    var aud = new Auditoria();
                    aud.grabarBitacora(DateTime.Now, "SISTEMA", "ERROR CLIENTES", "ERROR LEVE", "Error al consultar los clientes.");
                    return(RedirectToAction("Index", "Home"));
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 14
0
        private void cargarListado(string rut)
        {
            NegocioSolicitud negocioSolicitud = new NegocioSolicitud();
            NegocioCuenta    negocioCuenta    = new NegocioCuenta();
            NegocioEmpleado  negocioEmpleado  = new NegocioEmpleado();

            foreach (var item in negocioSolicitud.listadoFiltradoByID(rut))
            {
                TableRow  tableRow        = new TableRow();
                TableCell codigoDocumento = new TableCell();
                TableCell descripcion     = new TableCell();
                TableCell fechaSolicitud  = new TableCell();
                TableCell fechaInicio     = new TableCell();
                TableCell fechaTermino    = new TableCell();
                TableCell tipoPermiso     = new TableCell();
                TableCell rutAutorizador  = new TableCell();
                TableCell rutSolicitante  = new TableCell();
                TableCell estado          = new TableCell();
                TableCell motivo          = new TableCell();
                TableCell nombre          = new TableCell();
                tablaEstadoPermisos.Rows.Add(tableRow);
                codigoDocumento.Text = item.codigoDocumento;
                descripcion.Text     = item.descripcion;
                fechaSolicitud.Text  = item.fechaSolicitud.ToString("dd/MM/yyyy");
                fechaInicio.Text     = item.fechaInicio.ToString("dd/MM/yyyy");
                fechaTermino.Text    = item.fechaTermino.ToString("dd/MM/yyyy");
                tipoPermiso.Text     = retornarTipoPermiso(item.idTipoPermiso);
                rutSolicitante.Text  = item.rutSolicitante.ToString();
                if (item.rutAutorizante == null || item.rutAutorizante.ToString() == "")
                {
                    rutAutorizador.Text = "Sin asignar";
                }
                else
                {
                    rutAutorizador.Text = item.rutAutorizante.ToString();
                }
                estado.Text = retornarEstado(item.idEstado);
                motivo.Text = retornarMotivo(item.idMotivo);
                nombre.Text = retornarNombreByRut(item.rutSolicitante);
                nombre.Attributes.Add("hidden", "true");
                tableRow.ID = item.idSolicitud.ToString();
                tableRow.Attributes.Add("onClick", "modalTabla(this.id)");

                tableRow.Cells.Add(codigoDocumento);
                tableRow.Cells.Add(descripcion);
                tableRow.Cells.Add(fechaSolicitud);
                tableRow.Cells.Add(fechaInicio);
                tableRow.Cells.Add(fechaTermino);
                tableRow.Cells.Add(tipoPermiso);
                tableRow.Cells.Add(motivo);
                tableRow.Cells.Add(rutSolicitante);
                tableRow.Cells.Add(rutAutorizador);
                tableRow.Cells.Add(estado);
                tableRow.Cells.Add(nombre);
            }
        }
Ejemplo n.º 15
0
        private string retornarRutAutorizador()
        {
            string          rut             = string.Empty;
            string          usuario         = Session["usuario"].ToString();
            NegocioCuenta   negocioCuenta   = new NegocioCuenta();
            NegocioEmpleado negocioEmpleado = new NegocioEmpleado();

            rut = negocioEmpleado.retornarRutByCuentaID(negocioCuenta.retornarID(usuario));
            return(rut);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ClientScript.GetPostBackEventReference(this, "");
            if (!IsPostBack)
            {
                if (Session["jefeSuperior"] == null)
                {
                    FormsAuthentication.SignOut();
                    Response.Redirect("../../Default.aspx");
                }

                NegocioDepartamento negocioDepartamento = new NegocioDepartamento();
                NegocioEmpleado     negocioEmpleado     = new NegocioEmpleado();
                NegocioCuenta       negocioCuenta       = new NegocioCuenta();
                NegocioUnidad       negocioUnidad       = new NegocioUnidad();
                string user = Session["usuario"].ToString();
                cmbUnidad.Items.Add(new ListItem {
                    Value = "0", Text = "- Seleccione -"
                });
                cmbAño.Items.Add(new ListItem {
                    Value = "0", Text = "- Seleccione -"
                });
                cmbMes.Items.Add(new ListItem {
                    Value = "0", Text = "- Seleccione -"
                });
                cmbMes.Items.Add(new ListItem {
                    Value = DateTime.Now.AddMonths(-1).ToString("MM"), Text = DateTime.Now.AddMonths(-1).ToString("MMMM", CultureInfo.CurrentUICulture)
                });
                int año = Convert.ToInt32(DateTime.Now.ToString("yyyy"));
                cmbAño.Items.Add(new ListItem {
                    Value = (año).ToString(), Text = (año).ToString()
                });
                int unidad = negocioDepartamento.retornarUnidadByDepartamento(negocioEmpleado.retornarDepartamentoByRut(negocioEmpleado.retornarRutByCuentaID(negocioCuenta.retornarID(user))));
                foreach (var item in negocioDepartamento.listado())
                {
                    if (item.idUnidad == unidad)
                    {
                        if (!item.nombreDepartamento.Equals("Solo Unidad"))
                        {
                            cmbUnidad.Items.Add(new ListItem {
                                Value = item.idDepartamento.ToString(), Text = item.nombreDepartamento
                            });
                        }
                    }
                }
            }

            if (Request["__EVENTTARGET"] == "limpiar")
            {
                limpiar();
            }
        }
Ejemplo n.º 17
0
        private void cargarActivosGrid()
        {
            NegocioCuenta   negC  = new NegocioCuenta();
            NegocioMuestra  negE  = new NegocioMuestra();
            List <Object[]> lista = negE.getAllActivos();

            this.dgvActivos.Rows.Clear();
            foreach (Object[] ob in lista)
            {
                ob[4] = negC.getNombreCuenta(ob[4].ToString()) + " (" + ob[4] + ")";
                this.dgvActivos.Rows.Add(ob[0], ob[1], ob[2], ob[3], ob[4], ob[5], ob[6], ob[7], ob[8]);
            }
        }
Ejemplo n.º 18
0
        private void rellenarGrilla()
        {
            //this.dgvProducto.Rows.Insert
            NegocioCuenta negC = new NegocioCuenta();

            prod.CUENTA = negC.getNombreCuenta(prod.CUENTA) + " (" + prod.CUENTA + ")";


            this.dgvProducto.Rows.Add(prod.NOMBRE,
                                      prod.PROVEEDOR_NOMBRE,
                                      prod.TIPOEQUIPAMIENTO_NOMBRE,
                                      prod.CUENTA,
                                      prod.CODIGOMC,
                                      prod.CODIGOPRELUDE);
        }
Ejemplo n.º 19
0
        private void cargarCuentas()
        {
            NegocioCuenta negC = new NegocioCuenta();


            List <Cuenta> lista = negC.getListaCuentas();

            this.cmbCuenta.Items.Clear();
            this.cmbCuenta.Items.Add("Seleccione...");
            this.cmbCuenta.SelectedIndex = 0;
            foreach (Cuenta ss in lista)
            {
                this.cmbCuenta.Items.Add(ss.NOMBRE + " (" + ss.NUMERO + ")");
            }
        }
Ejemplo n.º 20
0
        private void btnBuscarMC_Click(object sender, EventArgs e)
        {
            NegocioProducto NegP = new NegocioProducto();
            NegocioCuenta   negC = new NegocioCuenta();
            Producto        p    = NegP.getProductoMcelroy(this.txtBuscarNombre.Text.Trim(), this.txtBuscarCodMc.Text.Trim());

            if (NegP.existeProducto(this.txtBuscarCodMc.Text, this.txtBuscarCodPrelude.Text) == false)
            {
                MessageBox.Show(this, "No se encontraron resultados", "Error, no hay resultados");
                return;
            }
            ResultadoBusqueda rs = new ResultadoBusqueda(p, "ingresarExistencia");

            rs.StartPosition = FormStartPosition.CenterScreen;
            rs.ShowDialog();
        }
Ejemplo n.º 21
0
        private void rellenarGrilla()
        {
            NegocioCuenta   negC  = new NegocioCuenta();
            NegocioProducto negP  = new NegocioProducto();
            List <Producto> lista = negP.getListaTodosProductos();

            this.dgvProducto.Rows.Clear();


            foreach (Producto prod in lista)
            {
                this.dgvProducto.Rows.Add(prod.NOMBRE, prod.PROVEEDOR_NOMBRE,
                                          prod.TIPOEQUIPAMIENTO_NOMBRE,
                                          prod.CUENTA = negC.getNombreCuenta(prod.CUENTA) + " (" + prod.CUENTA + ")",
                                          prod.CODIGOMC,
                                          prod.CODIGOPRELUDE);
            }
        }
Ejemplo n.º 22
0
        public ActionResult SacarPermiso(int idDetallePermiso)
        {
            var integ = new IntegridadDatos();

            if ((String)Session["PerfilUsuario"] == "WebMaster" && integ.ValidarExistencia("SEG_DetallePermisos") == 1)
            {
                var ln = new NegocioCuenta();

                var detalleModificado = ln.SacarPermiso(idDetallePermiso);

                var aud = new Auditoria();
                aud.grabarBitacora(DateTime.Now, (String)Session["UsrLogin"], "PERMISOS", "INFO", "El usuario ha quitado el permiso: " + idDetallePermiso.ToString());


                return(RedirectToAction("VerPermisosUsuario", new { idUsr = detalleModificado.UsrId }));
            }

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 23
0
        public ActionResult RegistrarUsuarioWebMaster(FrmRegistroWebMaster registroWebMaster)
        {
            //try
            //{
            Session["Excepcion"] = "";

            var ln = new NegocioCuenta();

            var usuario = new Usuario();

            //Características de "WebMaster".
            usuario.Nombre   = registroWebMaster.Nombre;
            usuario.Apellido = registroWebMaster.Apellido;
            usuario.Email    = registroWebMaster.Email;
            usuario.Usr      = registroWebMaster.Usr;
            usuario.Psw      = registroWebMaster.Psw;

            usuario.Estado    = "S";
            usuario.FechaAlta = DateTime.Now;
            usuario.FechaBaja = new DateTime(2000, 01, 01);

            usuario.Direccion   = "N/A";
            usuario.CUIL        = "N/A";
            usuario.Telefono    = "N/A";
            usuario.RazonSocial = "N/A";

            usuario.Idioma = new Idioma {
                Id = 1, Descripcion = "Español", Abreviacion = "Esp"
            };
            usuario.PerfilUsr = new PerfilUsr {
                Id = 1, Descripcion = "WebMaster"
            };
            usuario.Localidad = new Localidad {
                Id = 1, Descripcion = "Implantagraf"
            };

            // Registro Usuario.
            var usrWebMaster = ln.RegistrarUsuario(usuario);

            ln.OtorgarPermisosWebmaster(usrWebMaster.Id);

            return(RedirectToAction("Index"));
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["jefeSuperior"] == null)
         {
             FormsAuthentication.SignOut();
             Response.Redirect("../../Default.aspx");
         }
         NegocioDepartamento negocioDepartamento = new NegocioDepartamento();
         NegocioEmpleado     negocioEmpleado     = new NegocioEmpleado();
         NegocioCuenta       negocioCuenta       = new NegocioCuenta();
         NegocioUnidad       negocioUnidad       = new NegocioUnidad();
         string user = Session["usuario"].ToString();
         cmbUnidad.Items.Add(new ListItem {
             Value = "0", Text = "- Seleccione -"
         });
         cmbAño.Items.Add(new ListItem {
             Value = "0", Text = "- Seleccione -"
         });
         int unidad = negocioDepartamento.retornarUnidadByDepartamento(negocioEmpleado.retornarDepartamentoByRut(negocioEmpleado.retornarRutByCuentaID(negocioCuenta.retornarID(user))));
         foreach (var item in negocioDepartamento.listado())
         {
             if (item.idUnidad == unidad)
             {
                 if (!item.nombreDepartamento.Equals("Solo Unidad"))
                 {
                     cmbUnidad.Items.Add(new ListItem {
                         Value = item.idDepartamento.ToString(), Text = item.nombreDepartamento
                     });
                 }
             }
         }
         for (int i = 0; i < 9; i++)
         {
             int año = Convert.ToInt32(DateTime.Now.ToString("yyyy"));
             cmbAño.Items.Add(new ListItem {
                 Value = (año - i).ToString(), Text = (año - i).ToString()
             });
         }
     }
 }
Ejemplo n.º 25
0
        public ActionResult ActualizarPsw(FrmCambiarPsw frmCambioPsw)
        {
            if (frmCambioPsw.NuevaPsw == null)
            {
                frmCambioPsw.NuevaPsw = frmCambioPsw.NuevaPsw_Eng;
            }

            var negocioUsuario = new NegocioCuenta();
            var servicioCorreo = new Mensajeria();

            // Traduce páginas de CUENTA.
            TraducirPagina((String)Session["IdiomaApp"]);

            negocioUsuario.ActualizarPswUsuario((String)Session["UsrLogin"], frmCambioPsw.NuevaPsw);

            try
            {
                if ((String)Session["IdiomaApp"] == "Esp" || (String)Session["IdiomaApp"] == null)
                {
                    var asuntoMsj = "Cambio de Contraseña";
                    var cuerpoMsj = "Se ha cambiado su contraseña. Si usted no solicitó este cambio por favor contacte con un administrador. Muchas gracias.";
                    servicioCorreo.EnviarCorreo("*****@*****.**", (String)Session["EmailUsuario"], asuntoMsj, cuerpoMsj);
                }
                else
                {
                    var asuntoMsj = "Psw Changed";
                    var cuerpoMsj = "Your Psw has been changed. If you don't ask for that change, please contact an admin. Thank you very much.";
                    servicioCorreo.EnviarCorreo("*****@*****.**", (String)Session["EmailUsuario"], asuntoMsj, cuerpoMsj);
                }
            }
            catch
            {
                var audi = new Auditoria();
                audi.grabarBitacora(DateTime.Now, "SISTEMA", "ERROR CAMBIO CLAVE", "ERROR LEVE", "Error al intentar cambiar la PSW.");
                return(RedirectToAction("Index", "Home"));
            }

            return(View());
        }
Ejemplo n.º 26
0
        public ActionResult DesbloquearCuenta(int id)
        {
            var integ = new IntegridadDatos();

            if ((String)Session["PerfilUsuario"] == "WebMaster" && integ.ValidarExistencia("SEG_Usuario") == 1)
            {
                var ln = new NegocioCuenta();

                ln.DesbloquearCuenta(id);

                // Traduce páginas de CUENTA.
                TraducirPagina((String)Session["IdiomaApp"]);

                var aud = new Auditoria();
                aud.grabarBitacora(DateTime.Now, (String)Session["UsrLogin"], "DESBLOQUEO", "INFO", "El usuario ha desbloqueado la cuenta: " + id.ToString());


                return(View());
            }

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 27
0
        public ActionResult Index()

        {
            var integ = new IntegridadDatos();

            if ((String)Session["PerfilUsuario"] == null && integ.ValidarExistencia("SEG_Usuario") == 1 && integ.ValidarExistencia("Idioma") == 1 && integ.ValidarExistencia("Localidad") == 1 && integ.ValidarExistencia("SEG_PerfilUsr") == 1 && integ.ValidarExistencia("SEG_Permisos") == 1 && integ.ValidarExistencia("SEG_DetallePermisos") == 1)
            {
                try
                {
                    var ln = new NegocioCuenta();

                    return(View(ln.ListarUsuariosPorPerfil(1)));
                }
                catch
                {
                    Session["Excepcion"] = "Error al Listar los UsuariosWebMasters.";
                    return(RedirectToAction("Index", "Excepciones"));
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 28
0
        private void btnPagar_Click(object sender, EventArgs er)
        {
            NegocioCuenta negcue = new NegocioCuenta();

            cuentas = negcue.getCuentaxMesa(int.Parse(e));
            if (cuentas.Count != 0)
            {
                Pagar pag = new Pagar();
                pag.ShowDialog();
                if (Pagar.cerrarmesa == true)
                {
                    NegocioMesa negme = new NegocioMesa();

                    Mesa me = negme.buscarMesa(int.Parse(e));
                    me._estado  = 1;
                    me._estadia = "00:00:00";
                    me._llegada = "00:00:00";
                    me._salida  = "00:00:00";
                    negme.modificarMesa(me);
                }
                this.Close();
            }
        }
Ejemplo n.º 29
0
        public ActionResult EnviarNuevaPsw(FrmOlvidoPsw formularioCambioPsw)
        {
            if (formularioCambioPsw.Usuario == null)
            {
                formularioCambioPsw.Usuario = formularioCambioPsw.Usuario_Eng;
            }

            var negocioUsuario = new NegocioCuenta();

            // Traduce páginas de CUENTA.
            TraducirPagina((String)Session["IdiomaApp"]);

            if (negocioUsuario.ValidarUsuario(formularioCambioPsw.Usuario))
            {
                if ((String)Session["IdiomaApp"] == "Esp" || (String)Session["IdiomaApp"] == null)
                {
                    Session["ErrorRecuperoPsw"] = "El Usuario que ingreso es inválido.";
                }
                else
                {
                    Session["ErrorRecuperoPsw"] = "Invalid User.";
                }

                return(RedirectToAction("RecuperarPsw"));
            }

            var servicioCorreo = new Mensajeria();

            var usuarioActual = negocioUsuario.BuscarUsuarioPorUsuario(formularioCambioPsw.Usuario);

            negocioUsuario.ActualizarPswUsuario(usuarioActual.Usr, "Inicio1234");

            var aud = new Auditoria();

            aud.grabarBitacora(DateTime.Now, usuarioActual.Usr, "BLANQUEO PSW", "INFO", "El usuario ha pedido nueva clave.");


            try
            {
                if ((String)Session["IdiomaApp"] == "Esp" || (String)Session["IdiomaApp"] == null)
                {
                    var asuntoMsj = "Cambio de Contraseña";
                    var cuerpoMsj = "Se ha reestablecido su contraseña. La misma es 'Inicio1234'. Por favor cuando ingrese correctamente se recomienda cambiarla. Muchas gracias.";
                    servicioCorreo.EnviarCorreo("*****@*****.**", usuarioActual.Email, asuntoMsj, cuerpoMsj);
                }
                else
                {
                    var asuntoMsj = "PSW Changed";
                    var cuerpoMsj = "Your Psw has been changed. The new one is 'Inicio1234'. Please when you Login again for the first time chage it. Thank you very much.";
                    servicioCorreo.EnviarCorreo("*****@*****.**", usuarioActual.Email, asuntoMsj, cuerpoMsj);
                }
            }
            catch
            {
                var audi = new Auditoria();
                audi.grabarBitacora(DateTime.Now, "SISTEMA", "ERROR CAMBIO CLAVE", "ERROR LEVE", "Error al intentar cambiar la PSW.");
                return(RedirectToAction("Index", "Home"));
            }

            return(View());
        }
Ejemplo n.º 30
0
        public ActionResult ActualizarDatosCuenta(Usuario usuarioModif)
        {
            var integ = new IntegridadDatos();

            if ((String)Session["PerfilUsuario"] != null && integ.ValidarExistencia("SEG_Usuario") == 1)
            {
                try
                {
                    var ln   = new NegocioCuenta();
                    var aud  = new Auditoria();
                    var inte = new IntegridadDatos();
                    var priv = new Privacidad();

                    // Traduce páginas de CUENTA.
                    TraducirPagina((String)Session["IdiomaApp"]);

                    var usrAnterior = ln.InformacionCuenta(usuarioModif.Id.ToString());

                    if (usuarioModif.Direccion == null && usuarioModif.Telefono == null && usuarioModif.Localidad.Id == 0 && usuarioModif.Idioma.Id == 0)
                    {
                        return(RedirectToAction("Index"));
                    }

                    if (usuarioModif.Direccion == null)
                    {
                        usuarioModif.Direccion = usrAnterior.Direccion;
                    }


                    if (usuarioModif.Telefono == null)
                    {
                        usuarioModif.Telefono = usrAnterior.Telefono;
                    }


                    if (usuarioModif.Localidad.Id == 0)
                    {
                        usuarioModif.Localidad.Id = usrAnterior.Localidad.Id;
                    }

                    if (usuarioModif.Idioma.Id == 0)
                    {
                        usuarioModif.Idioma.Id = usrAnterior.Idioma.Id;
                    }

                    //Actualizo datos.
                    ln.ActualizarDatosCuenta(usuarioModif);

                    var usuarioActual = ln.BuscarUsuarioPorUsuario((String)Session["UsrLogin"]);

                    var usuarioActualDVH = inte.CalcularDVH(usuarioActual.Id.ToString() + priv.Cifrar(usuarioActual.RazonSocial) + priv.Cifrar(usuarioActual.Nombre) + priv.Cifrar(usuarioActual.Apellido) + priv.Cifrar(usuarioActual.Usr) + priv.Cifrar(usuarioActual.Psw) + priv.Cifrar(usuarioActual.CUIL) + usuarioActual.PerfilUsr.Id.ToString() + usuarioActual.Idioma.Id.ToString() + usuarioActual.Localidad.Id.ToString() + usuarioActual.FechaAlta.ToString() + usuarioActual.FechaBaja.ToString() + priv.Cifrar(usuarioActual.Telefono) + priv.Cifrar(usuarioActual.Direccion));

                    // Actualiza el DVH y DVV.
                    inte.ActualizarDVHUsuario(usuarioActual.Id, usuarioActualDVH);
                    inte.RecalcularDVV("SEG_Usuario");

                    aud.grabarBitacora(DateTime.Now, usuarioActual.Usr, "CAMBIO DATOS CUENTA", "INFO", "Se han actualizado datos de cuenta del Usuario: " + usuarioActual.Usr + ".");

                    Session["IdiomaApp"] = usuarioActual.Idioma.Abreviacion;

                    return(RedirectToAction("Index", "Home"));
                }
                catch
                {
                    var lnIdio = new NegocioIdioma();
                    var lnLoc  = new NegocioLocalidad();

                    ViewBag.Localidades = lnLoc.Listar();
                    ViewBag.Idiomas     = lnIdio.Listar();

                    return(View());
                }
            }

            return(RedirectToAction("Index", "Home"));
        }