private void mkcedula_Leave(object sender, EventArgs e) { CRUDempleados s = new CRUDempleados(); string cedula = mkcedula.Text; string ver = cedula.Replace("-", ""); if (ver.Length >= 11) { if (s.existe(cedula)) { MessageBox.Show("ESTA CEDULA YA ESTA REGISTRADA"); mkcedula.Text = string.Empty; mkcedula.Focus(); return; } } if (ver == "") { MessageBox.Show("ESTE CAMPO NO PUEDE ESTAR VACIO"); mkcedula.Text = string.Empty; mkcedula.Focus(); return; } }
private void btnGuardarCambios_Click(object sender, EventArgs e) { int id = Convert.ToInt32(txtId.Text); string nombre, direccion, cedula, telefono, sucursal, atrasP, fechaS, ocupacion; decimal sueldoB, horasE, seguroP; DateTime fechaE, fechaN; bool comida, actual; DateTime fecha = DateTime.Now.Date; nombre = txtnombre.Text; direccion = txtdireccion.Text; cedula = mkcedula.Text; telefono = mktelefono.Text; sucursal = cbosucursal.Text; atrasP = cboatras.Text; ocupacion = txtocupacion.Text; sueldoB = Convert.ToDecimal(txtsueldobruto.Text); fechaN = dpnacimiento.Value.Date; fechaE = dpentrada.Value.Date; fechaS = mkSalida.Text; if (chkcomida.Checked) { comida = true; } else { comida = false; } string fe = fechaS.Replace("-", ""); if (fe == string.Empty) { actual = true; } else { actual = false; } horasE = Convert.ToDecimal(txtextras.Text); seguroP = Convert.ToDecimal(txtseguro.Text); //sanM = Convert.ToDecimal(txtmayo.Text); CRUDempleados s = new CRUDempleados(); MessageBox.Show(s.Modificar(id, nombre, direccion, sucursal, atrasP, telefono, ocupacion, sueldoB, horasE, seguroP, comida, fechaS, actual)); txtId.Visible = false; lblId.Visible = false; btnCedula.Visible = false; btnComida.Visible = false; btnDireccion.Visible = false; btnSueldoB.Visible = false; btnOcupacion.Visible = false; btnHE.Visible = false; //btnSan.Visible = false; btnSeguro.Visible = false; button1.Visible = false; btnnombre.Visible = false; btnFechaS.Visible = false; btnAtras.Visible = false; txtdireccion.Enabled = false; txtextras.Enabled = false; // txtmayo.Enabled = false; txtnombre.Enabled = false; txtocupacion.Enabled = false; txtseguro.Enabled = false; txtsueldobruto.Enabled = false; mkcedula.Enabled = false; mktelefono.Enabled = false; cbosucursal.Enabled = false; chkcomida.Enabled = false;; dpentrada.Enabled = false; dpnacimiento.Enabled = false; mkSalida.Enabled = false; //POR AQUIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII txtdireccion.Text = string.Empty; txtextras.Text = string.Empty; //txtmayo.Text = string.Empty; txtnombre.Text = string.Empty; txtocupacion.Text = string.Empty; txtseguro.Text = string.Empty; txtsueldobruto.Text = string.Empty; mkcedula.Text = string.Empty; mktelefono.Text = string.Empty; cboatras.Text = "--ESCOGE UNA--"; cbosucursal.Text = "--ESCOGE UNA--"; cbosucursal.Enabled = false; cboatras.Enabled = false; chkcomida.Checked = false; dpentrada.Value = DateTime.Now.Date; dpnacimiento.Value = DateTime.Now.Date; mkSalida.Text = string.Empty; btnguardar.Enabled = false; btndeshacer.Enabled = false; btnGuardarCambios.Visible = false; timer1.Stop(); }
private void btneliminar_Click(object sender, EventArgs e) { int id = Convert.ToInt32(txtId.Text); CRUDempleados s = new CRUDempleados(); MessageBox.Show(s.Eliminar(id)); txtId.Visible = false; lblId.Visible = false; btnCedula.Visible = false; btnComida.Visible = false; btnDireccion.Visible = false; btnSueldoB.Visible = false; btnOcupacion.Visible = false; btnHE.Visible = false; // btnSan.Visible = false; btnSeguro.Visible = false; button1.Visible = false; btnnombre.Visible = false; btnFechaS.Visible = false; btnAtras.Visible = false; txtdireccion.Enabled = false; txtextras.Enabled = false; //txtmayo.Enabled = false; txtnombre.Enabled = false; txtocupacion.Enabled = false; txtseguro.Enabled = false; txtsueldobruto.Enabled = false; mkcedula.Enabled = false; mktelefono.Enabled = false; cbosucursal.Enabled = false; cboatras.Enabled = false; chkcomida.Enabled = false;; dpentrada.Enabled = false; dpnacimiento.Enabled = false; mkSalida.Enabled = false; txtdireccion.Text = string.Empty; txtextras.Text = string.Empty; //txtmayo.Text = string.Empty; txtnombre.Text = string.Empty; txtocupacion.Text = string.Empty; txtseguro.Text = string.Empty; txtsueldobruto.Text = string.Empty; mkcedula.Text = string.Empty; mktelefono.Text = string.Empty; cboatras.Text = "--ESCOGE UNA--"; cbosucursal.Text = "--ESCOGE UNA--"; cbosucursal.Enabled = false; chkcomida.Checked = false; dpentrada.Value = DateTime.Now.Date; dpnacimiento.Value = DateTime.Now.Date; mkSalida.Text = string.Empty; btnguardar.Enabled = false; btndeshacer.Enabled = false; }
private void btnguardar_Click(object sender, EventArgs e) { string nombre, direccion, cedula, telefono, sucursal, atrasP, ocupacion, fechaS; decimal sueldoB, horasE, seguroP; DateTime fechaE, fechaN; bool comida, actual; DateTime fecha = DateTime.Now.Date; if (txtnombre.Text == string.Empty) { MessageBox.Show("Este campo no puede estar vacio"); return; } if (txtdireccion.Text == string.Empty) { MessageBox.Show("Este campo no puede estar vacio"); return; } if (txtocupacion.Text == string.Empty) { MessageBox.Show("Este campo no puede estar vacio"); return; } if (txtsueldobruto.Text == string.Empty) { MessageBox.Show("Este campo no puede estar vacio"); return; } if (txtextras.Text == string.Empty) { horasE = 0; } else { horasE = Convert.ToDecimal(txtextras.Text); } if (txtseguro.Text == string.Empty) { seguroP = 0; } else { seguroP = Convert.ToDecimal(txtseguro.Text); } if (fecha == dpnacimiento.Value.Date) { MessageBox.Show("Fecha de nacimiento no puede ser igual a la actual"); return; } if (cboatras.Text == "--ESCOGE UNA--") { MessageBox.Show("No puedes dejar este campo vacio"); return; } if (cbosucursal.Text == "--ESCOGE UNA--") { MessageBox.Show("No puedes dejar este campo vacio"); return; } //FECHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA //=Iif(Day(Fields!fecha.Value)=15,"DEL 1 AL 15 DE "&UCase(MonthName(Month(Fields!fecha.Value)))&" DEL "&Year(Fields!fecha.Value),"DEL 16 AL "& Variables!fecha.Value &" DE "&UCase(MonthName(Month(Fields!fecha.Value)))&" DEL "&Year(Fields!fecha.Value)) nombre = txtnombre.Text; direccion = txtdireccion.Text; cedula = mkcedula.Text; telefono = mktelefono.Text; sucursal = cbosucursal.Text; atrasP = cboatras.Text; ocupacion = txtocupacion.Text; sueldoB = Convert.ToDecimal(txtsueldobruto.Text); //horasE = Convert.ToDecimal(txtextras.Text); fechaN = dpnacimiento.Value.Date; fechaE = dpentrada.Value.Date; fechaS = mkSalida.Text; if (chkcomida.Checked) { comida = true; } else { comida = false; } string fe = fechaS.Replace("-", ""); if (fe == string.Empty) { actual = true; } else { actual = false; } CRUDempleados s = new CRUDempleados(); MessageBox.Show(s.Agregar(nombre, cedula, direccion, telefono, fechaN, sucursal, atrasP, ocupacion, sueldoB, horasE, seguroP, comida, fechaE, fechaS, actual)); txtdireccion.Text = string.Empty; txtextras.Text = string.Empty; //txtmayo.Text = string.Empty; txtnombre.Text = string.Empty; txtocupacion.Text = string.Empty; txtseguro.Text = string.Empty; txtsueldobruto.Text = string.Empty; mkcedula.Text = string.Empty; mktelefono.Text = string.Empty; cboatras.Text = "--ESCOGE UNA--"; cbosucursal.Text = "--ESCOGE UNA--"; cbosucursal.Enabled = false; cboatras.Enabled = false; chkcomida.Checked = false; dpentrada.Value = DateTime.Now.Date; dpnacimiento.Value = DateTime.Now.Date; mkSalida.Text = string.Empty; btnguardar.Enabled = false; btndeshacer.Enabled = false; txtdireccion.Enabled = false; txtextras.Enabled = false; //txtmayo.Enabled = false; txtnombre.Enabled = false; txtocupacion.Enabled = false; txtseguro.Enabled = false; txtsueldobruto.Enabled = false; mkcedula.Enabled = false; mktelefono.Enabled = false; cbosucursal.Enabled = false; cboatras.Enabled = false; chkcomida.Enabled = false;; dpentrada.Enabled = false; dpnacimiento.Enabled = false; mkSalida.Enabled = false; }