protected void ddlSucursal_SelectedIndexChanged(object sender, EventArgs e) { if (ddlSucursal.SelectedValue != string.Empty) { ViewState["sucursal"] = ddlSucursal.SelectedValue; epps = Mgr_Epp.Get_Epp(0, Convert.ToInt32(ddlSucursal.SelectedValue)); cantiEpp = epps.Count; if (cantiEpp > 0) { agregar_ingresos(epps); agregar_egresos(epps); agregar_existencia(epps); btnCalcular.Enabled = true; phInformacion.Visible = true; phNoRegistros.Visible = false; } else { phInformacion.Visible = false; phNoRegistros.Visible = true; } } else { ViewState["sucursal"] = "0"; } }
private void agregar_fila() { int intContInspecciones = 0; intContInspecciones = Convert.ToInt32(cantInspecciones.Value); eppTrab = Mgr_Epp.Get_Epp(Convert.ToInt32(ddlPuesto.SelectedValue)); ControlesDinamicos.Add_Fila_InspeccionUsoEpp(pnDatos, intContInspecciones, eppTrab); }
protected void ddlEmpresas_SelectedIndexChanged(object sender, EventArgs e) { if (ddlEmpresa.SelectedValue != string.Empty) { Mgr_Sucursal.Lista_Sucursal(ddlSucursal, Convert.ToInt32(ddlEmpresa.SelectedValue)); Mgr_Epp.List_Epp(ddlEpp); } }
private void agregar_fila() { TableCell _cell; TableRow _row; Label _label; TextBox _textbox; int id_puesto_trabajo = Mgr_PuestoTrabajo.GetId_PuestoTrabajador(Convert.ToInt32(ddlTrabajador.SelectedValue)); List <Model_CEPP> epps = Mgr_Epp.Get_Epp(id_puesto_trabajo); int cont = 0; foreach (var epp in epps) { _row = new TableRow(); _cell = new TableCell(); _label = new Label(); _label.ID = "lbl" + cont; _label.Text = epp.nombre; _cell.Controls.Add(_label); _row.Controls.Add(_cell); _cell = new TableCell(); _textbox = new TextBox(); _textbox.ID = "txtDet" + cont; _textbox.CssClass = "form-control"; _textbox.TextMode = TextBoxMode.MultiLine; _textbox.Rows = 2; _cell.Controls.Add(_textbox); _row.Controls.Add(_cell); _cell = new TableCell(); _textbox = new TextBox(); _textbox.ID = "txtCant" + cont; _textbox.CssClass = "form-control"; _textbox.TextMode = TextBoxMode.Number; _cell.Controls.Add(_textbox); _row.Controls.Add(_cell); _cell = new TableCell(); _textbox = new TextBox(); _textbox.ID = "txtFech" + cont; _textbox.CssClass = "form-control"; _textbox.Text = DateTime.Now.ToString("yyyy-MM-dd"); _textbox.TextMode = TextBoxMode.Date; _cell.Controls.Add(_textbox); _row.Controls.Add(_cell); tb_datos.Controls.Add(_row); cont++; } }
private void CargarDatos() { int idPuestos = 0; idPuestos = objUtilidades.descifrarCadena(Request.QueryString["id"]); List <puesto_trabajo> ListaPuestos = new List <puesto_trabajo>(); ListaPuestos = Mgr_PuestoTrabajo.Get_PuestoTrabajo(idPuestos, 0, ""); foreach (var itemPuestos in ListaPuestos) { txtNombre.Text = itemPuestos.nombre; txtDescripcion.Text = itemPuestos.descripcion; txtRecursoHumano.Text = itemPuestos.recurso_humano; txtObjetoTrabajo.Text = itemPuestos.objeto_trabajo; txtInsumos.Text = itemPuestos.insumos; txtMaquinas.Text = itemPuestos.maquinas; txtHerramientas.Text = itemPuestos.herramientas; txtEmisiones.Text = itemPuestos.emisiones; txtProductos.Text = itemPuestos.productos; txtDesechos.Text = itemPuestos.desechos; ImgFoto.ImageUrl = itemPuestos.foto; ViewState["url"] = string.Empty + itemPuestos.foto; Mgr_Empresa.Lista_Empresa(ddlEmpresa); ddlEmpresa.SelectedValue = Convert.ToString(itemPuestos.area.sucursal.id_empresa); Mgr_Sucursal.Lista_Sucursal(ddlSucursal, Convert.ToInt32(ddlEmpresa.SelectedValue)); ddlSucursal.SelectedValue = Convert.ToString(itemPuestos.area.id_sucursal); Mgr_Area.List_Area_Sucursal(ddlArea, Convert.ToInt32(ddlSucursal.SelectedValue)); ddlArea.SelectedValue = Convert.ToString(itemPuestos.id_area); Mgr_Epp.List_Epp(ddlEpp); List <puesto_trabajo_epp> ListaPuestoTrabajo_Epp = new List <puesto_trabajo_epp>(); ListaPuestoTrabajo_Epp = new List <puesto_trabajo_epp>(); ListaPuestoTrabajo_Epp = Mgr_PuestoTrabajo.Get_PuestoEpp(idPuestos); foreach (ListItem li in ddlEpp.Items) { for (int i = 0; i < ListaPuestoTrabajo_Epp.Count; i++) { if (Convert.ToInt32(li.Value) == ListaPuestoTrabajo_Epp.ElementAt(i).id_epp) { li.Selected = true; } } } } }
protected void btnAgregarSenal_Click(object sender, EventArgs e) { String[] valores = { txtNombreAdd.Text, txtDescripcionAdd.Text }; ObjUsuario.Error = Mgr_Epp.Add_Senalizacion(valores, fuImagenAdd); Modal.CerrarModal("addModal", "AddModalScript", this); Modal.MostrarAlertaAdd(phAlerta, divAlerta, lbAlerta, ObjUsuario.Error, txtBuscar); limpiarCampos(); LlenarGridView(); }
private void CargarListas() { if (BoolEmpSuc.Item1) { Mgr_Empresa.Lista_Empresa(ddlEmpresa); Mgr_Empresa.Lista_Empresa(ddlEmpresaAdd); Mgr_Empresa.Lista_Empresa(ddlEmpresaEdit); } else { Mgr_Epp.List_TipoEpp(ddlTipoEppAdd); Mgr_Epp.List_TipoEpp(ddlTipoEppEdit); } Mgr_Epp.List_TipoEpp(ddlTipoEpp); }
private void CargarListas() { Mgr_Epp.List_Epp(ddlEpp); if (BoolEmpSuc.Item1) { Mgr_Empresa.Lista_Empresa(ddlEmpresa); } else { Mgr_Sucursal.Lista_Sucursal(ddlSucursal, ObjUsuario.Id_empresa); } if (!BoolEmpSuc.Item2) { Mgr_Area.List_Area_Sucursal(ddlArea, ObjUsuario.Id_sucursal); } }
protected void Page_Load(object sender, EventArgs e) { Page.Form.Attributes.Add("enctype", "multipart/form-data"); ObjUsuario = Utilidades.ValidarSesion(HttpContext.Current.User.Identity as FormsIdentity, this); phAlerta.Visible = false; BoolEmpSuc = Mgr_Empresa.Get_Empresa_Sucursal(ObjUsuario); phEmpresa.Visible = BoolEmpSuc.Item1; phSucursal.Visible = BoolEmpSuc.Item2; if (!IsPostBack) { CargarListas(); } else { foreach (var ctlID in Page.Request.Form.AllKeys) { if (ctlID != null) { Control c = Page.FindControl(ctlID) as Control; if (c is Button) { if (c.ClientID.Contains("btnDocumento")) { epps = Mgr_Epp.Get_Epp(0, Convert.ToInt32(ddlSucursal.SelectedValue)); cantiEpp = epps.Count; agregar_ingresos(epps); agregar_egresos(epps); agregar_existencia(epps); } else if (c.ClientID.Contains("btnCalcular")) { epps = Mgr_Epp.Get_Epp(0, Convert.ToInt32(ddlSucursal.SelectedValue)); cantiEpp = epps.Count; agregar_ingresos(epps); agregar_egresos(epps); agregar_existencia(epps); } } } } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals(ComandosGrid.Eliminar.Value)) { int RowIndex = Convert.ToInt32((e.CommandArgument).ToString()); GridViewRow gvrow = GridView1.Rows[RowIndex]; hdfIDDel.Value = (gvrow.FindControl("id") as Label).Text; Modal.registrarModal("deleteModal", "DeleteModalScript", this); } else if (e.CommandName.Equals("Ver")) { int RowIndex = Convert.ToInt32((e.CommandArgument).ToString()); GridViewRow gvrow = GridView1.Rows[RowIndex]; hdfVerID.Value = (gvrow.FindControl("id") as Label).Text; List <senalizacion> senal = new List <senalizacion>(); senal = Mgr_Epp.Get_Senalizacion(Convert.ToInt32(hdfVerID.Value)); foreach (var item in senal) { lblNombre.Text = item.nombre; lblDescripcion.Text = item.descripcion; imgSenal.ImageUrl = item.url_imagen; } Modal.registrarModal("viewModal", "ViewModalScript", this); } else if (e.CommandName.Equals("Editar")) { int RowIndex = Convert.ToInt32((e.CommandArgument).ToString()); GridViewRow gvrow = GridView1.Rows[RowIndex]; hdfEditID.Value = (gvrow.FindControl("id") as Label).Text; List <senalizacion> senal = new List <senalizacion>(); senal = Mgr_Epp.Get_Senalizacion(Convert.ToInt32(hdfEditID.Value)); foreach (var item in senal) { txtNombreEdit.Text = item.nombre; txtDescripcionEdit.Text = item.descripcion; imgFotoEdit.ImageUrl = item.url_imagen; } Modal.registrarModal("editModal", "EditModalScript", this); } }
protected void ddlPuesto_SelectedIndexChanged(object sender, EventArgs e) { if (ddlPuesto.SelectedValue != string.Empty) { ViewState["puesto"] = ddlPuesto.SelectedValue; List <Model_CEPP> epp = Mgr_Epp.Get_Epp(Convert.ToInt32(ddlPuesto.SelectedValue)); if (epp.Count > 0) { phInformacion.Visible = true; } else { phNoRegistros.Visible = true; } } else { ViewState["puesto"] = "0"; } }
protected void btnBuscar_OnClick(object sender, EventArgs e) { if (ddlTrabajador.SelectedValue != string.Empty) { ViewState["trabajador"] = ddlTrabajador.SelectedValue; eppTrab = Mgr_Epp.Get_Epp(Convert.ToInt32(ddlPuesto.SelectedValue)); if (eppTrab.Count > 0) { phInformacion.Visible = true; cantInspecciones.Value = eppTrab.Count.ToString(); agregar_fila(); } else { phNoRegistros.Visible = true; } } else { ViewState["trabajador"] = string.Empty; } }
private void LlenarGridView() { int Idempresa = Mgr_Empresa.Set_IdEmpresa(ObjUsuario, Convert.ToInt32(ViewState["empresa"])); Mgr_Epp.Grid_Epp(GridView1, string.Empty + ViewState["tipo_epp"], string.Empty + ViewState["sWhere"]); }
private void LlenarGridView() { Mgr_Epp.Grid_Epp(GridView1, "", ""); }
private void LlenarGridView() { Mgr_Epp.Grid_EntregaEpp(GridView1, string.Empty + ViewState["empresa"], string.Empty + ViewState["sucursal"], string.Empty + ViewState["sWhere"], IdTrabajador); }
protected void btnGenerar_Click(object sender, EventArgs e) { RadioButton _radio; Table _table; int contFal = 0; TableRow row = new TableRow(); row = (TableHeaderRow)pnEpp.FindControl("EPPFaltante"); row.Visible = false; row = (TableHeaderRow)pnEpp.FindControl("SenalFaltante"); row.Visible = false; int i = 0; _table = (Table)pnEpp.FindControl("tblEPP"); List <Model_CEPP> epp_datos = Mgr_Epp.Get_Epp(Convert.ToInt32(ddlPuesto.SelectedValue)); foreach (var dato in epp_datos) { _radio = (RadioButton)pnEpp.FindControl("eppNo" + i); if (_radio.Checked) { row = new TableRow(); TableCell cell = new TableCell(); cell.Text = " " + dato.nombre; row.Controls.Add(cell); _table.Controls.Add(row); row = (TableHeaderRow)pnEpp.FindControl("EPPFaltante"); row.Visible = true; contFal++; } i++; } ViewState["EppFalt"] = contFal; contFal = 0; List <Model_CEPP> tipo_epp_datos = Mgr_Epp.Get_TipoEpp(Convert.ToInt32(ddlPuesto.SelectedValue)); i = 0; Table _table2 = new Table(); _table2 = (Table)pnEpp.FindControl("tblSenal"); foreach (var dato in tipo_epp_datos) { _radio = (RadioButton)pnEpp.FindControl("tpoNo" + i); if (_radio.Checked) { row = new TableRow(); TableCell cell = new TableCell(); cell.Text = " " + dato.nombre; row.Controls.Add(cell); _table2.Controls.Add(row); row = (TableHeaderRow)pnEpp.FindControl("SenalFaltante"); row.Visible = true; contFal++; } i++; } ViewState["SenalFalt"] = contFal; contFal = 0; phinicial.Visible = false; phGenerarDocumento.Visible = true; }
private void LlenarGridView() { Mgr_Epp.Grid_Senalizacion(GridView1); }
protected void btnAceptar_Click(object sender, EventArgs e) { int idPuestos = 0; idPuestos = objUtilidades.descifrarCadena(Request.QueryString["id"]); string ruta = ViewState["url"].ToString(); if (fuAnexo.HasFile) { ruta = Utilidades.GuardarImagen(fuAnexo, txtNombre.Text + "PuestoTrabajo", "~/archivos/puesto_trabajo/"); } GrupoLiEntities contextoEdit = new GrupoLiEntities(); puesto_trabajo Edit = contextoEdit.puesto_trabajo.SingleOrDefault(b => b.id_puesto_trabajo == idPuestos); if (Edit != null) { Edit.nombre = txtNombre.Text; Edit.descripcion = txtDescripcion.Text; Edit.recurso_humano = txtRecursoHumano.Text; Edit.objeto_trabajo = txtObjetoTrabajo.Text; Edit.insumos = txtInsumos.Text; Edit.maquinas = txtMaquinas.Text; Edit.herramientas = txtHerramientas.Text; Edit.emisiones = txtEmisiones.Text; Edit.productos = txtProductos.Text; Edit.desechos = txtDesechos.Text; Edit.foto = ruta; Edit.id_area = Convert.ToInt32(ddlArea.SelectedValue); } ObjUsuario.Error = CRUD.Edit_Fila(contextoEdit); if (ObjUsuario.Error) { GrupoLiEntities contexto = new GrupoLiEntities(); if (ddlEpp.SelectedValue != string.Empty) { foreach (ListItem li in ddlEpp.Items) { int idEpp = Convert.ToInt32(li.Value); if (li.Selected) { int existe = Mgr_PuestoTrabajo.Get_PuestoEppValue(idPuestos, idEpp); if (existe == 0) { puesto_trabajo_epp nuevopuestoEpp = new puesto_trabajo_epp() { id_puesto_trabajo = idPuestos, id_epp = idEpp }; ObjUsuario.Error = CRUD.Add_Fila(nuevopuestoEpp); } } else { int existe = Mgr_PuestoTrabajo.Get_PuestoEppValue(idPuestos, idEpp); if (existe == 1) { int idPEpp = Mgr_Epp.Get_Trae_ID_PEPP(idPuestos, idEpp); puesto_trabajo_epp tabla = new puesto_trabajo_epp(); ObjUsuario.Error = CRUD.Delete_Fila(tabla, idPEpp); } } } } } Modal.MostrarAlertaEdit(phAlerta, divAlerta, lbAlerta, ObjUsuario.Error, txtNombre); }