private void Eliminar() { //Metodo que se encarga de eliminar el folio try { SqlCommand sqlCom = new SqlCommand("SP_Borra_Departamento", XSQL.gSqlCon); sqlCom.CommandType = CommandType.StoredProcedure; SqlParameter parFolio; parFolio = new SqlParameter("@idDepartamento", SqlDbType.Int); parFolio.Value = usrNumeros1.txtNumero.Text; //Agregamos el parametro al SP sqlCom.Parameters.Add(parFolio); XSQL.gSqlCon.Open(); sqlCom.ExecuteNonQuery(); Mensajes.Aviso("Registro eliminado satisfactoriamente"); } catch (Exception ex) { Mensajes.Error("Accion no completada por el sig error" + ex.Message); } finally { XSQL.gSqlCon.Close(); } }
private void btnCrear_Click(object sender, EventArgs e) { string sTexto = ""; if (string.IsNullOrEmpty(txtContrasena.Text)) { sTexto = "Crear Clave de Acceso "; } else { sTexto = "Reiniciar Clave de Acceso"; } if (Mensajes.Pregunta("seguro que desea? " + sTexto)) { string sPass = Generales.CreaContrasena(); txtContrasena.Text = sPass; txtConfContrasena.Text = sPass; Mensajes.Aviso("La contraseña generada es " + sPass); } else if (string.IsNullOrEmpty(txtConfContrasena.Text)) { } else { Mensajes.Aviso("El usuario ya tiene una contraseña asignada"); } }
private void Eliminar() { int nId = Convert.ToInt16(usrNumFolio.nValor); cmd = new SqlCommand("SP_Borra_Cliente", XSQL.gSqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter pFolio = new SqlParameter("@idCliente", SqlDbType.Int); pFolio.Value = nId; cmd.Parameters.Add(pFolio); try { XSQL.gSqlCon.Open(); cmd.ExecuteNonQuery(); this.Nuevo(); Mensajes.Aviso("Registro Eliminado con el folio: " + nId.ToString()); } catch (Exception ex) { Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message); } finally { XSQL.gSqlCon.Close(); } }
private void Guardar() { int nFolio = Convert.ToInt16(usrNumFolio.nValor); string sNombre = txtNombre.Text; string sPassword = cifrar.EncryptKey(txtContrasena.Text); string sStatus = cbxEstatus.Text; bool sAdmin = chkEsAdmin.Checked; cmd = new SqlCommand("SP_Inserta_usuario", XSQL.gSqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter pFolio = new SqlParameter("@nId", SqlDbType.Int); pFolio.Direction = ParameterDirection.InputOutput; pFolio.Value = nFolio; cmd.Parameters.Add(pFolio); SqlParameter pNombre = new SqlParameter("@cNombre", SqlDbType.VarChar, 50); pNombre.Value = sNombre; cmd.Parameters.Add(pNombre); SqlParameter pPwd = new SqlParameter("@cContrasena", SqlDbType.VarChar, 400); pPwd.Value = sPassword; cmd.Parameters.Add(pPwd); SqlParameter pEstatus = new SqlParameter("@cEstatus", SqlDbType.VarChar, 20); pEstatus.Value = sStatus; cmd.Parameters.Add(pEstatus); SqlParameter pEs_admin = new SqlParameter("@bEs_Administrador", SqlDbType.Bit); pEs_admin.Value = sAdmin; cmd.Parameters.Add(pEs_admin); try { XSQL.gSqlCon.Open(); cmd.ExecuteNonQuery(); nFolio = (int)pFolio.Value; Mensajes.Aviso("Registro guardado con el folio: " + nFolio.ToString()); } catch (Exception ex) { Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message); } finally { XSQL.gSqlCon.Close(); } }
public void Guardar() { string sFamilia = this.txtDepartamento.Text; string sFolio = usrNumeros1.txtNumero.Text; //string sFolio = this.txtFolio.Text; int nFolio; if (string.IsNullOrEmpty(sFolio)) { nFolio = 0; } else { nFolio = Convert.ToInt16(sFolio); } SqlCommand sqlCom = new SqlCommand("SP_Registra_Departamento", XSQL.gSqlCon); sqlCom.CommandType = CommandType.StoredProcedure; //crear parametros SqlParameter parDeparamento; parDeparamento = new SqlParameter("@cNombre", SqlDbType.VarChar); parDeparamento.Value = sFamilia; sqlCom.Parameters.Add(parDeparamento); SqlParameter parFolio; parFolio = new SqlParameter("@nFolio", SqlDbType.Int); parFolio.Value = nFolio; parFolio.Direction = ParameterDirection.InputOutput; //Agregamos el parametro al SP sqlCom.Parameters.Add(parFolio); // Abrimos conexion try { XSQL.gSqlCon.Open(); sqlCom.ExecuteNonQuery(); nFolio = (int)parFolio.Value; this.usrNumeros1.txtNumero.Text = nFolio.ToString(); Mensajes.Aviso("Registro Guardado con el Folio " + nFolio.ToString()); } catch { Mensajes.Error("Ya existe esta departamento"); } finally { XSQL.gSqlCon.Close(); } }
private void btnAgregar_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(usrProductos.txtNumero.Text) || string.IsNullOrEmpty(txtDesdripProducto.Text)) { Mensajes.Aviso("capture todos los datos"); } else { this.CargaVenta(); this.sumaTotal(); } }
private void Guardar() { int nFolio = Convert.ToInt16(usrNumMod.nValor); string sNombre = txtNombreMod.Text; string sFormato = txtFormato.Text; bool sAdmin = chkEs_administrador.Checked; // sPassword = Encriptador.RijndaelSimple.Encriptar(sPassword); cmd = new SqlCommand("SP_Inserta_Modulo", XSQL.gSqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter pFolio = new SqlParameter("@nIdmodulo", SqlDbType.Int); pFolio.Direction = ParameterDirection.InputOutput; pFolio.Value = nFolio; cmd.Parameters.Add(pFolio); SqlParameter pNombre = new SqlParameter("@cNombremodulo", SqlDbType.VarChar, 50); pNombre.Value = sNombre; cmd.Parameters.Add(pNombre); SqlParameter pPwd = new SqlParameter("@cFormato", SqlDbType.VarChar, 50); pPwd.Value = sFormato; cmd.Parameters.Add(pPwd); SqlParameter pEs_admin = new SqlParameter("@bEs_Administrador", SqlDbType.Bit); pEs_admin.Value = sAdmin; cmd.Parameters.Add(pEs_admin); try { XSQL.gSqlCon.Open(); cmd.ExecuteNonQuery(); nFolio = (int)pFolio.Value; Mensajes.Aviso("Registro guardado con el folio: " + nFolio.ToString()); } catch (Exception ex) { Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message); } finally { XSQL.gSqlCon.Close(); } }
private void Guardar() { int nFolio = Convert.ToInt16(usrNumCajas.nValor); string sNombre = txtNombre.Text; string sMacaddres = txtMaccaddres.Text; bool bHabilita = chkHabilitada.Checked; cmd = new SqlCommand("SP_Inserta_Caja", XSQL.gSqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter pFolio = new SqlParameter("@nIdCaja", SqlDbType.Int); pFolio.Direction = ParameterDirection.InputOutput; pFolio.Value = nFolio; cmd.Parameters.Add(pFolio); SqlParameter pNombre = new SqlParameter("@nNombre", SqlDbType.VarChar, 50); pNombre.Value = sNombre; cmd.Parameters.Add(pNombre); SqlParameter pMacaddress = new SqlParameter("@nMacaddress", SqlDbType.VarChar, 50); pMacaddress.Value = sMacaddres; cmd.Parameters.Add(pMacaddress); SqlParameter pHabilita = new SqlParameter("@bHabilita", SqlDbType.Bit); pHabilita.Value = bHabilita; cmd.Parameters.Add(pHabilita); try { XSQL.gSqlCon.Open(); cmd.ExecuteNonQuery(); nFolio = (int)pFolio.Value; Mensajes.Aviso("Caja guardada con el folio: " + nFolio.ToString()); } catch (Exception ex) { Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message); } finally { XSQL.gSqlCon.Close(); } }
private void btnEliminar_Click(object sender, EventArgs e) { if (usrNumFolio.nValor > 0) { if (Mensajes.Pregunta("Deseas eliminar al cliente " + txtNombre.Text + " ?")) { this.Eliminar(); } } else { Mensajes.Aviso("No puedes eliminar a un cliente que no existe"); } }
private void btnDesbloquea_Click(object sender, EventArgs e) { serDesbloqueo serd = new serDesbloqueo(); serd.ShowDialog(); if (Generales.regresaValidacion()) { btnCierraTurno.Enabled = true; btnRetiro.Enabled = true; btnDesbloquea.Enabled = false; this.ControlaControles(true); } else { Mensajes.Aviso("Contraseña incorrecta"); } }
//metodo que se encarga de hacer la conexion al servidor private void Conectar() { //clase que hace la conexion a la base de datos Boolean bAutenticacion_W = this.chkAutWin.Checked; string sServidor = txtServidor.Text; string sBD = txtBD.Text; string sUsuario = txtUsuario.Text; string sPassword = txtPassword.Text; if (bAutenticacion_W) { //cadena de conexion con seguridad integrada sCadena = "Data Source= " + sServidor + "; Initial Catalog =" + sBD + ";Integrated Security=true;"; } else { //cadena de conexion con usuario especifico sCadena = "Data Source= " + sServidor + "; Initial Catalog =" + sBD + ";User Id=" + sUsuario + ";Password="******";"; } //se hace instancia a la clase de la conexion XSQL.SQLcon = new SqlConnection(sCadena); try { XSQL.SQLcon.Open(); //llamada a la clase mensaje Mensajes.Aviso("Conexion exitosa"); XSQL.SQLcon.Close(); // genera la cadena de conexion en un archivo de texto cadena.Escribe_datos(sServidor, sBD, Convert.ToString(bAutenticacion_W), sUsuario); } catch (Exception ex) { Mensajes.Error("Ha ocurrido un error en el sistema " + ex.Message); } }
private void bntCambiar_Click(object sender, EventArgs e) { if (Mensajes.Pregunta("Seguro que deseas Cambiar la contraseña?")) { Ser_CambiaContrasena ser = new Ser_CambiaContrasena(); ser.sPass = txtContrasena.Text; ser.ShowDialog(); string sNuevo = ser.sPass; if (sNuevo != txtContrasena.Text) { txtConfContrasena.Text = sNuevo; txtContrasena.Text = sNuevo; Mensajes.Aviso("Contraseña nueva " + sNuevo); } else { } } }
private void Carga_Contrasena() { string comando = "SP_Carga_Contrasena"; SqlCommand sp = new SqlCommand(comando, XSQL.gSqlCon); sp.CommandType = CommandType.StoredProcedure; SqlParameter pFolio = new SqlParameter("@nidusuario", SqlDbType.Int); pFolio.Value = Convert.ToDecimal(usrNumFolio.nValor); sp.Parameters.Add(pFolio); try { XSQL.gSqlCon.Open(); SqlDataReader dr = sp.ExecuteReader(); if (dr.Read()) { string desifra; desifra = dr[2].ToString(); this.txtContrasena.Text = Descifrar.DecryptKey(desifra); dr.Close(); } else { Mensajes.Aviso("No existe este Usuario o esta inactivo"); this.txtContrasena.Text = ""; } } catch (Exception ex) { Mensajes.Error("se presento un error" + ex.Message); } finally { XSQL.gSqlCon.Close(); } }
public void GuardaTurno() { int sCaja = Generales.nCaja; int sCajero = Generales.nUsuario; int nMonInicial = Convert.ToInt16(usrMonto.nValor); string sTipo = ""; if (rbtnPrimero.Checked) { sTipo = rbtnPrimero.Text; } else if (radioButton3.Checked) { sTipo = radioButton3.Text; } else if (radioButton4.Checked) { sTipo = radioButton4.Text; } else if (radioButton5.Checked) { sTipo = radioButton5.Text; } int nTurno = 0; cmd = new SqlCommand("SP_Registra_Turno", XSQL.gSqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter pTurno = new SqlParameter("@nTurno", SqlDbType.Int); pTurno.Direction = ParameterDirection.InputOutput; pTurno.Value = nTurno; cmd.Parameters.Add(pTurno); SqlParameter pCaja = new SqlParameter("@nCaja", SqlDbType.Int); pCaja.Value = sCaja; cmd.Parameters.Add(pCaja); SqlParameter pCajero = new SqlParameter("@nCajero", SqlDbType.Int); pCajero.Value = sCajero; cmd.Parameters.Add(pCajero); SqlParameter pMinicial = new SqlParameter("@nMonto_ini", SqlDbType.Money); pMinicial.Value = nMonInicial; cmd.Parameters.Add(pMinicial); SqlParameter pTipo = new SqlParameter("@nTipo", SqlDbType.VarChar, 20); pTipo.Value = sTipo; cmd.Parameters.Add(pTipo); try { XSQL.gSqlCon.Open(); cmd.ExecuteNonQuery(); Generales.nTurno = ( int)pTurno.Value; Mensajes.Aviso("Turno abierto con el folio " + Generales.nTurno.ToString()); } catch (Exception ex) { Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message); } finally { XSQL.gSqlCon.Close(); } }
private void Registra_Cliente() { int nFolio = Convert.ToInt16(usrNumFolio.txtNumero.Text); string sNombre = txtNombre.Text; string sApaterno = txtApaterno.Text; string sAmaterno = txtAmaterno.Text; string sTelefono = txtTelefono.Text; string sCelular = txtCelular.Text; string sDireccion = txtDireccion.Text; string sStatus = cbxEstatus.Text; int sLimdeCredito = Convert.ToInt16(usrNumLimCred.nValor); if (string.IsNullOrEmpty(txtNombre.Text) || string.IsNullOrEmpty(txtApaterno.Text) || string.IsNullOrEmpty(txtAmaterno.Text) || string.IsNullOrEmpty(txtDireccion.Text) || string.IsNullOrEmpty(usrNumLimCred.txtNumero.Text)) { Mensajes.Error("Llena los campos mandatorios"); if (string.IsNullOrEmpty(txtNombre.Text)) { txtNombre.BackColor = Color.Red; } if (string.IsNullOrEmpty(txtApaterno.Text)) { txtApaterno.BackColor = Color.Red; } if (string.IsNullOrEmpty(txtAmaterno.Text)) { txtAmaterno.BackColor = Color.Red; } if (string.IsNullOrEmpty(txtDireccion.Text)) { txtDireccion.BackColor = Color.Red; } if (string.IsNullOrEmpty(usrNumLimCred.txtNumero.Text)) { usrNumLimCred.txtNumero.BackColor = Color.Red; } } else { cmd = new SqlCommand("SP_Inserta_Cliente", XSQL.gSqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter pFolio = new SqlParameter("@nId", SqlDbType.Int); pFolio.Direction = ParameterDirection.InputOutput; pFolio.Value = nFolio; cmd.Parameters.Add(pFolio); SqlParameter pNombre = new SqlParameter("@cNombre", SqlDbType.VarChar, 50); pNombre.Value = sNombre; cmd.Parameters.Add(pNombre); SqlParameter pApaterno = new SqlParameter("@cApaterno", SqlDbType.VarChar, 50); pApaterno.Value = sApaterno; cmd.Parameters.Add(pApaterno); SqlParameter pAmaterno = new SqlParameter("@cAmaterno", SqlDbType.VarChar, 50); pAmaterno.Value = sAmaterno; cmd.Parameters.Add(pAmaterno); SqlParameter pTelefono = new SqlParameter("@cTelefono", SqlDbType.VarChar, 50); pTelefono.Value = sTelefono; cmd.Parameters.Add(pTelefono); SqlParameter pCelular = new SqlParameter("@cCelular", SqlDbType.VarChar, 50); pCelular.Value = sCelular; cmd.Parameters.Add(pCelular); SqlParameter pDireccion = new SqlParameter("@cDireccion", SqlDbType.VarChar, 80); pDireccion.Value = sDireccion; cmd.Parameters.Add(pDireccion); SqlParameter pEstatus = new SqlParameter("@cEstatus", SqlDbType.VarChar, 50); pEstatus.Value = sStatus; cmd.Parameters.Add(pEstatus); SqlParameter pLimCredito = new SqlParameter("@mLimCredito", SqlDbType.Int); pLimCredito.Value = sLimdeCredito; cmd.Parameters.Add(pLimCredito); try { XSQL.gSqlCon.Open(); cmd.ExecuteNonQuery(); nFolio = (int)pFolio.Value; Mensajes.Aviso("Registro guardado con el folio: " + nFolio.ToString()); } catch (Exception ex) { Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message); } finally { XSQL.gSqlCon.Close(); } } }
private void Guardar() { int nFolio = Convert.ToInt16(usrNumProd.nValor); string sProducto = txtProducto.Text; string sBarCode = txtCodBar.Text; string sClave = txtClave.Text; double sImpuesto = Convert.ToDouble(usrNumTasa.txtNumero.Text); bool sSeCuenta = chkSecuenta.Checked; decimal sPrecio = Convert.ToDecimal(usrPrecio.txtNumero.Text); cmd = new SqlCommand("SP_Inserta_Producto", XSQL.gSqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter pFolio = new SqlParameter("@nIdProducto", SqlDbType.Int); pFolio.Direction = ParameterDirection.InputOutput; pFolio.Value = nFolio; cmd.Parameters.Add(pFolio); SqlParameter pProducto = new SqlParameter("@cProducto", SqlDbType.VarChar, 50); pProducto.Value = sProducto; cmd.Parameters.Add(pProducto); SqlParameter pDepartamento = new SqlParameter("@nDepartamento", SqlDbType.VarChar, 50); pDepartamento.Value = cbxDepartamento.SelectedValue; cmd.Parameters.Add(pDepartamento); SqlParameter pCodBarras = new SqlParameter("@cCodBarras", SqlDbType.VarChar, 50); pCodBarras.Value = sBarCode; cmd.Parameters.Add(pCodBarras); SqlParameter pSeCuenta = new SqlParameter("@bSeCuenta", SqlDbType.Bit); pSeCuenta.Value = sSeCuenta; cmd.Parameters.Add(pSeCuenta); SqlParameter pClave = new SqlParameter("@cClave", SqlDbType.VarChar, 20); pClave.Value = sClave; cmd.Parameters.Add(pClave); SqlParameter pTasaInt = new SqlParameter("@nTasaInteres", SqlDbType.Money); pTasaInt.Value = sImpuesto; cmd.Parameters.Add(pTasaInt); SqlParameter pPrecio = new SqlParameter("@nPrecio", SqlDbType.Decimal); pPrecio.Value = sPrecio; cmd.Parameters.Add(pPrecio); try { XSQL.gSqlCon.Open(); cmd.ExecuteNonQuery(); nFolio = (int)pFolio.Value; Mensajes.Aviso("Registro guardado con el folio: " + nFolio.ToString()); } catch (Exception ex) { Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message); } finally { XSQL.gSqlCon.Close(); } }
public void CierraTurno() { int nTurno = Generales.nTurno; int nMonFinal = Convert.ToInt16(usrMontoFin.nValor); string sEstado = ""; if (rbtnPrimero.Checked) { sEstado = rbtnPrimero.Text; } else if (radioButton3.Checked) { sEstado = radioButton3.Text; } if (sEstado == "Definitivo" & usrMontoFin.nValor == 0) { this.usrMontoFin.txtNumero.BackColor = Color.Red; Mensajes.Aviso("Captura el monto final"); } else { cmd = new SqlCommand("SP_Cierra_Turno", XSQL.gSqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter pTurno = new SqlParameter("@nTurno", SqlDbType.Int); pTurno.Direction = ParameterDirection.InputOutput; pTurno.Value = nTurno; cmd.Parameters.Add(pTurno); SqlParameter pEstado = new SqlParameter("@sEstado", SqlDbType.VarChar, 50); pEstado.Value = sEstado; cmd.Parameters.Add(pEstado); SqlParameter pMonFinal = new SqlParameter("@nMonto_Fin", SqlDbType.Money); pMonFinal.Value = nMonFinal; cmd.Parameters.Add(pMonFinal); try { XSQL.gSqlCon.Open(); cmd.ExecuteNonQuery(); nTurno = (int)pTurno.Value; if (sEstado == "Temporal") { Mensajes.Aviso("Turno cerrado Temporalmente con el folio " + nTurno.ToString()); this.Close(); } else { Mensajes.Aviso("Turno cerrado Definitivamente con el folio " + nTurno.ToString()); this.Close(); } } catch (Exception ex) { Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message); } finally { XSQL.gSqlCon.Close(); } } }
public void GuardaRetiro() { int sCaja = Generales.nCaja; int sCajero = Generales.nUsuario; int nMonInicial = Convert.ToInt16(usrMonto.nValor); string sConcepto = txtConcepto.Text; string sTipo = ""; if (rbtnPrimero.Checked) { sTipo = rbtnPrimero.Text; } else if (radioButton3.Checked) { sTipo = radioButton3.Text; } else if (radioButton1.Checked) { sTipo = radioButton1.Text; } int nTurno = Generales.nCaja; if (usrMonto.nValor == 0) { Mensajes.Aviso("Ingresa la cantidad a retirar"); this.usrMonto.txtNumero.BackColor = Color.Red; } else { cmd = new SqlCommand("SP_Registra_Retiro", XSQL.gSqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter pTurno = new SqlParameter("@nTurno", SqlDbType.Int); //pTurno.Direction = ParameterDirection.InputOutput; pTurno.Value = nTurno; cmd.Parameters.Add(pTurno); SqlParameter pCaja = new SqlParameter("@nCaja", SqlDbType.Int); pCaja.Value = sCaja; cmd.Parameters.Add(pCaja); SqlParameter pCajero = new SqlParameter("@nCajero", SqlDbType.Int); pCajero.Value = sCajero; cmd.Parameters.Add(pCajero); SqlParameter pUsuario = new SqlParameter("@idSupervisor", SqlDbType.VarChar, 50); pUsuario.Value = cbxUsuario.SelectedValue; cmd.Parameters.Add(pUsuario); SqlParameter pMinicial = new SqlParameter("@nImporte", SqlDbType.Money); pMinicial.Value = nMonInicial; cmd.Parameters.Add(pMinicial); SqlParameter pConcepto = new SqlParameter("@nConcepto", SqlDbType.VarChar, 50); pConcepto.Value = sConcepto; cmd.Parameters.Add(pConcepto); SqlParameter pTipo = new SqlParameter("@nTipo", SqlDbType.VarChar, 20); pTipo.Value = sTipo; cmd.Parameters.Add(pTipo); SqlParameter pidTurno = new SqlParameter("@nIdturno", SqlDbType.Int); pidTurno.Value = Generales.nTurno; cmd.Parameters.Add(pidTurno); try { XSQL.gSqlCon.Open(); cmd.ExecuteNonQuery(); // Generales.nTurno = (int)pTurno.Value; Mensajes.Aviso("Registro guardado Satisfactoriamente "); } catch (Exception ex) { Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message); } finally { XSQL.gSqlCon.Close(); } this.Close(); } }
public void GuardaVenta() { int nFolioVenta = 0; int sCaja = Generales.nCaja; int sCajero = Generales.nUsuario; decimal nCambio = Generales.Cambio; string sDireccion = "lomas taurinas"; int nTurno = Generales.nTurno; decimal Subtotal = Generales.subtotal; decimal nIVA = Convert.ToDecimal(txtIva.Text); decimal nTotal = Convert.ToDecimal(txtTotal.Text); int nCantidad = Convert.ToInt16(txtCantArticulos.Text); cmd = new SqlCommand("SP_Registra_Venta", XSQL.gSqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter pVenta = new SqlParameter("@nVenta", SqlDbType.Int); pVenta.Direction = ParameterDirection.InputOutput; pVenta.Value = nFolioVenta; cmd.Parameters.Add(pVenta); SqlParameter pCajero = new SqlParameter("@nCajero", SqlDbType.Int); pCajero.Value = sCajero; cmd.Parameters.Add(pCajero); SqlParameter pDireccion = new SqlParameter("@sDireccion", SqlDbType.VarChar, 50); pDireccion.Value = sDireccion; cmd.Parameters.Add(pDireccion); SqlParameter pCaja = new SqlParameter("@nCaja", SqlDbType.Int); pCaja.Value = sCaja; cmd.Parameters.Add(pCaja); SqlParameter pTurno = new SqlParameter("@nTurno", SqlDbType.Int); pTurno.Value = nTurno; cmd.Parameters.Add(pTurno); SqlParameter pCambio = new SqlParameter("@nCambio", SqlDbType.Money); pCambio.Value = Generales.Cambio; cmd.Parameters.Add(pCambio); SqlParameter pSubtotal = new SqlParameter("@nSubtotal", SqlDbType.Money); pSubtotal.Value = Subtotal; cmd.Parameters.Add(pSubtotal); SqlParameter pIva = new SqlParameter("@nIva", SqlDbType.Money); pIva.Value = nIVA; cmd.Parameters.Add(pIva); SqlParameter pTotal = new SqlParameter("@nTotal", SqlDbType.Money); pTotal.Value = nTotal; cmd.Parameters.Add(pTotal); SqlParameter pCantidad = new SqlParameter("@nCantidad", SqlDbType.Int); pCantidad.Value = nCantidad; cmd.Parameters.Add(pCantidad); try { XSQL.gSqlCon.Open(); cmd.ExecuteNonQuery(); Generales.gFolioVentas = (int)pVenta.Value; Mensajes.Aviso("Gracias por su compra "); } catch (Exception ex) { Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message); } finally { XSQL.gSqlCon.Close(); } }