protected void Button_RevertirRetiro_Click(object sender, EventArgs e) { decimal idEmpleado = Convert.ToDecimal(TextBox_id_empleado.Text); Retiro _r = new Retiro(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable _tablaResultado = _r.ReversarRetiroTemporal(idEmpleado); if (String.IsNullOrEmpty(_r.MensajeError) == false) { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, _r.MensajeError, Proceso.Error); } else { DataRow filaResultado = _tablaResultado.Rows[0]; if (filaResultado["TIPO"].ToString().ToUpper() == "ERROR") { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, filaResultado["MENSAJE"].ToString(), Proceso.Advertencia); } else { Limpiar(); Bloquear(); Cargar(idEmpleado); Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, filaResultado["MENSAJE"].ToString(), Proceso.Correcto); } } }
private void Buscar() { DataTable dataTable = new DataTable(); Retiro retiro; Ocultar(); retiro = new Retiro(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); try { dataTable = retiro.Consultar(TextBox_BUSCAR.Text); if (dataTable.Rows.Count > 0) { GridView_RESULTADOS_BUSQUEDA.DataSource = dataTable; GridView_RESULTADOS_BUSQUEDA.DataBind(); Mostrar(Acciones.Encontrar); } else { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "No se encontró información para " + this.DropDownList_BUSCAR.SelectedItem + " : " + this.TextBox_BUSCAR.Text , Proceso.Advertencia); } } catch (Exception e) { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, e.Message, Proceso.Error); } if (dataTable == null) dataTable.Dispose(); }
private void Cargar(decimal idEmpleado) { Retiro retiro = new Retiro(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable dataTable = new DataTable(); DataRow dataRow; Ocultar(); try { dataTable = retiro.ObtenerPorIdEmpleado(idEmpleado); if (dataTable.Rows.Count > 0) { dataRow = dataTable.Rows[0]; if (!string.IsNullOrEmpty(dataRow["regional"].ToString())) TextBox_regional.Text = dataRow["regional"].ToString(); if (!string.IsNullOrEmpty(dataRow["ciudad"].ToString())) TextBox_ciudad.Text = dataRow["ciudad"].ToString(); if (!string.IsNullOrEmpty(dataRow["empresa"].ToString())) TextBox_empresa.Text = dataRow["empresa"].ToString(); if (!string.IsNullOrEmpty(dataRow["id_empleado"].ToString())) TextBox_id_empleado.Text = dataRow["id_empleado"].ToString(); if (!string.IsNullOrEmpty(dataRow["activo"].ToString())) TextBox_activo.Text = dataRow["activo"].ToString(); if (!string.IsNullOrEmpty(dataRow["numero_documento"].ToString())) TextBox_numero_documento.Text = dataRow["numero_documento"].ToString(); if (!string.IsNullOrEmpty(dataRow["nombre"].ToString())) TextBox_nombre.Text = dataRow["nombre"].ToString(); if (!string.IsNullOrEmpty(dataRow["apellidos"].ToString())) TextBox_apellidos.Text = dataRow["apellidos"].ToString(); if (!string.IsNullOrEmpty(dataRow["cargo"].ToString())) TextBox_cargo.Text = dataRow["cargo"].ToString(); if (!string.IsNullOrEmpty(dataRow["fecha_ingreso"].ToString())) TextBox_fecha_ingreso.Text = dataRow["fecha_ingreso"].ToString(); if (!string.IsNullOrEmpty(dataRow["fecha_retiro"].ToString())) TextBox_fecha_retiro.Text = dataRow["fecha_retiro"].ToString(); if (!string.IsNullOrEmpty(dataRow["fecha_liquidacion"].ToString())) TextBox_fecha_liquidacion.Text = dataRow["fecha_liquidacion"].ToString(); if (!string.IsNullOrEmpty(dataRow["caso_severo"].ToString())) { if (dataRow["caso_severo"].ToString().Equals("S")) CheckBox_caso_severo.Checked = true; else CheckBox_caso_severo.Checked = false; } if (!string.IsNullOrEmpty(dataRow["embarazada"].ToString())) TextBox_regional.Text = dataRow["embarazada"].ToString(); { if (dataRow["caso_severo"].ToString().Equals("S")) CheckBox_embarazada.Checked = true; else CheckBox_embarazada.Checked = false; } if (!string.IsNullOrEmpty(dataRow["notas"].ToString())) TextBox_notas.Text = dataRow["notas"].ToString(); if (!string.IsNullOrEmpty(dataRow["estado"].ToString())) DropDownList_estado.SelectedValue = dataRow["estado"].ToString(); if (!string.IsNullOrEmpty(dataRow["carpeta"].ToString())) TextBox_carpeta.Text = dataRow["carpeta"].ToString(); HiddenField_Archivo.Value = dataRow["ARCHIVO"].ToString().Trim(); Mostrar(Acciones.Cargar); } } catch (Exception e) { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, e.Message, Proceso.Error); } if (dataTable != null) dataTable.Dispose(); }
private void Actualizar() { Retiro retiro; DateTime fecha = new DateTime(); Decimal idEmpleado = Convert.ToDecimal(TextBox_id_empleado.Text); retiro = new Retiro(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); try { if (retiro.Actualizar(idEmpleado, string.IsNullOrEmpty(TextBox_fecha_retiro.Text)? fecha:Convert.ToDateTime(TextBox_fecha_retiro.Text), TextBox_notas.Text, DropDownList_estado.SelectedValue, TextBox_carpeta.Text)) { Limpiar(); Bloquear(); Cargar(idEmpleado); Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "El retiro fue actualizado correctamente.", Proceso.Correcto); } else Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "Se genero un error al intentar actualizar el retiro.", Proceso.Error); } catch (Exception e) { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, e.Message, Proceso.Error); } }