public Clases._PERSONAL BuscarAnterior(Clases._PERSONAL PER) { dbSQLConn.ConecDb_Abrir(); Clases._PERSONAL usr = new Clases._PERSONAL(); NpgsqlDataReader Dr = null; string Sql = "SELECT " + Elementos + " FROM personal WHERE cedper < @cedper ORDER BY cedper DESC LIMIT 1"; NpgsqlCommand cmd = new NpgsqlCommand(Sql, dbSQLConn.Cnn); cmd.Parameters.AddWithValue("@cedper", PER.cedper); Dr = cmd.ExecuteReader(); if (Dr.HasRows) { Dr.Read(); usr = LLenar(Dr); Dr.Close(); dbSQLConn.ConecDb_Close(); return(usr); } else { Dr.Close(); dbSQLConn.ConecDb_Close(); return(BuscarPrimero()); } }
public Clases._PERSONAL BuscarPrimero() { dbSQLConn.ConecDb_Abrir(); Clases._PERSONAL usr = new Clases._PERSONAL(); NpgsqlDataReader Dr = null; string Sql = "SELECT " + Elementos + " FROM personal ORDER BY cedper ASC LIMIT 1 "; NpgsqlCommand cmd = new NpgsqlCommand(Sql, dbSQLConn.Cnn); Dr = cmd.ExecuteReader(); if (Dr.HasRows) { Dr.Read(); usr = LLenar(Dr); Dr.Close(); dbSQLConn.ConecDb_Close(); return(usr); } else { Dr.Close(); dbSQLConn.ConecDb_Close(); return(usr); } }
public FormPERSONAL(string[] _TUsuario) { InitializeComponent(); TUsuario = _TUsuario; BotonesNormal(true); PER = FunPER.BuscarUltimo(); Asignar(); }
private void Cmd_Guardar_Click(object sender, EventArgs e) { int vStaPer = 0; if (Che_StaPer.Checked) { vStaPer = 1; } else { vStaPer = 0; } int sRet = 0; if (radioButton1.Checked) { sRet = 1; } else { if (radioButton2.Checked) { sRet = 2; } } if (ValidarDatos()) { if (Evento.CompareTo("Nuevo") == 0) { PER = new Clases._PERSONAL(Convert.ToInt32(Txt_CedPer.Text), Txt_NomPer.Text, Txt_ApePer.Text, Com_NacPer.Text.Substring(0, 1), Dat_FenPer.Value.Date, Convert.ToInt32(Txt_CodDpt.Text), Convert.ToInt32(Txt_CodGco.Text), Dat_FeiPer.Value, Dat_FeePer.Value, sRet, vStaPer); if (FunPER.Nuevo(PER)) { MessageBox.Show("Se agregó correctamente.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Information); Bloqueos(); Actualizar(); } else { MessageBox.Show("El trabajador ya existe.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } else { PER = new Clases._PERSONAL(Convert.ToInt32(Txt_CedPer.Text), Txt_NomPer.Text, Txt_ApePer.Text, Com_NacPer.Text.Substring(0, 1), Dat_FenPer.Value, Convert.ToInt32(Txt_CodDpt.Text), Convert.ToInt32(Txt_CodGco.Text), Dat_FeiPer.Value, Dat_FeePer.Value, sRet, vStaPer); if (FunPER.Modificar(PER)) { MessageBox.Show("Se modificó correctamente.", "Atención ", MessageBoxButtons.OK, MessageBoxIcon.Information); Bloqueos(); Actualizar(); } else { MessageBox.Show("El grupo no existe en el sistema.", "Atención ", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } } }
private void Cmd_Buscar_Click(object sender, EventArgs e) { FormBUSQUEDAS f = new FormBUSQUEDAS(); f.ListaPersonal(); f.ShowDialog(); if (f._CedPer != "") { PER = FunPER.Buscar(Convert.ToInt32(f._CedPer)); Actualizar(); } }
private void FormPERSONAL_Load(object sender, EventArgs e) { PER = FunPER.BuscarUltimo(); Asignar(); }
private void Cmd_Cancelar_Click(object sender, EventArgs e) { Bloqueos(); PER = FunPER.BuscarUltimo(); Asignar(); }
private void Cmd_Ultimo_Click(object sender, EventArgs e) { PER = FunPER.BuscarUltimo(); Asignar(); }
private void Cmd_Siguiente_Click(object sender, EventArgs e) { PER = FunPER.BuscarSiguiente(PER); Asignar(); }
private void Cmd_Anterior_Click(object sender, EventArgs e) { PER = FunPER.BuscarAnterior(PER); Asignar(); }
private void Cmd_Primero_Click(object sender, EventArgs e) { PER = FunPER.BuscarPrimero(); Asignar(); }
private void Actualizar() { PER = FunPER.Buscar(PER.cedper); Asignar(); }