private void btnAce_Click(object sender, EventArgs e) { if (txtFac.Text == "") { MessageBox.Show("Ingrese factura", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); txtFac.Focus(); } else if (txtNumPag.Text == "") { MessageBox.Show("Ingrese numero de pago", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); txtNumPag.Focus(); } else if (txtCli.Text == "") { MessageBox.Show("Ingrese cliente", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); txtCli.Focus(); } else { Factura_Enc Fac = new Factura_Enc(); Fac.NumFac = txtFac.Text; Fac.NumPag = Convert.ToInt32(txtNumPag.Text); Fac.Fec = Convert.ToDateTime(txtFecEmi.Text); Fac.IdCli = Convert.ToInt32(txtId.Text); fac.Fac_GuaEnc(Fac); MessageBox.Show("Regristro con éxito", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); Fac_LimText(); } }
public void Fac_GuaEnc(Factura_Enc Fac) { using (SqlConnection cn = new SqlConnection(consulta)) { using (SqlCommand cmdGuaFac = new SqlCommand("SP_GuaFac", cn)) { cmdGuaFac.Connection.Open(); cmdGuaFac.CommandType = CommandType.StoredProcedure; cmdGuaFac.Parameters.Add("@IdCli", SqlDbType.Int).Value = Fac.IdCli; cmdGuaFac.Parameters.Add("@Fec", SqlDbType.SmallDateTime).Value = Fac.Fec; cmdGuaFac.Parameters.Add("@NumPag", SqlDbType.Int).Value = Fac.NumPag; cmdGuaFac.Parameters.Add("@NumFac", SqlDbType.NVarChar, 50).Value = Fac.NumFac; cmdGuaFac.ExecuteNonQuery(); } } }
public void Fac_GuaEnc(Factura_Enc Fac) { fac.Fac_GuaEnc(Fac); }