Example #1
0
        private void Hora()
        {
            Byte[] encry = Encoding.Unicode.GetBytes(DateTime.Now.ToString("dd/MM/yyyy"));
            string fecha = Convert.ToBase64String(encry);

            File.WriteAllText("Key2", fecha);
            ComprobarFecha c = new ComprobarFecha();

            c.Encriptar("Key2");
            Application.Exit();
        }
Example #2
0
        private void ModoAdmin()
        {
            string limite = "Administrador Modo";

            Byte[] ecrypt = Encoding.Unicode.GetBytes(limite);
            File.WriteAllText("Key", Convert.ToBase64String(ecrypt), Encoding.Unicode);
            ComprobarFecha c = new ComprobarFecha();

            c.Encriptar("Key");

            frmHora h = new frmHora();

            if (h.error == true)
            {
                h.error = false;
                Application.Exit();
            }
        }
Example #3
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            ComprobarFecha f = new ComprobarFecha();

            f.Desencriptar(Application.StartupPath + @"\Config\IO.dat");
            Form1 fo = new Form1();

            if (File.ReadAllText(Application.StartupPath + @"\Config\IO.dat") == txtcontra.Text)
            {
                frmEmpleados em = new frmEmpleados();
                em.Visible = true;
                Close();
            }
            else
            {
                MessageBox.Show("La contraseña ha sido incorrecta");
            }
            f.Encriptar(Application.StartupPath + @"\Config\IO.dat");
        }
Example #4
0
        private void ModoPrueba()
        {
            DateTime tiempo = DateTime.Now;

            string limite = tiempo.AddDays(60).ToString("dd/MM/yyyy");

            Byte[] ecrypt = Encoding.Unicode.GetBytes(limite);
            File.WriteAllText("Key", Convert.ToBase64String(ecrypt), Encoding.Unicode);
            ComprobarFecha c = new ComprobarFecha();

            c.Encriptar("Key");
            File.WriteAllText("Tiempo de Licencia.txt", 2.ToString() + " Meses");

            frmHora h = new frmHora();

            if (h.error == true)
            {
                h.error = false;
                Application.Exit();
            }
        }
Example #5
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (System.IO.File.Exists("Key") && System.IO.File.Exists("key2"))
            {
                ComprobarFecha c = new ComprobarFecha();
                c.ComproFecha();
                if (c.correcto == true && c.inco == false)
                {
                    if (System.IO.File.Exists(Application.LocalUserAppDataPath + @"\nomedia.dat") &&
                        System.IO.File.Exists(Application.UserAppDataPath + @"\nomedia.dat"))
                    {
                        c.correcto = false;
                        c.inco     = false;
                        c.Licencia();
                        if (c.correcto == true && c.inco == false)
                        {
                            if (!System.IO.File.Exists("Financias_Process"))
                            {
                                if (System.IO.File.Exists(Application.StartupPath + @"\Config\IO.dat"))
                                {
                                    Application.Run(new frmCorroborarContra1());
                                }
                                else
                                {
                                    Application.Run(new Form1());
                                }
                            }
                            else
                            {
                                MessageBox.Show("El programa ya esta iniciado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            if (MessageBox.Show("Su licencia Expiró ¿Desea ingresar alguna licencia?",
                                                "Alerta", MessageBoxButtons.YesNo, MessageBoxIcon.Information)
                                == DialogResult.Yes)
                            {
                                Application.Run(new frmLicencia());
                            }
                            else
                            {
                                Application.Exit();
                            }
                        }
                    }
                    else
                    {
                        c.Trial();
                        MessageBox.Show("Tendrá una versión de prueba de 2 meses");
                        Application.Run(new Form1());
                    }
                }
                else
                {
                    Application.Run(new frmHora());
                }
                c.correcto = false;
                c.inco     = false;
            }
            else
            {
                Application.Run(new frmError());
            }

            if (System.IO.File.Exists("Financias_Process"))
            {
                System.IO.File.Delete("Financias_Process");
            }
        }
Example #6
0
        private void Licencia()
        {
            if (txtMes.Text == "" && txtAño.Text == "" && txtDias.Text == "")
            {
                MessageBox.Show("Limite no establecido", "Error");
                this.Close();
            }
            else
            {
                if (txtDias.Text == "")
                {
                    txtDias.Text = "0";
                }

                if (txtMes.Text == "")
                {
                    txtMes.Text = "0";
                }

                if (txtAño.Text == "")
                {
                    txtAño.Text = "0";
                }

                string limite = "";

                double dia = 0;
                int    mes = 0, año = 0;

                dia = double.Parse(txtDias.Text);
                mes = int.Parse(txtMes.Text);
                año = int.Parse(txtAño.Text);

                if (mes > 0)
                {
                    dia = (30 * mes) + dia;
                }
                if (año > 0)
                {
                    dia = (360 * año) + dia;
                }

                DateTime tiempo = DateTime.Now;

                limite = tiempo.AddDays(dia).ToString("dd/MM/yyyy");

                Byte[] ecrypt = Encoding.Unicode.GetBytes(limite);
                File.WriteAllText("Key", Convert.ToBase64String(ecrypt), Encoding.Unicode);

                ComprobarFecha c = new ComprobarFecha();
                c.Encriptar("Key");

                File.WriteAllText("Tiempo de Licencia.txt", dia.ToString() + " Dias");

                frmHora h = new frmHora();
                if (h.error == true)
                {
                    h.error = false;
                    Application.Exit();
                }
            }
        }
Example #7
0
        private void Aceptar()
        {
            if (txtNue.TextLength >= 6 && txtNue.TextLength <= 16)
            {
                lblNueva.ForeColor = Color.Black;

                if (File.Exists(Application.StartupPath + @"\Config\IO.dat"))
                {
                    ComprobarFecha c = new ComprobarFecha();
                    c.Desencriptar(Application.StartupPath + @"\Config\IO.dat");
                    string contra = File.ReadAllText(Application.StartupPath + @"\Config\IO.dat");
                    if (txtAnti.Text == contra)
                    {
                        if (txtConfirm.Text == txtNue.Text)
                        {
                            File.WriteAllText(Application.StartupPath + @"\Config\IO.dat", txtNue.Text);
                            lblInfoNue.ForeColor  = Color.Green;
                            lblInfoConf.ForeColor = Color.Green;
                            lblInfo.ForeColor     = Color.Green;
                            lblInfo.Text          = "Se ha modificado la contraseña";
                            lblInfoNue.Text       = "Coinciden";
                            lblInfoConf.Text      = "Coiciden";
                            btnAcept.Text         = "Cerrar";
                        }
                        else
                        {
                            lblInfoNue.ForeColor  = Color.Red;
                            lblInfoConf.ForeColor = Color.Red;
                            lblInfoNue.Text       = "No coinciden";
                            lblInfoConf.Text      = "No coinciden";
                        }
                    }
                    else
                    {
                        lblInfoAnti.ForeColor = Color.Red;
                        lblInfoAnti.Text      = "La contraseña no coincide";
                        if (txtNue.Text != txtConfirm.Text)
                        {
                            lblInfoNue.ForeColor  = Color.Red;
                            lblInfoConf.ForeColor = Color.Red;
                            lblInfoNue.Text       = "No coinciden";
                            lblInfoConf.Text      = "No coinciden";
                        }
                    }
                    c.Encriptar(Application.StartupPath + @"\Config\IO.dat");
                }
                else
                {
                    if (txtConfirm.Text == txtNue.Text)
                    {
                        ComprobarFecha c = new ComprobarFecha();
                        File.WriteAllText(Application.StartupPath + @"\Config\IO.dat", txtNue.Text);
                        c.Encriptar(Application.StartupPath + @"\Config\IO.dat");
                        lblInfoNue.ForeColor  = Color.Green;
                        lblInfoConf.ForeColor = Color.Green;
                        lblInfo.ForeColor     = Color.Green;
                        lblInfo.Text          = "Se ha creado la contraseña";
                        lblInfoNue.Text       = "Coinciden";
                        lblInfoConf.Text      = "Coiciden";
                        btnAcept.Text         = "Cerrar";
                    }
                    else
                    {
                        lblInfoNue.ForeColor  = Color.Red;
                        lblInfoConf.ForeColor = Color.Red;
                        lblInfoNue.Text       = "No coinciden";
                        lblInfoConf.Text      = "No coinciden";
                    }
                }
            }
            else
            {
                lblNueva.ForeColor = Color.Red;
            }
        }