protected void BuscarActivoEnTabla() { DataTable Activos = new DataTable(); DataRow dtRow; bool SeEncontroActivo = false; EtiquetaMensaje.Text = ""; if (CodigoBarraParticular.Text.Trim() != "") { Activos = ObtenerEstructuraTabla(); //Se barre el grid y se pasan los activos al datatable foreach (GridViewRow Renglon in TablaLevantamiento.Rows) { dtRow = Activos.NewRow(); dtRow["ActivoId"] = TablaLevantamiento.DataKeys[Renglon.RowIndex]["ActivoId"].ToString(); dtRow["DescripcionPadre"] = TablaLevantamiento.DataKeys[Renglon.RowIndex]["DescripcionPadre"].ToString(); dtRow["Descripcion"] = TablaLevantamiento.DataKeys[Renglon.RowIndex]["Descripcion"].ToString(); dtRow["NumeroSerie"] = TablaLevantamiento.DataKeys[Renglon.RowIndex]["NumeroSerie"].ToString(); dtRow["Modelo"] = TablaLevantamiento.DataKeys[Renglon.RowIndex]["Modelo"].ToString(); dtRow["Color"] = TablaLevantamiento.DataKeys[Renglon.RowIndex]["Color"].ToString(); dtRow["CodigoBarrasParticular"] = TablaLevantamiento.DataKeys[Renglon.RowIndex]["CodigoBarrasParticular"].ToString(); //Si el código de barras es igual, se marca como Localizado if (Renglon.Cells[5].Text == CodigoBarraParticular.Text.Trim()) { if (Int16.Parse(TablaLevantamiento.DataKeys[Renglon.RowIndex]["EstatusID"].ToString()) == (Int16)ConstantePrograma.EstatusLevantamiento.SinLocalizar) { dtRow["NombreEstatus"] = "Localizado"; dtRow["EstatusID"] = (Int16)ConstantePrograma.EstatusLevantamiento.Localizado; } else { dtRow["NombreEstatus"] = TablaLevantamiento.DataKeys[Renglon.RowIndex]["NombreEstatus"].ToString(); dtRow["EstatusID"] = TablaLevantamiento.DataKeys[Renglon.RowIndex]["EstatusID"].ToString(); } SeEncontroActivo = true; } else { dtRow["NombreEstatus"] = TablaLevantamiento.DataKeys[Renglon.RowIndex]["NombreEstatus"].ToString(); dtRow["EstatusID"] = TablaLevantamiento.DataKeys[Renglon.RowIndex]["EstatusID"].ToString(); } Activos.Rows.Add(dtRow); } Activos.AcceptChanges(); if (SeEncontroActivo == false) { Activos = AgregarActivo(Activos); } TablaLevantamiento.DataSource = Activos; TablaLevantamiento.DataBind(); CodigoBarraParticular.Text = ""; CodigoBarraParticular.Focus(); } }
protected void BuscarEmpleado(EmpleadoEntidad EmpleadoEntidadObjeto) { ResultadoEntidad Resultado = new ResultadoEntidad(); EmpleadoProceso EmpleadoProcesoObjeto = new EmpleadoProceso(); EtiquetaMensajeExito.Text = ""; BotonImprimir.Enabled = false; LevantamientoCorrectoHidden.Value = "SI"; EmpIdHidden.Value = "0"; Resultado = EmpleadoProcesoObjeto.SeleccionarEmpleado(EmpleadoEntidadObjeto); if (Resultado.ErrorId == 0) { if (Resultado.ResultadoDatos.Tables[0].Rows.Count == 1) { if (Int16.Parse(Resultado.ResultadoDatos.Tables[0].Rows[0]["EstatusId"].ToString()) != (Int16)ConstantePrograma.EstatusEmpleados.Activo) { NumeroEmpleado.Enabled = true; CodigoBarraParticular.Enabled = false; EmpleadoIdHidden.Value = "0"; NombreEmpleado.Text = ""; EtiquetaMensaje.Text = TextoError.EmpleadoInactivo; TablaLevantamiento.DataSource = null; TablaLevantamiento.DataBind(); NumeroEmpleado.Focus(); } else { NumeroEmpleado.Enabled = false; CodigoBarraParticular.Enabled = true; NombreEmpleado.Text = Resultado.ResultadoDatos.Tables[0].Rows[0]["NombreEmpleadoCompleto"].ToString(); EmpleadoIdHidden.Value = Resultado.ResultadoDatos.Tables[0].Rows[0]["EmpleadoId"].ToString(); NumeroEmpleado.Text = Resultado.ResultadoDatos.Tables[0].Rows[0]["NumeroEmpleado"].ToString(); SeleccionarAsignacion(Int16.Parse(Resultado.ResultadoDatos.Tables[0].Rows[0]["EmpleadoId"].ToString())); EtiquetaMensaje.Text = ""; CodigoBarraParticular.Focus(); } } else { NumeroEmpleado.Enabled = true; CodigoBarraParticular.Enabled = false; EmpleadoIdHidden.Value = "0"; NombreEmpleado.Text = ""; EtiquetaMensaje.Text = TextoError.EmpleadoNoEncontrado; TablaLevantamiento.DataSource = null; TablaLevantamiento.DataBind(); NumeroEmpleado.Focus(); } } else { NumeroEmpleado.Enabled = true; CodigoBarraParticular.Enabled = false; EmpleadoIdHidden.Value = "0"; NombreEmpleado.Text = ""; TablaLevantamiento.DataSource = null; TablaLevantamiento.DataBind(); EtiquetaMensaje.Text = TextoError.ErrorGenerico; } }