private p_hipote formarCuerpo() { double solosueldo = globales.convertDouble(txtSueldobase.Text); solonumerosueldo = Convert.ToString(solosueldo); p_hipote hipote = new p_hipote(); hipote.rfc = txtRfc.Text; hipote.nombre_em = txtNombre_em.Text; hipote.direccion = txtDireccion.Text; hipote.tel_partic = txtTel_partic.Text; hipote.fecha_nac = globales.convertDatetime(txtFecha_nac.Text); hipote.sexo = txtsexo.Text; hipote.edad = globales.convertInt(txtEdad.Text); hipote.nombre_cony = txtNombre_cony.Text; hipote.edo_civil = txtEdo_civil.Text; hipote.secretaria = txtSecretaria.Text; hipote.descripcion = txtDescripcion.Text; hipote.tel_ofici = txtTel_ofic.Text; hipote.proyecto = txtProyecto.Text; hipote.cve_categ = txtCve_categ.Text; hipote.ccatdes = txtCcatdes.Text; hipote.f_nombram = globales.convertDatetime(txtF_nombram.Text); hipote.ant_a = globales.convertInt(txtAnt_a.Text); hipote.tipo_rel = txtTipo_rel.Text; hipote.sueldo_base = globales.convertDouble(txtSueldobase.Text); hipote.nomina = txtNomina.Text; hipote.direc_inmu = txtDire_inmueb.Text; return(hipote); }
private void btnGuardar_Click(object sender, EventArgs e) { p_hipote p = formarCuerpo(); if (txtExpediente.Text == "AUTOGENERADO") { if (string.IsNullOrWhiteSpace(txtRfc.Text)) { globales.MessageBoxExclamation("Favor de seleccionar RFC del empleado", "Aviso", globales.menuPrincipal); return; } string query = "SELECT COALESCE(max(folio)+1,1) as maximo FROM datos.p_hipote"; List <Dictionary <string, object> > lista = globales.consulta(query); string folio = Convert.ToString(lista[0]["maximo"]); p.folio = int.Parse(folio); nuevo(p); } else { if (string.IsNullOrWhiteSpace(txtExpediente.Text)) { globales.MessageBoxExclamation("Favor de ingresar expediente.", "Aviso", globales.menuPrincipal); return; } p.folio = globales.convertInt(txtExpediente.Text); actualiza(p); } limpiacampos(); btnFolio.Enabled = false; btnRfc.Enabled = false; btnsalir.Text = "SALIR"; }
private void actualiza(p_hipote obj) { try { dbaseORM orm = new dbaseORM(); bool actualizado = orm.update <p_hipote>(obj); if (actualizado) { globales.MessageBoxSuccess(" SE ACTUALIZO EL SIGUIENTE FOLIO: " + txtExpediente.Text, "REGISTRO ACTUALIZADO", globales.menuPrincipal); controles(false); limpiacampos(); btnGuardar.Enabled = false; btnGuardar.Visible = false; btnModifica.Enabled = true; btnModifica.Visible = true; btnNuevo.Visible = true; btnNuevo.Enabled = true; txtExpediente.Enabled = false; btnFolio.Enabled = false; txtExpediente.Text = ""; } else { globales.MessageBoxError("Error al actualizar el registro", "Aviso", globales.menuPrincipal); } } catch { } }
private bool guardarHipote() { p_hipote obj = new p_hipote(); obj.folio = globales.convertInt(txtExpediente.Text); obj.rfc = txtRfc.Text; obj.nombre_em = txtNombre_em.Text; obj.tel_ofici = txtTel_ofic.Text; obj.direccion = txtDireccion.Text; obj.secretaria = txtSecretaria.Text; obj.descripcion = txtDescripcion.Text; obj.direc_inmu = txtDirec_inmueb.Text; return(new dbaseORM().update <p_hipote>(obj)); }
private void btnP_hipote_Click(object sender, EventArgs e) { DialogResult dialogo = globales.MessageBoxQuestion("¿Deseas guardar los cambios?", "Aviso", globales.menuPrincipal); if (dialogo == DialogResult.No) { return; } if (string.IsNullOrWhiteSpace(txtExpediente.Text)) { globales.MessageBoxExclamation("Favor de elegir un expediente", "Aviso", globales.menuPrincipal); return; } dbaseORM orm = new dbaseORM(); p_hipote hipote = llenarHipote(); bool actualizado = orm.update <p_hipote>(hipote); if (actualizado) { string query = $"select expediente from datos.h_sretec where expediente = {txtExpediente.Text} and sec = '{this.secuencia}'"; List <Dictionary <string, object> > resultado = orm.query(query); h_sretec sretec = new h_sretec(); sretec.expediente = globales.convertInt(txtExpediente.Text); sretec.sec = Convert.ToString(this.secuencia); sretec = llenarSretec(sretec); if (resultado.Count == 0) { actualizado = orm.insert <h_sretec>(sretec); } else { actualizado = orm.update <h_sretec>(sretec); } if (actualizado) { globales.MessageBoxSuccess("Registro actualizado correctamente", "Aviso", globales.menuPrincipal); } } }
private void nuevo(p_hipote obj) { dbaseORM orm = new dbaseORM(); bool insertado = orm.insert <p_hipote>(obj); if (insertado) { globales.MessageBoxSuccess("NUEVO FOLIO AGREGADO:" + txtExpediente.Text, "PROCESO CORRECTO", globales.menuPrincipal); controles(false); limpiacampos(); btnGuardar.Enabled = false; btnGuardar.Visible = false; btnModifica.Enabled = true; btnModifica.Visible = true; btnNuevo.Visible = true; btnNuevo.Enabled = true; } else { globales.MessageBoxError("ERROR , CONTACTE A SISTEMAS", "Aviso", globales.menuPrincipal); } }