private void Btn_pagar_Click(object sender, EventArgs e) { if (buscarRecibo() == false) { confirmacion = MessageBox.Show("¿Están correctos los datos?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (confirmacion == DialogResult.Yes) { int r = 0; DateTime hoy = DateTime.Now; teso_gral o = new teso_gral(); o.Costo = Math.Round(Double.Parse(total.Text)); o.Depa = "Obras Publicas"; o.Nombre = nombre; o.Oficio = idof; o.Pase = subtotal.Text; o.Recibo = txt_recibo.Text; o.Tipo = ti; o.Fecha = hoy.ToString("yyyy/MM/dd"); o.Autoriza = lb_autoriza.SelectedItem.ToString(); o.Descuento = double.Parse(descuento.Text); r = add_tablas.anadirGral(o); if (r > 0) { MessageBox.Show("PAGO REGISTRADO CORRECTAMENTE"); } else { MessageBox.Show("NO SE PUDO REGISTRAR EL PAGO"); } using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_op SET " + "Recibo=@re, Costo=@c where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); comandoCO.Parameters.AddWithValue("c", total.Text); int p = comandoCO.ExecuteNonQuery(); } switch (ti) { case "Terminacion_obras": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE terminacion SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Reposicion_EP": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE repo_pavimento SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Pavimento_Asfaltico": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE repo_pavimentoH SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Pavimento_Hidraulico": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE repo_pavimentoH SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Numero_Oficial": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE numero_oficial SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Permiso_Demolicion": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE permiso_demolicion SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Edificacion_Antena": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE licencia_antena SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Perito_Oficial": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE constancia_direccion SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Carta_Ocupacion": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE carta_ocupacion SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Fusion_Lotes": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE Sol_fu_lot SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Uso_Suelo": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE uso_suelo SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Sub_Ter": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE subdivision SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Lic_cons_pago": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE Lic_cons_pago SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Licencia_Construccion_GE": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE licencia_de_construccion SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Permiso_Construir": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE permiso_construir SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Remodelacion_Construccion": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE rem_cons SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Medidas": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE medidas_colindancias SET " + "Recibo_de_Pago=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; } dgvTodo.DataSource = dt(); clear(); } txt_pase.Focus(); } else { MessageBox.Show("Recibo ya registrado. \nIngrese uno valido", "Alerta"); } }
private void BunifuThinButton23_Click(object sender, EventArgs e) { DateTime hoy = DateTime.Today; string fechaa = hoy.Year.ToString() + hoy.Month.ToString() + hoy.Day.ToString(); dr = MessageBox.Show("¿Estás Seguro?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dr == DialogResult.Yes) { teso_gral o = new teso_gral(); o.Costo = Double.Parse(txt_total.Text); o.Depa = "Secretaria de Ayuntamiento"; o.Nombre = nombre; o.Oficio = idof; o.Pase = txt_subtotal.Text; o.Recibo = txt_recibo.Text; o.Tipo = ti; o.Fecha = hoy.ToShortDateString(); o.Autoriza = lb_autoriza.SelectedItem.ToString(); o.Descuento = Int32.Parse(txt_desc.Text); r = add_tablas.anadirGral(o); if (r > 0) { MessageBox.Show("PAGO REGISTRADO CORRECTAMENTE"); } else { MessageBox.Show("NO SE PUDO REGISTRAR EL PAGO"); } // actualizar a sa using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_sa SET " + "Recibo=@re, Costo=@c where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); comandoCO.Parameters.AddWithValue("c", Double.Parse(txt_total.Text)); int p = comandoCO.ExecuteNonQuery(); } //actualizar a tablas independientes switch (ti) { case "Anuencia": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_anuencia SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; case "Conscripto": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_cons SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; case "Baja": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_baja SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; case "Cer_Re": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_cerre SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; case "Dependencia": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_depe SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; case "Escasos": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_esca SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; case "Anun": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_anun SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; case "LicFun": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_fun SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; case "Cons_Ori": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_ori SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; case "PerEven": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_even SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; case "Cer_Pos": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_pos SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; case "Cons_Res": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_res SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); if (p > 0) { MessageBox.Show("Pago Registrado"); } else { MessageBox.Show("No se pudo registrar el pago"); } } break; } } dgv.DataSource = tabla(); }
private void Btn_pagar_Click(object sender, EventArgs e) { int r = 0; DateTime hoy = DateTime.Now; teso_gral o = new teso_gral(); o.Costo = Math.Round(Double.Parse(total.Text)); o.Depa = "Panteones Mun."; o.Nombre = nombre; o.Oficio = idof; o.Pase = subtotal.Text; o.Recibo = txt_recibo.Text; o.Tipo = ti; o.Fecha = hoy.ToString("yyyy/MM/dd"); o.Autoriza = lb_autoriza.SelectedItem.ToString(); o.Descuento = Int32.Parse(txt_desc.Text); r = add_tablas.anadirGral(o); if (r > 0) { MessageBox.Show("PAGO REGISTRADO CORRECTAMENTE"); txt_pase.Focus(); } else { MessageBox.Show("NO SE PUDO REGISTRAR EL PAGO"); } using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE t_panteones SET " + "Recibo=@re, Costo=@c where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); comandoCO.Parameters.AddWithValue("c", total.Text); int p = comandoCO.ExecuteNonQuery(); } switch (ti) { case "Traslado": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE p_trasladO SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Cremación": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE p_cremacion SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Inhumación": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE p_inhumacion SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Inhumación Ejidos": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE p_inhumacionE SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Exhumacion": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE p_exhumacion SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; case "Lapidas": using (SqlConnection conCO = conexion.abrir()) { string q = "UPDATE p_lapidas SET " + "Recibo=@re where Oficio=@o"; SqlCommand comandoCO = new SqlCommand(q, conCO); comandoCO.Parameters.AddWithValue("o", idof); comandoCO.Parameters.AddWithValue("re", txt_recibo.Text); int p = comandoCO.ExecuteNonQuery(); } break; } dgvTodo.DataSource = dt(); }