private void btnAce_Click(object sender, EventArgs e) { if (txtNumPag.Text == "") { MessageBox.Show("Ingrese numero de pago", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); txtNumPag.Focus(); } else if (txtNomPag.Text == "") { MessageBox.Show("Ingrese nombre de pago", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); txtNomPag.Focus(); } else { ModoPago_Enc ModPag = new ModoPago_Enc(); ModPag.NumPag = Convert.ToInt32(txtNumPag.Text); ModPag.NomPag = txtNomPag.Text; ModPag.OtrDet = txtDetPago.Text; modPag.ModPag_Gua(ModPag); MessageBox.Show("Se registro el pago correctamente", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); txtNumPag.Text = ""; txtNomPag.Text = ""; txtDetPago.Text = ""; } }
public void ModPag_Gua(ModoPago_Enc ModPag) { using (SqlConnection cn = new SqlConnection(consulta)) { using (SqlCommand cmdGuaModPag = new SqlCommand("INSERT INTO Modo_Pago VALUES (@NumPag,@Nom,@OtrDet)", cn)) { cmdGuaModPag.Connection.Open(); cmdGuaModPag.CommandType = CommandType.Text; cmdGuaModPag.Parameters.Add("@NumPag", SqlDbType.Int).Value = ModPag.NumPag; cmdGuaModPag.Parameters.Add("@Nom", SqlDbType.NVarChar, 50).Value = ModPag.NomPag; cmdGuaModPag.Parameters.Add("@OtrDet", SqlDbType.NVarChar, 50).Value = ModPag.OtrDet; cmdGuaModPag.ExecuteNonQuery(); } } }
public void ModPag_Gua(ModoPago_Enc ModPag) { mogPag.ModPag_Gua(ModPag); }