示例#1
0
        //////////////////////////////////////////////////////events for components///////////////////////////////////////////////////////////////////

        private void treeViewAdminNav_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode treeNode = treeViewAdminNav.SelectedNode;

            if (treeNode.Name.Equals("nodeProduct") && !(this.Name.Equals("ProductViewForm")))
            {
                ProductViewForm viewProductPage = new ProductViewForm();
                this.Hide();
                viewProductPage.ShowDialog();
                this.Close(); //close previous form
            }
            else if (treeNode.Name.Equals("nodeUser") && !(this.Name.Equals("UserViewForm")))
            {
                UserViewForm viewUserPage = new UserViewForm();
                this.Hide();
                viewUserPage.ShowDialog();
                this.Close(); //close previous form
            }
            else if (treeNode.Name.Equals("nodeStock") && !(this.Name.Equals("StockViewForm")))
            {
                StockViewForm viewStockPage = new StockViewForm();
                this.Hide();
                viewStockPage.ShowDialog();
                this.Close(); //close previous form
            }
        }
示例#2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string username = txtUserName.Text;
            string password = Encrypt(txtPassword.Text, GenerateEncryptionKey());
            string position = cboPosition.Text;

            if ((username != "") && (password != "") && (position != ""))
            {
                db.Sqlite_cmd             = db.SqlConn.CreateCommand();//ask database what to query
                db.Sqlite_cmd.CommandText = "INSERT INTO user (user_name, user_password, user_role) " +
                                            "VALUES('" + username + "', '" + password + "', '" + position + "')";
                db.Sqlite_datareader = db.Sqlite_cmd.ExecuteReader();//reads the database
                db.Sqlite_cmd.Dispose();
                db.CloseDBConnection();

                UserViewForm viewUserPage = new UserViewForm();
                this.Hide();
                viewUserPage.ShowDialog();
                this.Close(); //close previous form
            }
            else
            {
                MessageBox.Show("Please Do Not Leave Any Empty Box");
            }
        }
示例#3
0
        private void lblUserTable_Click(object sender, EventArgs e)
        {
            UserViewForm userViewPage = new UserViewForm();

            this.Hide();
            userViewPage.ShowDialog();
            this.Close(); //close previous form
        }