private void btnAgregarPermiso_Click(object sender, EventArgs e)
        {
            if (txtIdRecurso.Text == "")
            {
                MessageBox.Show("Todos los valores son requeridos");
                return;
            }
            int    idPermiso    = Convert.ToInt32(1);
            string recursoLegal = txtIdRecurso.Text;

            PermisoBLL permisosBL = new PermisoBLL();
            int        actualizar = permisosBL.agregar(idPermiso, recursoLegal);

            if (actualizar == 1)
            {
                MessageBox.Show("Permiso Agregado");
                this.Hide();
                frmMantenedorPermisos mp = new frmMantenedorPermisos();
                mp.Show();
            }
            else
            {
                MessageBox.Show("Permiso no Agregado");
            }
        }
        private void btnActualizarPermiso_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (DataGridViewRow row in grdPermisos.Rows)
                {
                    if (row.Selected)
                    {
                        int        id           = Convert.ToInt32(row.Cells[0].Value.ToString());
                        string     recursoLegal = row.Cells[1].Value.ToString();
                        PermisoBLL permisosBL   = new PermisoBLL();
                        int        actualizar   = permisosBL.actualizar(id, recursoLegal);

                        if (actualizar == 1)
                        {
                            MessageBox.Show("Permiso Actualizado");
                            grdPermisos.Refresh();
                        }
                        else
                        {
                            MessageBox.Show("Permiso no Actualizado");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Se produjo un error: " + ex.ToString());
            }
        }
 private void grdUnidadInterna_SelectionChanged(object sender, EventArgs e)
 {
     try
     {
         foreach (DataGridViewRow row in grdUnidadInterna.Rows)
         {
             if (row.Selected)
             {
                 int id = Convert.ToInt32(row.Cells[0].Value.ToString());
                 //string desc = row.Cells[1].Value.ToString();
                 PermisoBLL negocioPermiso = new PermisoBLL();
                 int        estadoActual   = negocioPermiso.retornaEstadoPermiso(id);
                 if (estadoActual != 9999)
                 {
                     cboEstado.SelectedValue = estadoActual;
                 }
                 else
                 {
                     MessageBox.Show("la solicitud actual no tiene un estado definido");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Se produjo un error: " + ex.ToString());
     }
 }
        private void btnEliminarPermiso_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (DataGridViewRow row in grdPermisos.Rows)
                {
                    if (row.Selected)
                    {
                        int        id         = Convert.ToInt32(row.Cells[0].Value.ToString());
                        PermisoBLL permisosBL = new PermisoBLL();
                        int        eliminar   = permisosBL.eliminar(id);

                        if (eliminar == 1)
                        {
                            MessageBox.Show("Permiso Eliminado");
                            this.Hide();
                            frmMantenedorPermisos mp = new frmMantenedorPermisos();
                            mp.Show();
                        }
                        else
                        {
                            MessageBox.Show("Permiso no eliminado");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Se produjo un error: " + ex.ToString());
            }
        }
예제 #5
0
    public bool ValidarPermiso(int id, List <PermisoBE> lista)
    {
        bool contiene = false;

        if (lista != null)
        {
            foreach (var perm in lista)
            {
                if (perm.Id.Equals(id))
                {
                    contiene = true;
                    break;
                }
                PermisoBLL permisoBLL = new PermisoBLL();
                PermisoBE  permiso    = new PermisoBE();
                permiso.Id = perm.Id;
                permiso    = permisoBLL.Consulta(ref permiso);
                FamiliaBE familia = new FamiliaBE(permiso);
                familia.Permisos = permisoBLL.ConsultaPermisos(familia);

                foreach (var permisoHijo in familia.Permisos)
                {
                    if (permisoHijo.Id.Equals(id))
                    {
                        contiene = true;
                        break;
                    }
                }
            }
        }
        return(contiene);
    }
예제 #6
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            //if (txtMotivo.Text == "") {
            //    MessageBox.Show("debe ingresar un motivo válido");
            //    return;
            //}

            DateTime dtFechaInicial = Convert.ToDateTime(this.dtInicio.Text);
            DateTime dtFechaFinal   = Convert.ToDateTime(this.dtFin.Text);


            if (dtFechaInicial > dtFechaFinal)
            {
                MessageBox.Show("Rango de fechas no válido");
                return;
            }


            DAL.VS_Login.VHWServiceClient VHWS = new DAL.VS_Login.VHWServiceClient();
            int rutUsuarioGeneraPermiso        = (int)Common.rut;
            //rutUsuarioGeneraPermiso = 19;
            //int permisoFuncionario = VHWS.getAntiguedadFun(rutUsuarioGeneraPermiso);

            PermisoBLL permisoBL = new PermisoBLL();
            var        motivo    = Convert.ToInt32((((System.Data.DataRowView)(cbMotivoPermiso.SelectedValue)).Row).ItemArray[0]);

            int resultadoPermiso = permisoBL.insertarPermiso(dtFechaInicial, dtFechaFinal, (int)Common.rut, motivo);

            Common.LogTxt("Permiso Generado", Common.rut.ToString());
            MessageBox.Show("Permiso solicitado correctamente");
        }
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (DataGridViewRow row in grdUnidadInterna.Rows)
                {
                    if (row.Selected)
                    {
                        int        id   = Convert.ToInt32(row.Cells[0].Value.ToString());
                        int        rut  = Convert.ToInt32(row.Cells[3].Value.ToString());
                        string     desc = row.Cells[1].Value.ToString();
                        int        valorSeleccionado = Convert.ToInt32(cboEstado.SelectedValue.ToString());
                        PermisoBLL permisoNegocio    = new PermisoBLL();
                        Boolean    actualizarEstado  = permisoNegocio.cambiarEstadoPermiso(valorSeleccionado, id, DateTime.Now, 1);

                        if (actualizarEstado)
                        {
                            MessageBox.Show("Cambios realizados");
                            //enviamos mail en caso de que sea autorizado:
                            if (valorSeleccionado == 3)
                            {
                                DialogResult res = MessageBox.Show("Desea notificar al empleado de su aprobacion?"
                                                                   , "Confirmar Acción"
                                                                   , MessageBoxButtons.YesNo
                                                                   );
                                if (res == System.Windows.Forms.DialogResult.Yes)
                                {
                                    DAL.TBL_USUARIO datosUser      = new DAL.TBL_USUARIO();
                                    UsuarioBLL      usuarioNegocio = new UsuarioBLL();
                                    datosUser = usuarioNegocio.datosUsuario(rut);

                                    //var udestino = db.TBL_SOLICITUDPERMISO.Include(t => t.TBL_USUARIO).Where(t => t.ID_SOLICITUD == tBL_ESTADOSOLICITUDPERMISO.ID_SOLICITUDPERMISO).First();
                                    BLL.Helper.emailNotification(datosUser.EMAIL, datosUser.NOMBRE + " " + datosUser.AP_PATERNO);
                                    MessageBox.Show("Email enviado");
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Se produjo un error al cambiar el estado del permiso");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Se produjo un error: " + ex.ToString());
            }
        }
예제 #8
0
        public ActionResult Index(string sortOrder, string currentFilter, string searchString, int?page)
        {
            IEnumerable <Permiso> listaDepartamento = PermisoBLL.SelectAll();

            ViewBag.CurrentSort  = sortOrder;
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date";

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            ViewBag.CurrentFilter = searchString;

            var students = from s in listaDepartamento
                           select s;

            if (!String.IsNullOrEmpty(searchString))
            {
                students = students.Where(s => s.pkPermiso.ToString().ToUpper().Contains(searchString.ToUpper()) ||
                                          s.txtDescripcion.ToString().ToUpper().Contains(searchString.ToUpper()));
            }
            switch (sortOrder)
            {
            case "name_desc":
                students = students.OrderByDescending(s => s.pkPermiso);
                break;

            case "Date":
                students = students.OrderBy(s => s.txtDescripcion);
                break;

            case "date_desc":
                students = students.OrderByDescending(s => s.txtDescripcion);
                break;

            default:      // Name ascending
                students = students.OrderBy(s => s.pkPermiso);
                break;
            }
            return(View(students.ToList <Permiso>()));
        }
예제 #9
0
 public ActionResult Create([Bind(Prefix = "Item1")] Permiso permiso, [Bind(Prefix = "Item2")] EmpPermiso empPermiso)
 {
     empPermiso.fkPermiso = PermisoBLL.InsertObjetoPermiso(permiso);
     EmpPermisoBLL.InsertObjetoEmpPermiso(empPermiso);
     return(RedirectToAction("Index", "Permiso"));
 }
예제 #10
0
        public bool Eliminar(Permiso Permiso)
        {
            PermisoBLL PermisoBLL = new PermisoBLL();

            return(PermisoBLL.Eliminar(Permiso));
        }
예제 #11
0
        public bool Delete(int ID)
        {
            PermisoBLL PermisoBLL = new PermisoBLL();

            return(PermisoBLL.Delete(ID));
        }
예제 #12
0
        public Permiso GetByID(int ID)
        {
            PermisoBLL PermisoBLL = new PermisoBLL();

            return(PermisoBLL.GetByID(ID));
        }
예제 #13
0
        public bool Edit(Permiso Permiso)
        {
            PermisoBLL PermisoBLL = new PermisoBLL();

            return(PermisoBLL.Edit(Permiso));
        }
예제 #14
0
        public Permiso Create(Permiso Permiso)
        {
            PermisoBLL PermisoBLL = new PermisoBLL();

            return(PermisoBLL.Create(Permiso));
        }
예제 #15
0
        public List <Permiso> ListarTodos()
        {
            PermisoBLL PermisoBLL = new PermisoBLL();

            return(PermisoBLL.ListarTodos());
        }