public static object CargarDataTable() { MostrarPermisos mp = new MostrarPermisos(); List <Permiso> lp = new PermisoCollection().ReadAll().OrderBy(s => s.IdPermiso).ToList(); object json = new { data = lp }; return(json); }
protected void btnVerif_Click(object sender, EventArgs e) { Permiso permiso = new PermisoCollection().ReadAll().First(a => a.Pendiente == 1); permiso.Pendiente = 0; if (permiso.Update()) { ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "alertarme()", true); } }
protected void btnVerificar_Click(object sender, EventArgs e) { { Permiso p = new Permiso(); string numS = txtcod.Text; int num = int.Parse(numS); Solicitud s = new SolicitudCollection().ReadAll().First(sc => sc.IdSolicitud == num); List <Permiso> ls = new PermisoCollection().ReadAll().ToList(); int workDays = 0; int start = s.FechaInicio.Day; int end = s.FechaFin.Day; DateTime fecha = s.FechaInicio; while (start != end) { if (fecha.DayOfWeek == DayOfWeek.Saturday || fecha.DayOfWeek == DayOfWeek.Sunday) { workDays++; } fecha = fecha.AddDays(1); start++; } p.IdPermiso = s.IdSolicitud; p.Observaciones = txtObservaciones.Text; p.CantidadDias = s.FechaFin.Day - s.FechaInicio.Day - workDays + 1; p.Pendiente = 1; p.IdSolicitud = num; p.CodVerificacion = new Random().Next(10000, 100000); if (p.Create()) { s.Estado = 2; s.Update(); ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "verificacion(true)", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "verificacion(false)", true); } } }
protected void btnVerificar_Click(object sender, EventArgs e) { string ee = txtcod.Text; buscado = int.Parse(ee); List <Muni.Negocio.Permiso> ls = new PermisoCollection().ReadAll().ToList(); foreach (Muni.Negocio.Permiso s in ls) { if (buscado == s.CodVerificacion) { ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "verificacion(true)", true); break; } } ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "verificacion(false)", true); }
protected void btnConfirmarModificar_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtNombreEdit.Text) || string.IsNullOrEmpty(txtId.Text)) { ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "verificacionNull(true)", true); } else { int selec = int.Parse(txtId.Text); Permiso unidad = new PermisoCollection().ReadAll().First(es => es.IdPermiso == selec); unidad.Observaciones = txtNombreEdit.Text; if (unidad.Update()) { ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "verificacionModifi(true)", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "verificacionModifi(false)", true); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <Solicitud> solicitudes = new SolicitudCollection().ReadAll().Where(p => p.Rut == U1.Rut && p.FechaFin <= DateTime.Today.AddDays(1)).ToList(); List <Permiso> permisos = new PermisoCollection().ReadAll().Where(p => p.Rut == U1.Rut && p.Pendiente == 1).ToList(); lblinfo1.Text = string.Format("{0}", U1.TipoUsuario); lblinfo0.Text = string.Format("{0} {1} {2}", U1.Nombre, U1.ApellidoP, U1.ApellidoM); lblinfo2.Text = string.Format("Correo: {0}", U1.Correo); lblinfo4.Text = string.Format("Unidad: {0}", U1.TipoUnidad); lblinfo3.Text = string.Format("Fecha Contrato: {0}", U1.FechaContrato.ToShortDateString()); if (solicitudes.Count() > 0 && U1.Moroso == 0 && permisos.Count() > 0) { U1.Moroso = 1; } if (permisos.Count() > 0 && solicitudes.Count() > 0) { lblAdvertencia.Text = string.Format("Usted tiene {0} permiso pendiente", permisos.Count()); btnVerif.Visible = true; } } }