예제 #1
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();
                    }
                }
            }
        }
예제 #2
0
        public MDEmpleado Login(string rut, string password)
        {
            NegocioEmpleado negEmpleado = new NegocioEmpleado();
            MDEmpleado      empleado    = negEmpleado.Login(rut, password);

            return(empleado);
        }
예제 #3
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);
        }
예제 #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");
        }
예제 #5
0
        private int retornarDepartamento(string rut)
        {
            int             departamento    = default(int);
            NegocioEmpleado negocioEmpleado = new NegocioEmpleado();

            departamento = negocioEmpleado.retornarDepartamentoByRut(rut);
            return(departamento);
        }
예제 #6
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);
            }
        }
예제 #7
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();
            }
        }
        private void cargarTabla(string codigo)
        {
            NegocioSolicitud   negocioSolicitud = new NegocioSolicitud();
            NegocioEmpleado    negocioEmpleado  = new NegocioEmpleado();
            NegocioTipoPermiso tipo             = new NegocioTipoPermiso();
            NegocioMotivo      motivo           = new NegocioMotivo();
            NegocioEstado      estado           = new NegocioEstado();

            Solicitud solicitud = new Solicitud();

            solicitud = negocioSolicitud.retornarSolicitudByCodigoDocumento(codigo);

            codSolicitud.Text         = solicitud.codigoDocumento;
            rutSolicitante.Text       = solicitud.rutSolicitante;
            nombreSolicitante.Text    = negocioEmpleado.retornarNombreByRut(solicitud.rutSolicitante);
            fechaSolicitud.Text       = solicitud.fechaSolicitud.ToShortDateString();
            tipoSolicitud.Text        = tipo.nameByID(solicitud.idTipoPermiso);
            motivoSolicitud.Text      = motivo.nameByID(solicitud.idMotivo);
            autorizadorSolicitud.Text = solicitud.rutAutorizante;
            estadoSolicitud.Text      = estado.nameByID(solicitud.idEstado);

            if (solicitud.rutAutorizante == null || solicitud.rutAutorizante.ToString() == "")
            {
                tdAutorizador.Visible = false;
                btnDescarga.Visible   = false;
            }
            else
            {
                tdAutorizador.Visible = true;
                btnDescarga.Visible   = true;
            }


            string script = @"<script type='text/javascript'>
                       $(document).ready(function () {
                            $('#mostrarmodal').modal('show');
                        });
                  </script>";

            certSolicitante.Text = nombreSolicitante.Text;
            cetInicio.Text       = solicitud.fechaInicio.ToShortDateString();
            certFin.Text         = solicitud.fechaTermino.ToShortDateString();
            cetPermiso.Text      = tipoSolicitud.Text;
            certMotivo.Text      = motivoSolicitud.Text;
            certDias.Text        = (solicitud.fechaTermino.Date - solicitud.fechaInicio.Date).TotalDays.ToString();


            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", script, false);
            txtCodigoDocumento.Text = "";
        }
예제 #10
0
        //MOSTRAR
        public void Mostrar()
        {
            int cantidadRegistros = 0;

            dgvListado.DataSource = NegocioEmpleado.Mostrar();
            NombreColumnas();
            if (!chkEliminarVarios.Checked)
            {
                OcultarColumnas();
            }
            foreach (DataGridViewRow row in dgvListado.Rows)
            {
                cantidadRegistros++;
            }
            lblCantidadClientes.Text = "Cantidad de trabajadores: " + cantidadRegistros;
        }
예제 #11
0
 private void VerificarPrimerInicioSistema()
 {
     //Settings Configuracion = new Settings();
     if (Configuracion.PrimerInicioSistema)
     {
         MessageBox.Show("Bienvenido");
         NegocioCliente.Insertar("VENTA AL PÚBLICO EN GENERAL", "", null, DateTime.Now, null, null, null, null, null, null);
         NegocioEmpleado.Insertar("JOSÉ MARÍA", "LANZA", "M", Convert.ToDateTime("07/08/1988"), "33815021", "San Miguel 2257", "4275666", "3815273420", "*****@*****.**", "Administrador", "admin", "admin");
         DataTable dtCategoriaCaja = new DataTable();
         NegocioCategoria.Insertar("BEBIDAS", "Bebidas con y sin alcohol");
         NegocioCategoria.Insertar("ALIMENTOS", "");
         dtCategoriaCaja = NegocioCategoria.Mostrar();
         NegocioCaja.Insertar("CAJA 1", "Todas", true, Environment.MachineName, dtCategoriaCaja);
         Configuracion.PrimerInicioSistema = false;
         Configuracion.Save();
     }
 }
예제 #12
0
        private void btnIngresar_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable Login = NegocioEmpleado.Login(txtUsuario.Text, txtPassword.Text);
                if (Login.Rows.Count == 0)
                {
                    MessageBox.Show("No tiene los permisos para ingresar al sistema", ".:.Inicio de sesión.:.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtUsuario.SelectAll();
                }
                else
                {
                    // SE VERIFICA SI HAY UNA INSTANCIA PARA QUE MÁS ADELANTE SE PUEDA PONER LA OPCIÓN DE CAMBIAR DE USUARIO
                    //formPrincipal = formPrincipal.GetInstancia(); SE UTILIZA ESTA INSTRUCCIÓN CUANDO SE USA
                    //UN MÉTODO GETINSTANCIA NO ESTÁTICO, DE LO CONTRARIO SE UTILIZA EL SIGUIENTE:
                    #region MDI METRO
                    formPrincipal            = frmPrincipal.GetInstancia();
                    formPrincipal.IdEmpleado = Convert.ToInt32(Login.Rows[0][0].ToString());
                    formPrincipal.Apellido   = Login.Rows[0][1].ToString();
                    formPrincipal.Nombre     = Login.Rows[0][2].ToString();
                    formPrincipal.Acceso     = Login.Rows[0][3].ToString();
                    formPrincipal.Show();
                    formPrincipal.BringToFront();
                    Limpiar();
                    this.Hide(); // ANTERIORMENTE EN VEZ DE CERRAR EL FORMULARIO LOGIN SE OCULTABA Y ANDABA PERFECTO - SE LO CONFIGURA
                                 // EN CLOSE PARA LUEGO VER SI SIGUE FUNCIONANDO DE LA MISMA MANERA, SI NO ES ASÍ SE DEBE ESCONDER ESTE FORMULARIO
                                 // NO FUNCA CON Close(), SE CIERRA EL PROGRAMA EL CERRAR frmLogin
                    #endregion

                    #region MDIPRINCIPAL
                    //MDIPrincipal formPrincipal = MDIPrincipal.GetInstancia();
                    //formPrincipal.IdTrabajador = Convert.ToInt32(Login.Rows[0][0].ToString());
                    //formPrincipal.Apellido = Login.Rows[0][1].ToString();
                    //formPrincipal.Nombre = Login.Rows[0][2].ToString();
                    //formPrincipal.Acceso = Login.Rows[0][3].ToString();
                    //formPrincipal.Show();
                    //Limpiar();
                    //this.Hide();
                    #endregion
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " Trace: " + ex.StackTrace);
            }
        }
 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()
             });
         }
     }
 }
예제 #14
0
        private void envioCorre(Solicitud solicitud)
        {
            Correo          correo            = new Correo();
            NegocioEmpleado empleado          = new NegocioEmpleado();
            var             empleadoSolicitud = empleado.retornarEmpleado(solicitud.rutSolicitante);

            var correoDest = empleadoSolicitud.correo;

            correo.asunto = "Solicitud numero: " + solicitud.codigoDocumento;
            var correoCuer = "Sr./Sra. " + empleadoSolicitud.nombres + " " + empleadoSolicitud.apellidoPaterno + " " + empleadoSolicitud.apellidoMaterno + "\n" +
                             "\n" +
                             "Se le comunica que con fecha: " + solicitud.fechaSolicitud + ", su solicitud de permiso fue curzada con el numero de solicitud: " + solicitud.codigoDocumento + "\n" +
                             "\n" +
                             "Saludos. -" + "\n" +
                             "Atte." + "\n" +
                             "Ilustre Municipalidad de Vista Hermosa";

            correo.destinatario = correoDest;
            correo.cuerpo       = correoCuer;

            correo.EnviarCorreo();
        }
예제 #15
0
        public List <MDEmpleado> BuscarAll()
        {
            NegocioEmpleado auxEmpleado = new NegocioEmpleado();

            return(auxEmpleado.Select());
        }
예제 #16
0
        public MDEmpleado Buscar(string rut)
        {
            NegocioEmpleado auxEmpleado = new NegocioEmpleado();

            return(auxEmpleado.Select(rut));
        }
예제 #17
0
        // Elimina un Empleado, filtrado por su id y retorna una validacion.
        public bool IEliminaEmpleado(int id)
        {
            NegocioEmpleado auxEmpleado = new NegocioEmpleado();

            return(auxEmpleado.EliminaEmpleado(id));
        }
예제 #18
0
        // Actualiza un empleado mediante un objetivo, filtrando por objeto y retorna una validacion.
        public bool IActualizaEmpleado(Empleado empleado)
        {
            NegocioEmpleado auxEmpleado = new NegocioEmpleado();

            return(auxEmpleado.ActualizaEmpleado(empleado));
        }
예제 #19
0
        // Busca un empleado determinado con columna, filtrando por el valor y retorna una validacion.
        public DataTable IBuscaEmpleado(String filtro, String valor)
        {
            NegocioEmpleado auxEmpleado = new NegocioEmpleado();

            return(auxEmpleado.BuscaEmpleado(filtro, valor));
        }
예제 #20
0
 //METODO BUSCAR
 private void Buscar()
 {
     dgvListado.DataSource = NegocioEmpleado.Buscar(txtBuscar.Text);
     OcultarColumnas();
 }
예제 #21
0
        // Metodo para listar Empleados por columna.
        public DataTable IListaEmpleado(String filtro, bool sentido)
        {
            NegocioEmpleado auxEmpleado = new NegocioEmpleado();

            return(auxEmpleado.ListaEmpleado(filtro, sentido));
        }
        protected void btnGenerar_Click(object sender, EventArgs e)
        {
            int                 año                 = Convert.ToInt32(cmbAño.SelectedItem.Value);
            int                 mes                 = Convert.ToInt32(cmbMes.SelectedItem.Value);
            int                 unidad              = Convert.ToInt32(cmbUnidad.SelectedItem.Value);
            string              usuario             = Session["usuario"].ToString();
            NegocioCuenta       negocioCuenta       = new NegocioCuenta();
            NegocioDepartamento negocioDepartamento = new NegocioDepartamento();
            NegocioEmpleado     negocioEmpleado     = new NegocioEmpleado();

            Reportes reportes = new Reportes();

            foreach (var item in reportes.generarResolucion(unidad, año, mes))
            {
                TableRow  tableRow    = new TableRow();
                TableCell rut         = new TableCell();
                TableCell tipoPermiso = new TableCell();
                TableCell dias        = new TableCell();

                tablaEstadoPermisos.Rows.Add(tableRow);
                rut.Text         = item.rut;
                tipoPermiso.Text = item.nombreTipoPermiso;
                dias.Text        = item.cantidadPermisos.ToString();

                tableRow.Cells.Add(rut);
                tableRow.Cells.Add(tipoPermiso);
                tableRow.Cells.Add(dias);
            }
            if (validarCampos())
            {
                if (tablaEstadoPermisos.Rows.Count > 1)
                {
                    this.formularioResolucion.Attributes.Add("hidden", "true");
                    this.containerTabla.Attributes.Remove("hidden");
                }
                else
                {
                    string script = @"<script type='text/javascript'>
                       $(document).ready(function () {
                            $('#modalerror').modal('show');
                        });
                  </script>";

                    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", script, false);
                    lblError.Text = "No se encontraron permisos autorizados para mes y año";
                    limpiar();
                }
            }
            else
            {
                string script = @"<script type='text/javascript'>
                       $(document).ready(function () {
                            $('#modalerror').modal('show');
                        });
                  </script>";

                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", script, false);
                lblError.Text = "Debe seleccionar todos los campos";
                limpiar();
            }
        }
예제 #23
0
        private void cargarTablaPorEstado(int valor)
        {
            tituloEstado.Visible = false;
            NegocioSolicitud negocioSolicitud = new NegocioSolicitud();
            NegocioCuenta    negocioCuenta    = new NegocioCuenta();
            NegocioEmpleado  negocioEmpleado  = new NegocioEmpleado();
            NegocioMotivo    negocioMotivo    = new NegocioMotivo();

            foreach (var item in negocioSolicitud.listadoFiltradoByDepartamento(retornarDepartamento(retornarRutAutorizador()), valor))
            {
                TableRow  tableRow          = new TableRow();
                TableCell codigoDocumento   = new TableCell();
                TableCell descripcion       = new TableCell();
                TableCell nombreSolicitante = new TableCell();
                TableCell fechaSolicitud    = new TableCell();
                TableCell fechaInicio       = new TableCell();
                TableCell fechaTermino      = new TableCell();
                TableCell tipoPermiso       = new TableCell();
                TableCell Motivo            = new TableCell();
                TableCell rutSolicitante    = new TableCell();
                TableCell rutAutorizador    = new TableCell();
                TableCell estado            = 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();
                nombreSolicitante.Text = negocioEmpleado.retornarNombreByRut(item.rutSolicitante);

                if (item.rutAutorizante == null)
                {
                    rutAutorizador.Text = "Sin asignar";
                }
                else
                {
                    rutAutorizador.Text = item.rutAutorizante.ToString();
                }

                Motivo.Text = negocioMotivo.nameByID(item.idMotivo);
                estado.Text = retornarEstado(item.idEstado);
                tableRow.ID = item.codigoDocumento.ToString();
                tableRow.Attributes.Add("onClick", "modalTabla(this.id)");


                tableRow.Cells.Add(codigoDocumento);
                tableRow.Cells.Add(descripcion);
                tableRow.Cells.Add(nombreSolicitante);
                nombreSolicitante.Attributes.Add("hidden", "");
                tableRow.Cells.Add(fechaSolicitud);
                tableRow.Cells.Add(fechaInicio);
                tableRow.Cells.Add(fechaTermino);
                tableRow.Cells.Add(tipoPermiso);
                tableRow.Cells.Add(rutSolicitante);
                rutSolicitante.Attributes.Add("hidden", "");
                tableRow.Cells.Add(rutAutorizador);
                rutAutorizador.Attributes.Add("hidden", "");
                tableRow.Cells.Add(Motivo);
                tableRow.Cells.Add(estado);
            }
        }
예제 #24
0
        public bool UpdateWithValues(string rut, string nombre, string apellido, string password)
        {
            NegocioEmpleado auxEmpleado = new NegocioEmpleado();

            return(auxEmpleado.Update(rut, nombre, apellido, password));
        }
예제 #25
0
        public bool Delete(string rut)
        {
            NegocioEmpleado auxEmpleado = new NegocioEmpleado();

            return(auxEmpleado.Delete(rut));
        }
예제 #26
0
        // Envia un registro de Empleado, retorna una confirmacion y retorna ua validacion.
        public bool IRegistrarEmpleado(Empleado empleado)
        {
            NegocioEmpleado auxEmpleado = new NegocioEmpleado();

            return(auxEmpleado.RegistrarEmpleado(empleado));
        }
예제 #27
0
        public bool Insert(MDEmpleado nuevoEmpleado)
        {
            NegocioEmpleado auxEmpleado = new NegocioEmpleado();

            return(auxEmpleado.Insert(nuevoEmpleado));
        }
예제 #28
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            string              idEmpleado = "";
            string              Respuesta  = "";
            DialogResult        Opcion;
            frmIngresarEmpleado formIngresarEmpleado = new frmIngresarEmpleado();

            try
            {
                //SELECCION DE VARIOS REGISTROS
                if (chkEliminarVarios.Checked)
                {
                    Opcion = MessageBox.Show(
                        "¿Realmente desea eliminar los registros seleccionados?",
                        "Eliminando registro", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (Opcion == DialogResult.Yes)
                    {
                        foreach (DataGridViewRow row in dgvListado.Rows)
                        {
                            if (Convert.ToBoolean(row.Cells[0].Value))
                            {
                                idEmpleado = Convert.ToString(row.Cells[1].Value);
                                Respuesta  = NegocioEmpleado.Eliminar(Convert.ToInt32(idEmpleado));
                            }
                        }
                        if (Respuesta.Equals("OK"))
                        {
                            formIngresarEmpleado.NotificacionOk("Los registros se eliminaron correctamente.", "Eliminando");
                        }
                        else
                        {
                            formIngresarEmpleado.NotificacionError("Los registros no se eliminaron.", "Error");
                        }
                        Mostrar();
                    }
                }
                else
                {
                    //SELECCION DE UN REGISTRO
                    Opcion = MessageBox.Show(
                        "¿Realmente desea eliminar el registro seleccionado?",
                        "Eliminando registro", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (Opcion == DialogResult.Yes)
                    {
                        idEmpleado = Convert.ToString(dgvListado.CurrentRow.Cells[1].Value);
                        Respuesta  = NegocioEmpleado.Eliminar(Convert.ToInt32(idEmpleado));
                        if (Respuesta.Equals("OK"))
                        {
                            formIngresarEmpleado.NotificacionOk("El registro se eliminó correctamente", "Eliminando");
                        }
                        else
                        {
                            formIngresarEmpleado.NotificacionError("El registro no se eliminó", "Error");
                        }
                    }
                }
                chkEliminarVarios.Checked = false;
                Mostrar();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
예제 #29
0
        public bool Update(MDEmpleado editableEmpleado)
        {
            NegocioEmpleado auxEmpleado = new NegocioEmpleado();

            return(auxEmpleado.Update(editableEmpleado));
        }
예제 #30
0
        private string retornarNombreByRut(string rut)
        {
            NegocioEmpleado negocioEmpleado = new NegocioEmpleado();

            return(negocioEmpleado.retornarNombreByRut(rut));
        }