void EnlazarListas() { //llenar ddl de personas //ddlPersona.DataSource = negocioEstudiante.ObtenerPersonas(); //ddlPersona.DataTextField = "PER_NOMBRE_COMPLETO"; //ddlPersona.DataValueField = "PER_ID"; //ddlPersona.DataBind(); //LLenar ddl de cuartos NegocioCuarto negocioCuarto = new NegocioCuarto(); ddlNumeroCuarto.DataSource = negocioCuarto.ObtenerCuartos(); ddlNumeroCuarto.DataTextField = "CUA_NUMERO"; ddlNumeroCuarto.DataValueField = "CUA_ID"; ddlNumeroCuarto.DataBind(); //LLenar Departamentos NegocioDepartamento negocioDepartamento = new NegocioDepartamento(); List <EntidadDepartamento> depLis = negocioDepartamento.ObtenerDepartamento().data as List <EntidadDepartamento>; dllDepNombre.DataSource = depLis.OrderBy(dr => dr.DEP_NOMBRE); dllDepNombre.DataTextField = "DEP_NOMBRE"; dllDepNombre.DataValueField = "DEP_ID"; dllDepNombre.DataBind(); //Lista de Generos ddlGenId.DataSource = negocioEstudiante.ObtenerListaGenero(); ddlGenId.DataTextField = "GEN_DESCRIPCION"; ddlGenId.DataValueField = "GEN_ID"; ddlGenId.DataBind(); //Lista Tipo de Identificación ddlTipId.DataSource = negocioEstudiante.ObtenerListaTipoIdentificacion(); ddlTipId.DataTextField = "TIP_IDE_DESCRIPCION"; ddlTipId.DataValueField = "TIP_IDE_ID"; ddlTipId.DataBind(); //Lista Carreras ddCarId.DataSource = negocioEstudiante.ObtenerListaCarrera(); ddCarId.DataTextField = "CAR_DESCRIPCION"; ddCarId.DataValueField = "CAR_ID"; ddCarId.DataBind(); //Lista de compañias telefónicas ddlcompDescripcion.DataSource = negocioEstudiante.ObtenerListaCompañiaTelefonica(); ddlcompDescripcion.DataTextField = "COM_DESCRIPCION"; ddlcompDescripcion.DataValueField = "COM_ID"; ddlcompDescripcion.DataBind(); //Obtener Recinto Estudiante }
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(); } }
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() }); } } }
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(); } }