Esempio n. 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();
                    }
                }
            }
        }
Esempio n. 2
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);
        }
Esempio n. 3
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");
        }
Esempio n. 4
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)
 {
     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()
             });
         }
     }
 }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            script = @"<script type='text/javascript'>
                       $(document).ready(function () {
                            $('#mostrarmodal').modal('show'); 
                        });
                  </script>";
            //validaTexto = @"<script type='text/javascript'>
            //           $(document).ready(function () {

            //            var $texo = document.getElementById('<%=txtDetalleSolicitud.ClientID%>');
            //            if($('#<%=txtDetalleSolicitud.ClientID%>').val().length > 5){
            //                $('#paso1').removeAttr('disabled');
            //             }
            //            });
            //      </script>";
            //ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", validaTexto, false);
            //
            if (!IsPostBack)
            {
                NegocioCuenta   negocioCuenta   = new NegocioCuenta();
                NegocioEmpleado negocioEmpleado = new NegocioEmpleado();
                var             rut             = negocioEmpleado.retornarRutByCuentaID(negocioCuenta.retornarID(Session["usuario"].ToString()));
                cantDias.InnerText = retornarDiasDiponibles(rut);
                NegocioTipoPermiso negocioTipo   = new NegocioTipoPermiso();
                NegocioMotivo      negocioMotivo = new NegocioMotivo();
                cmbMotivo.Items.Add(new ListItem()
                {
                    Value = "0", Text = "- Seleccione -"
                });
                cmbTipoPermiso.Items.Add(new ListItem()
                {
                    Value = "0", Text = "- Seleccione -"
                });
                if (negocioTipo.listado() != null)
                {
                    foreach (var tmp in negocioTipo.listado())
                    {
                        cmbTipoPermiso.Items.Add(new ListItem()
                        {
                            Value = tmp.idTipoPermiso.ToString(), Text = tmp.nombreTipoPermiso
                        });
                    }
                }
                if (Session["funcionario"] == null)
                {
                    FormsAuthentication.SignOut();
                    Response.Redirect("../../Default.aspx");
                }
            }
            else
            {
                if (txtCod.Text == "")
                {
                    //ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", script, false);
                    txtCod.Text = "null";
                }

                if (txtCod.Text != "" || txtCod.Text != "null")
                {
                    txtCod.Text = string.Empty;
                }

                if (txtCod.Text == "null")
                {
                    if (txtCod.Text != "" || txtCod.Text != "null")
                    {
                        txtCod.Text = string.Empty;
                    }
                }
            }
        }
        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();
            }
        }