Esempio n. 1
0
        private void btnProbarConnMicrosip_Click(object sender, EventArgs e)
        {
            try
            {
                Modelos.ConectionString.connFB = string.Format(
                    "User={0};Password={1};Database={2};DataSource={3};Port={4}",
                    this.tbUsuarioM.Text,
                    this.tbContraseniaM.Text,
                    this.tbBaseDatosM.Text,
                    this.tbServidorM.Text,
                    this.tbPuertoM.Text);

                this._consultasFBNegocio = new ConsultasFBNegocio();

                bool pruebaConn = this._consultasFBNegocio.pruebaConn();

                if (pruebaConn)
                {
                    MessageBox.Show("Conexión Exitosa!!!", "Configuración", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    throw new Exception("Falló la conexión a la base de datos del Microsip");
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Configuración", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                this._consultasFBNegocio    = new ConsultasFBNegocio();
                this._consultasMySQLNegocio = new ConsultasMySQLNegocio();

                this.gcPreciosArt.DataSource      = new List <Modelos.Articulos>();
                this.gcArticActualizar.DataSource = new List <Modelos.Articulos>();

                // Create the ToolTip and associate with the Form container.
                ToolTip toolTip1 = new ToolTip();

                // Set up the delays for the ToolTip.
                toolTip1.AutoPopDelay = 5000;
                toolTip1.InitialDelay = 1000;
                toolTip1.ReshowDelay  = 500;

                // Force the ToolTip text to be displayed whether or not the form is active.
                toolTip1.ShowAlways = true;

                // Set up the ToolTip text for the Button and Checkbox.
                toolTip1.SetToolTip(this.btnCargaArti, "Carga los Artículos con sus precios desde Microsip");
                toolTip1.SetToolTip(this.btnAgregarArt, "Agregar los seleccionados a la lista de Artículos a Actualizar");
                toolTip1.SetToolTip(this.btnQuitarArt, "Quitar los seleccionados de la lista de Artículos a Actualizar");
                toolTip1.SetToolTip(this.btnQuitarTodos, "Limpiar la lista de Artículos a Actualizar");
                toolTip1.SetToolTip(this.btnGuarda, "Guarda todos los cambios realizados a los Artículos");
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Actualizar Precios Carnicerías", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        public frmLogin()
        {
            InitializeComponent();

            this.ActiveControl       = this.tbUsuario;
            this._consultasFBNegocio = new ConsultasFBNegocio();
        }
        public frmAtlaUsuario()
        {
            InitializeComponent();

            this.ActiveControl          = this.tbNombre;
            this._consultasMySQLNegocio = new ConsultasMySQLNegocio();
            this._consultasFBNegocio    = new ConsultasFBNegocio();
        }
Esempio n. 5
0
        public frmCambiarClave(string usuario, int idUsuario)
        {
            InitializeComponent();

            this._usuario               = usuario;
            this._idUsuario             = idUsuario;
            this._consultasMySQLNegocio = new ConsultasMySQLNegocio();
            this._consultasFBNegocio    = new ConsultasFBNegocio();
        }
        private void btnAcceder_Click(object sender, EventArgs e)
        {
            try
            {
                this._consultasMySQLNegocio = new ConsultasMySQLNegocio();
                this._consultasFBNegocio    = new ConsultasFBNegocio();

                // validaciones
                if (string.IsNullOrEmpty(this.tbUsuario.Text))
                {
                    throw new Exception("Llene el campo Usuario");
                }

                if (string.IsNullOrEmpty(this.tbPass.Text))
                {
                    throw new Exception("Llene el campo Clave");
                }

                Modelos.Response resp = this._consultasMySQLNegocio.validaAcceso(this.tbUsuario.Text, this.tbPass.Text);

                if (resp.status == Modelos.Estatus.OK)
                {
                    // almacenar credeniales
                    Modelos.Login.idUsuario = resp.usuario.idUsuario;
                    Modelos.Login.nombre    = resp.usuario.nombreCompleto;
                    Modelos.Login.usuario   = resp.usuario.usuario;

                    string fecha = getFechaFireBird();

                    // bitacora
                    this._consultasMySQLNegocio.generaBitacora(
                        "Nuevo Acceso a usuario '" + Modelos.Login.nombre + "'", fecha);

                    this.Hide();
                    new FormPrincipal().ShowDialog();
                    this.Close();
                }
                else
                {
                    throw new Exception(resp.error);
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 7
0
        private void FormPrincipal_Load(object sender, EventArgs e)
        {
            try
            {
                this._sucursal = " " + Modelos.Login.sucursal;

                this.lbLeyenda.Text += this._sucursal;

                this._consultasFBNegocio    = new ConsultasFBNegocio();
                this._consultasMySQLNegocio = new ConsultasMySQLNegocio();

                this.verificarInformacionPendiente();
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Actualizar Precios Carnicerías", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private void FormPrincipal_Load(object sender, EventArgs e)
        {
            try
            {
                // valida si ya tiene alguna clave guardada para el archivo
                string cveActual = Properties.Settings.Default.accesoConfig;

                if (string.IsNullOrEmpty(cveActual))
                {
                    string acceso = Modelos.Utilerias.Transform("p4ssw0rd");

                    Properties.Settings.Default.accesoConfig = acceso;
                    Properties.Settings.Default.Save();
                }

                string fileName       = "config.dat";
                string pathConfigFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\CalcCostos\";

                // si no existe el directorio, lo crea
                bool exists = System.IO.Directory.Exists(pathConfigFile);

                if (!exists)
                {
                    System.IO.Directory.CreateDirectory(pathConfigFile);
                }

                // busca en el directorio si exite el archivo con el nombre dado
                var file = Directory.GetFiles(pathConfigFile, fileName, SearchOption.AllDirectories)
                           .FirstOrDefault();

                if (file == null)
                {
                    // no existe
                    // abrir el formulario para llenar la configuracion de conexion
                    frmConfiguracion form = new frmConfiguracion();
                    var resultado         = form.ShowDialog();

                    if (resultado != System.Windows.Forms.DialogResult.OK)
                    {
                        this._defConfig = false;
                        throw new Exception("No se ha definido la configuración");
                    }
                }

                file = Directory.GetFiles(pathConfigFile, fileName, SearchOption.AllDirectories)
                       .FirstOrDefault();

                // si existe
                // obtener la cadena de conexion del archivo
                FEncrypt.Respuesta result = FEncrypt.EncryptDncrypt.DecryptFile(file, "milagros");

                if (result.status == FEncrypt.Estatus.ERROR)
                {
                    throw new Exception(result.error);
                }

                if (result.status == FEncrypt.Estatus.OK)
                {
                    string[] list = result.resultado.Split(new string[] { "||" }, StringSplitOptions.None);

                    // FIREBIRD
                    string servidorM  = list[0].Substring(2);   // servidor microsip
                    string usuarioM   = list[1].Substring(2);   // usuario microsip
                    string contraM    = list[2].Substring(2);   // contraseña microsip
                    string puertoM    = list[3].Substring(2);   // puerto microsip
                    string baseDatosM = list[4].Substring(2);   // base de datos microsip

                    Modelos.ConectionString.connFB = string.Format(
                        "User={0};Password={1};Database={2};DataSource={3};Port={4}",
                        usuarioM,
                        contraM,
                        baseDatosM,
                        servidorM,
                        puertoM);
                }

                this._defConfig = true;

                this._consultasFBNegocio = new ConsultasFBNegocio();

                // carga combo de almacenes
                this.cmbAlmacen.DataSource    = this._consultasFBNegocio.getAlmacenes();
                this.cmbAlmacen.DisplayMember = "nombre";
                this.cmbAlmacen.ValueMember   = "almacenId";

                this._calcReal = false;
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Calcular Costos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
 public frmDescargaInfo()
 {
     InitializeComponent();
     this._consultasMySQLNegocio = new ConsultasMySQLNegocio();
     this._consultasFBNegocio    = new ConsultasFBNegocio();
 }