Exemplo n.º 1
0
        public void ShowOperForm(string uid)
        {
            string RegionId = "";
            string RksId    = "";
            string qq       = @"SELECT `Users`.`id`, `Users`.`Pass`, `Users`.`Name`, `Users`.`UserTypeId`,`Limits`.`RksId`, `Limits`.`RegionId` 
                        FROM `Users`
                        INNER JOIN `Limits` ON `Limits`.`UserId`=`Users`.`id`
                        WHERE `Users`.`Name` = '" + textBox1.Text + "'";

            dataGridView1.DataSource = db_idp.Get_DataTable(qq);

            try
            {
                RksId    = dataGridView1.Rows[0].Cells["RksId"].Value.ToString();
                RegionId = dataGridView1.Rows[0].Cells["RegionId"].Value.ToString();
            }
            catch
            {
            }

            OperForm f = new OperForm();

            f.textBox_uid.Text      = uid;
            f.textBox_rksid.Text    = RksId;
            f.textBox_regionid.Text = RegionId;
            f.textBox_username.Text = textBox1.Text;
            f.Text = "Operator: " + textBox1.Text;
            f.Show();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            MD5    md5Hash = MD5.Create();
            string hash    = GetMd5Hash(md5Hash, textBox2.Text);

            hash = GetMd5Hash(md5Hash, hash);
            ///MessageBox.Show(hash);

            dataGridView1.DataSource = db.Get_DataTable("SELECT * from Users WHERE Name='" + textBox1.Text + "' ", "idpoints");
            string hashdb     = dataGridView1.Rows[0].Cells["Pass"].Value.ToString();
            string uid        = dataGridView1.Rows[0].Cells["id"].Value.ToString();
            string UserTypeId = dataGridView1.Rows[0].Cells["UserTypeId"].Value.ToString();

            //MessageBox.Show(hashdb);

            if (hash == hashdb)
            {
                MessageBox.Show("Залогинились");

                if (UserTypeId == "1")
                {
                    AdminForm f = new AdminForm();
                    //f.textBox_uid.Text = uid;
                    f.Show();
                    Hide();
                }

                if (UserTypeId == "2")
                {
                    OperForm f = new OperForm();
                    f.textBox_uid.Text = uid;
                    f.Show();
                    Hide();
                }

                if (UserTypeId == "3")
                {
                    MessageBox.Show("RKS");
                    RksForm f = new RksForm();
                    f.Show();
                    Hide();
                }
            }
            else
            {
                MessageBox.Show("Неверный логин пароль");
            }
        }