private void buttonUserEnter_Click(object sender, EventArgs e)
        {
            string username = textBoxUsername.Text;
            string pass     = textBoxPassword.Text;

            if (username == String.Empty || pass == String.Empty)
            {
                return;
            }

            pass = MyUtills.ConvertToMd5(pass);

            string adminUsername = "******";
            string adminPassword = MyUtills.ConvertToMd5("bnrbnr");

            DataTable userTable = localInterface.Select("SELECT type FROM users WHERE username='******' AND password='******'").Tables[0];
            int       res       = userTable.Rows.Count;

            if (username == adminUsername && pass == adminPassword)
            {
                mainForm.UserEnter(1);
                this.Close();
            }
            else if (res > 0)
            {
                mainForm.UserEnter((int)userTable.Rows[0][0]);
                this.Close();
            }
            else
            {
                labelStatus.Text      = "שם משתמש או סיסמא לא נכונים";
                labelStatus.ForeColor = Color.Red;
            }
        }
Esempio n. 2
0
        private void buttonAddUser_Click(object sender, EventArgs e)
        {
            if (textBoxNewUsername.Text == String.Empty || textBoxNewPassword.Text == String.Empty)
            {
                return;
            }

            string pass = MyUtills.ConvertToMd5(textBoxNewPassword.Text);

            bool res = localInterface.InsertSql("INSERT INTO users (username,password,type) VALUES ('" + textBoxNewUsername.Text + "','" + pass + "','" + comboBoxUserTypes.SelectedValue + "')");

            if (res == true)
            {
                showUsers();
            }
        }
Esempio n. 3
0
        private void buttonManageUsers_Click(object sender, EventArgs e)
        {
            string username = textBoxAdminUsername.Text;
            string pass     = textBoxAdminPassword.Text;

            if (username == String.Empty || pass == String.Empty)
            {
                return;
            }

            pass = MyUtills.ConvertToMd5(pass);

            string adminUsername = "******";
            string adminPassword = MyUtills.ConvertToMd5("bnrbnr");

            int res = (int)localInterface.Select("SELECT id FROM users WHERE username='******' AND password='******' AND type=1").Tables[0].Rows.Count;

            if (res > 0 || (username == adminUsername && pass == adminPassword))
            {
                panelUsers.Visible = true;
                showUsers();
                fillUserTypes();
            }
        }