private void TXTLICDNI_KeyPress(object sender, KeyPressEventArgs e) { if ((int)e.KeyChar == (int)Keys.Enter) { String resultado = TP.DEV_PERSONAL_SEGUN_TRANSPORTE_X_LIC(TXTLICDNI.Text, Convert.ToInt32(comboBox2.SelectedValue)); if (resultado.Equals("NO ENCONTRADO")) { TXTLICDNI.Focus(); } else if (TXTLICDNI.Text == "") { MessageBox.Show(this, "NECESITA INDICAR EL DNI O LICENCIA", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { String[] separados = resultado.Split('|'); lblcodpers.Text = separados[0]; TXTLICDNI.Text = separados[3]; TXTNOMBRE.Text = separados[2]; comboBox3.Text = separados[1]; TXTNOMBRE.Focus(); } } }
private void textBox2_KeyPress(object sender, KeyPressEventArgs e) { String repetido = "NO"; for (int i = 0; i < dataGridView1.RowCount; i++) { if (dataGridView1.Rows[i].Cells["NOMBRE"].Value.ToString().Equals(TXTNOMBRE.Text) || dataGridView1.Rows[i].Cells["DOCUMENTO"].Value.ToString().Equals(TXTDNI.Text)) { repetido = "SI"; } } if ((int)e.KeyChar == (int)Keys.Enter) { if (TXTNOMBRE.Text == "") { MessageBox.Show(this, "NECESITA INDICAR EL NOMBRE", "GESTION INTERNA " + Application.ProductVersion, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (TXTDNI.Text == "") { MessageBox.Show(this, "NECESITA INDICAR EL DNI ", "GESTION INTERNA " + Application.ProductVersion, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (repetido.Equals("SI")) { MessageBox.Show("YA HAY UNA PERSONA CON ESTOS DATOS EN EL SISTEMA"); } else { dataGridView1.Rows.Add("VISITANTE", TXTNOMBRE.Text, TXTDNI.Text); TXTNOMBRE.Clear(); TXTDNI.Clear(); TXTNOMBRE.Focus(); } } }
private void TXTDNI_KeyPress_1(object sender, KeyPressEventArgs e) { if ((int)e.KeyChar == (int)Keys.Enter) { TXTNOMBRE.Focus(); } }
private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) { lblcodpers.Text = dataGridView2.CurrentRow.Cells["CODIGO"].Value.ToString(); TXTLICDNI.Text = dataGridView2.CurrentRow.Cells["DNI/LIC"].Value.ToString(); TXTNOMBRE.Text = dataGridView2.CurrentRow.Cells["NOMBRE"].Value.ToString(); comboBox3.Text = dataGridView2.CurrentRow.Cells["FUNCION"].Value.ToString(); panel4.Visible = false; TXTNOMBRE.Focus(); }
private void TXTDNI_KeyPress(object sender, KeyPressEventArgs e) { if ((int)e.KeyChar == (int)Keys.Enter) { if (TXTDNI.Text == "") { MessageBox.Show(this, "NECESITA INDICAR EL DNI ", "GESTION INTERNA " + Application.ProductVersion, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { TXTNOMBRE.Focus(); } } }
private void TXTNOMBRE_KeyPress(object sender, KeyPressEventArgs e) { if ((int)e.KeyChar == (int)Keys.Enter) { if (TXTNOMBRE.Text == "") { MessageBox.Show(this, "NECESITA INDICAR EL NOMBRE", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (TXTDNI.Text == "") { MessageBox.Show(this, "NECESITA INDICAR EL DNI O LICENCIA ", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { ds.REGISTRAR_DETALLE_VISITA(TXTNOMBRE.Text, TXTDNI.Text, Convert.ToInt32(LBLNUMERO.Text)); TXTNOMBRE.Clear(); TXTDNI.Clear(); TXTNOMBRE.Focus(); CARGAR_DETALLES(); } } }
private void TXTNOMBRE_KeyPress(object sender, KeyPressEventArgs e) { if ((int)e.KeyChar == (int)Keys.Enter) { if (TXTNOMBRE.Text == "") { MessageBox.Show(this, "NECESITA INDICAR EL NOMBRE", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (TXTLICDNI.Text == "") { MessageBox.Show(this, "NECESITA INDICAR EL DNI O LICENCIA", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { String rpta = "NO"; for (int i = 0; i < dataGridView1.RowCount; i++) { if (dataGridView1.Rows[i].Cells["DOCUMENTO"].Value.ToString().Equals(TXTLICDNI.Text) || dataGridView1.Rows[i].Cells["NOMBRE"].Value.ToString().Equals(TXTNOMBRE.Text)) { rpta = "SI"; } } if (rpta.Equals("NO")) { DESC.REGISTRAR_DETALLE_DESCARGA(TXTNOMBRE.Text, TXTLICDNI.Text, comboBox3.Text, Convert.ToInt32(LBLNUMERO.Text)); TXTNOMBRE.Clear(); TXTLICDNI.Clear(); TXTNOMBRE.Focus(); CARGAR_DETALLES(); } else { MessageBox.Show(this, "YA TENEMOS UN PERSONAL CON LOS DATOS INGRESADOS EN EL DETALLE", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void TXTNOMBRE_KeyPress(object sender, KeyPressEventArgs e) { if ((int)e.KeyChar == (int)Keys.Enter) { if (TXTLICDNI.Text == "") { MessageBox.Show(this, "NECESITA INDICAR EL DNI O LICENCIA", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (TXTNOMBRE.Text == "") { MessageBox.Show(this, "NECESITA INDICAR EL NOMBRE DEL TRANSPORTISTA", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { String rpta = "NO"; for (int i = 0; i < dataGridView1.RowCount; i++) { if (dataGridView1.Rows[i].Cells["DOCUMENTO"].Value.ToString().Equals(TXTLICDNI.Text) || dataGridView1.Rows[i].Cells["NOMBRE"].Value.ToString().Equals(TXTNOMBRE.Text)) { rpta = "SI"; } } if (rpta.Equals("NO")) { dataGridView1.Rows.Add(lblcodpers.Text, comboBox3.Text, TXTNOMBRE.Text, TXTLICDNI.Text); TXTNOMBRE.Clear(); TXTLICDNI.Clear(); TXTNOMBRE.Focus(); } else { MessageBox.Show(this, "YA HAY UN PERSONAL CON ESOS DATOS EN EL REGISTRO", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
public void Limpiar() { TXTNOMBRE.Clear(); TXTNOMBRE.Focus(); }
private void tsbNUEVO_Click(object sender, EventArgs e) { if (TXTID.Text == "") { errorProvider1.SetError(TXTID, "debe ingresar un ID"); TXTID.Focus(); return; } errorProvider1.SetError(TXTID, ""); if (existe(TXTID.Text)) { errorProvider1.SetError(TXTID, "ID del empleado ya registrado"); TXTID.Focus(); } if (TXTNOMBRE.Text == "") { errorProvider1.SetError(TXTNOMBRE, "debe ingresar un nombre"); TXTNOMBRE.Focus(); return; } errorProvider1.SetError(TXTNOMBRE, ""); if (TXTAPELLIDO.Text == "") { errorProvider1.SetError(TXTAPELLIDO, "debe ingresar un apellido"); TXTAPELLIDO.Focus(); return; } errorProvider1.SetError(TXTAPELLIDO, ""); Regex regEMAIL = new Regex(@"^(([^<>()[\]\\.,;:\s@\ ""]+" + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@" + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+" + @"[a-zA-Z]{2,}))$", RegexOptions.Compiled); if (!regEMAIL.IsMatch(TXTCORREO.Text)) { errorProvider1.SetError(TXTCORREO, "debe ingresar una direccion de correo valido"); TXTCORREO.Focus(); return; } errorProvider1.SetError(TXTCORREO, ""); decimal salario; if (!decimal.TryParse(TXTSALARIO.Text, out salario)) { errorProvider1.SetError(TXTSALARIO, "debe ingresar numeros"); TXTSALARIO.Focus(); return; } errorProvider1.SetError(TXTCORREO, ""); if (salario < 0) { errorProvider1.SetError(TXTSALARIO, "debe ingresar numeros positivos "); TXTSALARIO.Focus(); return; } PERSONA miPersona = new PERSONA(); miPersona.ID = TXTID.Text; miPersona.NOMBRE = TXTNOMBRE.Text; miPersona.CORREO = TXTCORREO.Text; miPersona.APELLIDO = TXTAPELLIDO.Text; miPersona.FECHA = DTPFECHANACIMIENTO.Value; miPersona.SALARIO = salario; PERSONAS.Add(miPersona); DGVDATOS.DataSource = null; DGVDATOS.DataSource = PERSONAS; TXTAPELLIDO.Clear(); TXTID.Clear(); TXTNOMBRE.Clear(); TXTCORREO.Clear(); TXTSALARIO.Clear(); TXTID.Focus(); }