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"); }
private int retornarDepartamento(string rut) { int departamento = default(int); NegocioEmpleado negocioEmpleado = new NegocioEmpleado(); departamento = negocioEmpleado.retornarDepartamentoByRut(rut); return(departamento); }
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() }); } } }