Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            byte[] data = UTF8Encoding.UTF8.GetBytes(textBox2.Text);
            using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
            {
                byte[] keys = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(hash));
                using (TripleDESCryptoServiceProvider tps = new TripleDESCryptoServiceProvider()
                {
                    Key = keys, Mode = CipherMode.ECB, Padding = PaddingMode.PKCS7
                })
                {
                    ICryptoTransform trans  = tps.CreateEncryptor();
                    byte[]           result = trans.TransformFinalBlock(data, 0, data.Length);
                    pass = Convert.ToBase64String(result, 0, result.Length);
                }
            }
            con1.Open();
            SqlCommand com1 = new SqlCommand();

            com1.Connection = con1;
            string cons0 = "";

            com1.CommandText = "select ID from Account where UserName='******'and Password='******'";
            SqlDataReader dr = com1.ExecuteReader();

            if (dr.Read())
            {
                cons0 = dr.GetString(0).Trim();
            }

            if (cons0 == "001")
            {
                uname = textBox1.Text;
                MAX_CITY ss = new MAX_CITY(uname);
                this.Hide();
                ss.Show();
            }

            else if (cons0 == "002" || cons0 == "003")
            {
                uname = textBox1.Text;
                Invoice ic = new Invoice(uname);
                ic.Show();
                this.Hide();
            }



            else
            {
                MessageBox.Show("Invalid User Name or Password", "Error");
                textBox1.Clear();
                textBox2.Clear();
                textBox1.Focus();
            }
            dr.Close();
            con1.Close();
        }
Ejemplo n.º 2
0
 private void Form5_Load(object sender, EventArgs e)
 {
     if (progressBar1.Value < 100)
     {
         progressBar1.Value = progressBar1.Value + 2;
     }
     else if (progressBar1.Value >= 100)
     {
         timer1.Enabled = false;
         MAX_CITY f2 = new MAX_CITY();
         f2.Show();
         this.Hide();
     }
 }
Ejemplo n.º 3
0
 private void progressBar1_Click(object sender, EventArgs e)
 {
     if (progressBar1.Value < 100)
     {
         progressBar1.Value = progressBar1.Value + 2;
     }
     else if (progressBar1.Value >= 100)
     {
         timer1.Enabled = false;
         MAX_CITY mdi = new MAX_CITY();
         mdi.Show();
         this.Hide();
     }
 }