示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Login
            label2.Visible = false;
            userName       = textBox1.Text;
            password       = textBox2.Text;

            if (db.login(userName, password).ToLower().Equals("admin"))
            {
                pictureBox2.Visible = pictureBox3.Visible = pictureBox4.Visible =
                    label6.Visible  = label7.Visible = label8.Visible = true;
                DataManager.user det = db.getUserDetails(userName);
                label5.Text = "WELCOME " + det.firstName.ToUpper();

                showMainMenu();
            }
            else if (db.login(userName, password).ToLower().Equals("clerk"))
            {
                pictureBox2.Visible = pictureBox3.Visible = pictureBox4.Visible =
                    label6.Visible  = label7.Visible = label8.Visible = false;
                DataManager.user det = db.getUserDetails(userName);
                label5.Text = "WELCOME " + det.firstName.ToUpper();
                showMainMenu();
            }
            else
            {
                label2.Visible = true;
            }
            label5.Left = (MainMenu.Width - label5.Width) / 2;
        }
示例#2
0
 public void loadData()
 {
     DataManager.user details = db.getUserDetails(username);
     textBox1.Text = details.userName;
     textBox2.Text = textBox3.Text = details.password;
     textBox4.Text = details.firstName;
     textBox5.Text = details.lastName;
 }
示例#3
0
        public void updateAccount(DataManager.user details)
        {
            conn.Open();
            string        sql       = "UPDATE user SET password='******', firstName='" + details.firstName + "', lastName='" + details.lastName + "' WHERE userName='******'";
            SQLiteCommand sqCommand = new SQLiteCommand(sql, conn);

            sqCommand.ExecuteNonQuery();
            conn.Close();
        }
示例#4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!infoValidation())
            {
                return;
            }
            DataManager.user userDetail = new DataManager.user();
            userDetail.userName  = textBox1.Text;
            userDetail.password  = textBox2.Text;
            userDetail.firstName = textBox4.Text;
            userDetail.lastName  = textBox5.Text;
            db.updateAccount(userDetail);

            MessageBox.Show("Your Account Details Have Been Updated Successfully.");
        }
示例#5
0
        public DataManager.user getUserDetails(string userName)
        {
            DataManager.user retVal = new DataManager.user();
            conn.Open();
            string           sql       = "SELECT * FROM user where userName='******'";
            SQLiteCommand    sqCommand = new SQLiteCommand(sql, conn);
            SQLiteDataReader sqReader  = sqCommand.ExecuteReader();

            if (sqReader.Read())
            {
                retVal.userName  = userName;
                retVal.password  = sqReader.GetString(1);
                retVal.firstName = sqReader.GetString(2);
                retVal.lastName  = sqReader.GetString(3);
            }
            sqReader.Close();
            conn.Close();
            return(retVal);
        }