Пример #1
0
        private void Frm_Login_Shown(object sender, EventArgs e)
        {
            txtUser.Focus();
            MSRegistro RegOut = new MSRegistro();

            SkinForm.LookAndFeel.SetSkinStyle(RegOut.GetSetting("ConexionSQL", "Sking"));
        }
Пример #2
0
 private void btnProbarConexionR_Click(object sender, EventArgs e)
 {
     if (txtServer.Text != "" && txtDB.Text != "" && txtLogin.Text != "" && txtPassword.Text != "")
     {
         using (SqlConnection conn = new SqlConnection(String.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3}", txtServer.Text, txtDB.Text, txtLogin.Text, txtPassword.Text)))
         {
             try
             {
                 conn.Open();
                 XtraMessageBox.Show("Conexion Exitosa DB Local");
                 MSRegistro RegIn          = new MSRegistro();
                 Crypto     EncriptarTexto = new Crypto();
                 RegIn.SaveSetting("ConexionSQL", "Server", EncriptarTexto.Encriptar(txtServer.Text));
                 RegIn.SaveSetting("ConexionSQL", "DBase", EncriptarTexto.Encriptar(txtDB.Text));
                 RegIn.SaveSetting("ConexionSQL", "User", EncriptarTexto.Encriptar(txtLogin.Text));
                 RegIn.SaveSetting("ConexionSQL", "Password", EncriptarTexto.Encriptar(txtPassword.Text));
                 CargarComboSucursales();
             }
             catch (Exception ex)
             {
                 XtraMessageBox.Show("No se pudo Conectar con la Base de Datos Local: " + ex);
             }
         }
     }
 }
Пример #3
0
 private void btnGuardarConexionR_Click(object sender, EventArgs e)
 {
     if (txtServer.Text != "" && txtDB.Text != "" && txtLogin.Text != "" && txtPassword.Text != "" && cboCajas.EditValue != null && cboSucursales.EditValue != null)
     {
         {
             SqlConnection conn = new SqlConnection("Data Source=" + txtServer.Text + ";Initial Catalog=" + txtDB.Text + ";Persist Security Info=True;User ID=" + txtLogin.Text + ";Password="******"ConexionSQL", "Server", EncriptarTexto.Encriptar(txtServer.Text));
                 RegIn.SaveSetting("ConexionSQL", "DBase", EncriptarTexto.Encriptar(txtDB.Text));
                 RegIn.SaveSetting("ConexionSQL", "User", EncriptarTexto.Encriptar(txtLogin.Text));
                 RegIn.SaveSetting("ConexionSQL", "Password", EncriptarTexto.Encriptar(txtPassword.Text));
                 RegIn.SaveSetting("ConexionSQL", "Sucursal", EncriptarTexto.Encriptar(cboSucursales.EditValue.ToString()));
                 RegIn.SaveSetting("ConexionSQL", "Caja", EncriptarTexto.Encriptar(cboCajas.EditValue.ToString()));
                 XtraMessageBox.Show("Se Grabaron los Datos Del Servidor Local Con Exito");
                 this.Close();
             }
             catch (Exception ex)
             {
                 XtraMessageBox.Show("Error Descripcion: " + ex);
             }
         }
     }
     else
     {
         XtraMessageBox.Show("Faltan Datos para la Conexion Local");
     }
 }
Пример #4
0
 private void btnGuardarConexion_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (txtServer.Text != "" && txtDB.Text != "" && txtLogin.Text != "" && txtPassword.Text != "")
     {
         {
             SqlConnection conn = new SqlConnection("Data Source=" + txtServer.Text + ";Initial Catalog=" + txtDB.Text + ";Persist Security Info=True;User ID=" + txtLogin.Text + ";Password="******"ConexionSQL", "Server", EncriptarTexto.Encriptar(txtServer.Text));
                 RegIn.SaveSetting("ConexionSQL", "DBase", EncriptarTexto.Encriptar(txtDB.Text));
                 RegIn.SaveSetting("ConexionSQL", "User", EncriptarTexto.Encriptar(txtLogin.Text));
                 RegIn.SaveSetting("ConexionSQL", "Password", EncriptarTexto.Encriptar(txtPassword.Text));
                 XtraMessageBox.Show("Se Grabaron los Datos Del Servidor Principal Con Exito");
                 this.Close();
             }
             catch (Exception ex)
             {
                 XtraMessageBox.Show("Error Descripcion: " + ex);
             }
         }
     }
     else
     {
         XtraMessageBox.Show("Faltan Datos para la Conexion Principal");
     }
 }
Пример #5
0
        private void btnAcceso_Click(object sender, EventArgs e)
        {
            if (btnAcceso.Text == "Acceso")
            {
                if (txtUser.Text != string.Empty && txtPass.Text != string.Empty)
                {
                    Crypto    claseencripta = new Crypto();
                    SEG_Login sLogin        = new SEG_Login()
                    {
                        c_codigo_usu = txtUser.Text, v_passwo_usu = txtPass.Text
                    };
                    sLogin.MtdSeleccionarUsuarioLogin();
                    if (sLogin.Exito)
                    {
                        if (sLogin.Datos.Rows.Count > 0)
                        {
                            vIdUsuario = sLogin.Datos.Rows[0]["UsuariosId"].ToString();
                            if (sLogin.Datos.Rows[0]["UsuariosActivo"].ToString() == "A")
                            {
                                vIdActivo = 1;
                            }
                            else
                            {
                                vIdActivo = 0;
                            }
                            Frm_Principal frmP  = new Frm_Principal();
                            MSRegistro    RegIn = new MSRegistro();

                            if (vIdActivo == 1)
                            {
                                frmP.UsuariosLogin = txtUser.Text;
                                //frmP.UsuariosClase = Convert.ToChar(sLogin.Datos.Rows[0][1]);
                                frmP.Show();
                                this.Hide();
                            }
                            else
                            {
                                XtraMessageBox.Show("Este usuario esta inactivo en el sistema");
                            }
                        }
                        else
                        {
                            XtraMessageBox.Show("Usuario o Contraseña Incorrectos o El Usuario Esta Inactivo");
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show(sLogin.Mensaje);
                    }
                }
                else
                {
                    XtraMessageBox.Show("Faltan Datos por Capturar Usuario y/o Password");
                }
            }
        }
Пример #6
0
        private void Frm_Principal_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult = XtraMessageBox.Show("¿Desea salir de la aplicación?", "Salir", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            if (DialogResult == DialogResult.No)
            {
                e.Cancel = true;
            }
            MSRegistro RegIn = new MSRegistro();

            RegIn.SaveSetting("ConexionSQL", "Sking", SkinForm.LookAndFeel.SkinName);
        }
Пример #7
0
        private void CargarSucursales()
        {
            MSRegistro RegOut            = new MSRegistro();
            Crypto     DesencriptarTexto = new Crypto();
            string     v_Sucursal        = RegOut.GetSetting("ConexionSQL", "Sucursal");

            if (v_Sucursal != null)
            {
                v_Sucursalnum = Convert.ToInt32(DesencriptarTexto.Desencriptar(RegOut.GetSetting("ConexionSQL", "Sucursal")));
                CargarSucursales(v_Sucursalnum);
            }
        }
Пример #8
0
        private void Frm_Conexiones_Load(object sender, EventArgs e)
        {
            CargarIconos();
            MSRegistro RegOut = new MSRegistro();
            Crypto     DesencriptarTexto = new Crypto();
            string     valServer, valDB, valLogin, valPass;

            try
            {
                valServer = DesencriptarTexto.Desencriptar(RegOut.GetSetting("ConexionSQL", "Server"));
                valDB     = DesencriptarTexto.Desencriptar(RegOut.GetSetting("ConexionSQL", "DBase"));
                valLogin  = DesencriptarTexto.Desencriptar(RegOut.GetSetting("ConexionSQL", "User"));
                valPass   = DesencriptarTexto.Desencriptar(RegOut.GetSetting("ConexionSQL", "Password"));
            }
            catch
            {
                valServer = string.Empty;
                valDB     = string.Empty;
                valLogin  = string.Empty;
                valPass   = string.Empty;
            }



            if (valServer != null && valDB != null && valLogin != null & valPass != null)
            {
                txtServer.Text   = valServer;
                txtDB.Text       = valDB;
                txtLogin.Text    = valLogin;
                txtPassword.Text = valPass;
                using (SqlConnection conn = new SqlConnection(String.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3}", txtServer.Text, txtDB.Text, txtLogin.Text, txtPassword.Text)))
                {
                    try
                    {
                        conn.Open();
                        v_Sucursal = RegOut.GetSetting("ConexionSQL", "Sucursal");
                        v_Caja     = RegOut.GetSetting("ConexionSQL", "Caja");
                        CargarComboSucursales();
                    }
                    catch
                    {
                        XtraMessageBox.Show("No se Han Configurado datos Correctos para la conexion a la base de datos Local");
                    }
                }
            }
            else
            {
                txtServer.Text   = string.Empty;
                txtDB.Text       = string.Empty;
                txtLogin.Text    = string.Empty;
                txtPassword.Text = string.Empty;
            }
        }
Пример #9
0
        private void Form1_ConfigureDataConnection(object sender, ConfigureDataConnectionEventArgs e)
        {
            MSRegistro RegOut            = new MSRegistro();
            Crypto     DesencriptarTexto = new Crypto();

            string valServer = RegOut.GetSetting("ConexionSQL", "Server");
            string valDB     = RegOut.GetSetting("ConexionSQL", "DBase");
            string valLogin  = RegOut.GetSetting("ConexionSQL", "User");
            string valPass   = RegOut.GetSetting("ConexionSQL", "Password");

            if (valServer != string.Empty && valDB != string.Empty && valLogin != string.Empty && valPass != string.Empty)
            {
                valServer = DesencriptarTexto.Desencriptar(valServer);
                valDB     = DesencriptarTexto.Desencriptar(valDB);
                valLogin  = DesencriptarTexto.Desencriptar(valLogin);
                valPass   = DesencriptarTexto.Desencriptar(valPass);
                e.ConnectionParameters = new MsSqlConnectionParameters(valServer, valDB, valLogin, valPass, MsSqlAuthorizationType.SqlServer);
            }
        }
Пример #10
0
        private void CargarComboSucursales()
        {
            MSRegistro RegOut            = new MSRegistro();
            Crypto     DesencriptarTexto = new Crypto();

            if (v_Sucursal != null)
            {
                int v_Sucursalnum = Convert.ToInt32(DesencriptarTexto.Desencriptar(RegOut.GetSetting("ConexionSQL", "Sucursal")));
                CargarSucursales(v_Sucursalnum);
                if (v_Caja != null)
                {
                    int v_Cajanum = Convert.ToInt32(DesencriptarTexto.Desencriptar(RegOut.GetSetting("ConexionSQL", "Caja")));
                    cboCajas.Properties.DataSource = null;
                    CargarCajas(v_Cajanum, v_Sucursalnum);
                }
            }
            else
            {
                CargarSucursales(null);
            }
        }
Пример #11
0
        private void Frm_Principal_Load(object sender, EventArgs e)
        {
            MSRegistro RegOut = new MSRegistro();

            SkinForm.LookAndFeel.SetSkinStyle(RegOut.GetSetting("ConexionSQL", "Sking"));
        }