private void frmLogin_Load(object sender, EventArgs e) { try { dtConfig = NConfig.Obtener(); if (dtConfig.Rows.Count != 0) { rowConfig = dtConfig.Rows[0]; this.lblTituloLogin.Text = rowConfig["titulo_sistema"].ToString(); this.groupBoxLogin.Enabled = true; this.txtUser.Focus(); } else { MessageBox.Show("No hay configuración default configurada en la base de datos.!"); this.groupBoxLogin.Enabled = false; this.Close(); } } catch (Exception) { MessageBox.Show("¡Problemas con la base de datos!"); //string error = ex.ToString(); this.groupBoxLogin.Enabled = false; this.Close(); } }
//private void LLenarGrid() //{ // this.dgvConfiguracion.DataSource = NConfig.Obtener(); //} private void MostrarDatos() { DataTable dt = new DataTable(); dt = NConfig.Obtener(); //llenamos el data-table if (dt.Rows.Count != 0) //verificamos si hay almenos una fila { DataRow row = dt.Rows[0]; //MensajeOK("Si hay filas en el data-table!"); this.txtIdConfig.Text = row["idconfig"].ToString(); this.txtTitulo.Text = row["titulo_sistema"].ToString(); this.txtNombre.Text = row["nombre_razon_social"].ToString(); this.txtComercialNombre.Text = row["nombre_comercial"].ToString(); this.txtSucursal.Text = row["nombre_sucursal"].ToString(); this.txtDirección.Text = row["direccion"].ToString(); this.txtTelefono.Text = row["telefono"].ToString(); this.txtCorreo.Text = row["correo"].ToString(); this.txtSlogan.Text = row["slogan"].ToString(); this.txtPropietario.Text = row["propietario"].ToString(); this.txtUserRoot.Text = row["usuario_root"].ToString(); this.txtPassRoot.Text = row["pass_root"].ToString(); this.txtGanancia.Value = Convert.ToDecimal(row["default_ganancia_venta"]); this.txtSeguro.Value = Convert.ToDecimal(row["default_seguro_deducido"]); this.txtISR.Value = Convert.ToDecimal(row["default_isr"]); this.txtISV.Value = Convert.ToDecimal(row["default_isv"]); this.txtDescuento.Value = Convert.ToDecimal(row["default_porc_descuento"]); this.txtRTN.Text = row["rtn"].ToString(); this.txtCAI.Text = row["cai"].ToString(); this.txtPuntoEmision.Text = row["punto_emision"].ToString(); this.txtEstablecimiento.Text = row["establecimiento"].ToString(); this.txtTipoDocumento.Text = row["tipo_documento"].ToString(); this.txtRangoInicial.Text = row["rango_inicial"].ToString(); this.txtRangoFinal.Text = row["rango_final"].ToString(); } else //sino hay filas en el data table { this.txtIdConfig.Text = ""; MensajeOK("No hay configuración creada!"); } }
/// <summary> /// Loads all the path information needed to configure NPrinting with third-party certificates. /// </summary> private void LoadNPrintingPaths() { // Qlik NPrinting Server June 2017 (17.4) or later string programData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); string newsStand = Path.Combine(programData, "NPrinting", "newsstandproxy"); string webConsole = Path.Combine(programData, "NPrinting", "webconsoleproxy"); string certFilename = "NPrinting.crt"; string keyFilename = "NPrinting.key"; NewsStand = new NConfig() { ConfigFolder = newsStand, ConfigFile = Path.Combine(newsStand, "app.conf"), SSLCertConfEntry = Path.Combine(newsStand, certFilename), SSLCertFile = Path.Combine(newsStand, certFilename), SSLKeyConfEntry = Path.Combine(newsStand, keyFilename), SSLKeyFile = Path.Combine(newsStand, keyFilename) }; WebConsole = new NConfig() { ConfigFolder = webConsole, ConfigFile = Path.Combine(webConsole, "app.conf"), SSLCertConfEntry = Path.Combine(webConsole, certFilename), SSLCertFile = Path.Combine(webConsole, certFilename), SSLKeyConfEntry = Path.Combine(webConsole, keyFilename), SSLKeyFile = Path.Combine(webConsole, keyFilename) }; if (File.Exists(NewsStand.ConfigFile) && File.Exists(WebConsole.ConfigFile)) { return; } // Qlik NPrinting Server February 2017 (17.3) or older until 17.0, since 16x is 32-bit. string programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); newsStand = Path.Combine(programFiles, "NPrintingServer", "proxy", "newsstandproxy", "src", "qlik.com", "newsstandproxy", "conf"); webConsole = Path.Combine(programFiles, "NPrintingServer", "proxy", "webconsoleproxy", "src", "qlik.com", "webconsoleproxy", "conf"); NewsStand = new NConfig() { ConfigFolder = newsStand, ConfigFile = Path.Combine(newsStand, "app.conf"), SSLCertConfEntry = Path.Combine(".", "src", "qlik.com", "newsstandproxy", "conf", certFilename), SSLCertFile = Path.Combine(newsStand, certFilename), SSLKeyConfEntry = Path.Combine(".", "src", "qlik.com", "newsstandproxy", "conf", keyFilename), SSLKeyFile = Path.Combine(newsStand, keyFilename) }; WebConsole = new NConfig() { ConfigFolder = webConsole, ConfigFile = Path.Combine(webConsole, "app.conf"), SSLCertConfEntry = Path.Combine(".", "src", "qlik.com", "webconsoleproxy", "conf", certFilename), SSLCertFile = Path.Combine(webConsole, certFilename), SSLKeyConfEntry = Path.Combine(".", "src", "qlik.com", "webconsoleproxy", "conf", keyFilename), SSLKeyFile = Path.Combine(webConsole, keyFilename) }; if (File.Exists(NewsStand.ConfigFile) && File.Exists(WebConsole.ConfigFile)) { return; } throw new FileNotFoundException("One or both configuration files for NPrinting are missing."); }
private void btnGuardarCambios_Click(object sender, EventArgs e) { //Guardar Datos try { string rpta = ""; if ( this.txtTitulo.Text == string.Empty || this.txtNombre.Text == string.Empty || this.txtComercialNombre.Text == string.Empty || this.txtSucursal.Text == string.Empty || this.txtUserRoot.Text == string.Empty || this.txtPassRoot.Text == string.Empty || this.txtRTN.Text == string.Empty || this.txtCAI.Text == string.Empty ) { MensajeError("Falta ingresar algunos datos, serán remarcados."); errorIcono.SetError(this.txtTitulo, "Ingrese titulo del sistema"); errorIcono.SetError(this.txtNombre, "Ingrese razon social de la empresa"); errorIcono.SetError(this.txtUserRoot, "Ingrese nombre de usuario root del sistema"); errorIcono.SetError(this.txtPassRoot, "Ingrese contraseña root del sistema"); errorIcono.SetError(this.txtNombre, "Ingrese RTN de la empresa (autogenerado)."); errorIcono.SetError(this.txtNombre, "Ingrese CAI de la empresa (autogenerado)."); errorIcono.SetError(this.txtComercialNombre, "Ingrese nombre comercial de la empresa"); errorIcono.SetError(this.txtSucursal, "Ingrese nombre de sucursal que usará el sistema"); } else { if (this.txtIdConfig.Text == "") { //nombre,descripcion,imagen,activa rpta = NConfig.Insertar( this.txtTitulo.Text, this.txtNombre.Text.ToUpper(), this.txtComercialNombre.Text.ToUpper(), this.txtSucursal.Text.ToUpper(), this.txtDirección.Text, this.txtTelefono.Text, this.txtCorreo.Text, this.txtSlogan.Text, this.txtPropietario.Text, this.txtUserRoot.Text, this.txtPassRoot.Text, Convert.ToDecimal(txtGanancia.Value), Convert.ToDecimal(txtSeguro.Value), Convert.ToDecimal(txtISR.Value), Convert.ToDecimal(txtISV.Value), Convert.ToDecimal(txtDescuento.Value), this.txtRTN.Text, this.txtCAI.Text, this.txtPuntoEmision.Text, this.txtEstablecimiento.Text, this.txtTipoDocumento.Text, this.txtRangoInicial.Text, this.txtRangoFinal.Text ); } else { //actualizar rpta = NConfig.Actualizar( Convert.ToInt32(this.txtIdConfig.Text), this.txtTitulo.Text, this.txtNombre.Text.ToUpper(), this.txtComercialNombre.Text.ToUpper(), this.txtSucursal.Text.ToUpper(), this.txtDirección.Text, this.txtTelefono.Text, this.txtCorreo.Text, this.txtSlogan.Text, this.txtPropietario.Text, this.txtUserRoot.Text, this.txtPassRoot.Text, Convert.ToDecimal(txtGanancia.Value), Convert.ToDecimal(txtSeguro.Value), Convert.ToDecimal(txtISR.Value), Convert.ToDecimal(txtISV.Value), Convert.ToDecimal(txtDescuento.Value), this.txtRTN.Text, this.txtCAI.Text, this.txtPuntoEmision.Text, this.txtEstablecimiento.Text, this.txtTipoDocumento.Text, this.txtRangoInicial.Text, this.txtRangoFinal.Text ); } if (rpta.Equals("OK")) { if (this.txtIdConfig.Text == "") { this.MensajeOK("Configuración nueva guardada."); } else { this.MensajeOK("Configuración actualizada."); } } else { this.MensajeError(rpta); } //preparamos para nuevos datos this.MostrarDatos(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }