コード例 #1
0
        private void buttonBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            var formTemp = new ManagementItemView();

            formTemp.Show();
        }
コード例 #2
0
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            anItem.itemName     = textboxName.Text;
            anItem.itemNumber   = Convert.ToInt32(textboxNumber.Text);
            anItem.itemDesc     = textboxDesc.Text;
            anItem.itemQuantity = Convert.ToInt32(textboxQuantity.Text);
            anItem.itemPrice    = Convert.ToDouble(textboxPrice.Text);
            anItem.itemCategory = comboBoxCategory.Text;

            bool wasSucessful = anItem.UpdateDatabaseItem(anItem);

            if (wasSucessful)
            {
                MessageBox.Show("Update Successful");
            }
            else
            {
                MessageBox.Show("Update Not Successful");
            }

            this.Hide();
            var formTemp = new ManagementItemView();

            formTemp.Show();
        }
コード例 #3
0
        private void buttonBack_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Changes will not be saved");
            this.Hide();
            var formTemp = new ManagementItemView();

            formTemp.Show();
        }
コード例 #4
0
        private void buttonLogin_Click_1(object sender, EventArgs e)
        {
            // Check userid text box
            if (String.IsNullOrEmpty(textboxUsername.Text))
            {
                MessageBox.Show("Please enter the user id", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Check password text box
            if (String.IsNullOrEmpty(textboxmaskedPassword.Text))
            {
                MessageBox.Show("Please enter the password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Login
            if (CheckUserIDAndPassword())
            {
                if (GetAccessLevel() == 1)
                {
                    this.Hide();
                    var formTemp = new ManagementItemView();
                    formTemp.Show();
                }
                else if (GetAccessLevel() == 2)
                {
                    this.Hide();
                    var formTemp = new AdminMain();
                    formTemp.Show();
                }
                else
                {
                    MessageBox.Show("Access level is invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("User ID or password are invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #5
0
        private async void buttonSubmit_Click(object sender, EventArgs e)
        {
            // Check name text box
            if (String.IsNullOrEmpty(textboxName.Text))
            {
                MessageBox.Show("Please enter the product name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Check price text box
            if (String.IsNullOrEmpty(textboxPrice.Text))
            {
                MessageBox.Show("Please enter the product price", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Check number text box
            if (String.IsNullOrEmpty(textboxNumber.Text))
            {
                MessageBox.Show("Please enter the product number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Check category combo box
            if (String.IsNullOrEmpty(comboBoxCategory.Text))
            {
                MessageBox.Show("Please enter the product category", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Check picture box
            if (pictureBoxImport.Image == null)
            {
                MessageBox.Show("Please select an image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            DropboxTools dropboxTools = new DropboxTools();

            anItem.itemName     = textboxName.Text;
            anItem.itemNumber   = Convert.ToInt32(textboxNumber.Text);
            anItem.itemPrice    = Convert.ToDouble(textboxPrice.Text);
            anItem.itemCategory = comboBoxCategory.Text;

            bool wasSuccessful = anItem.InsertToDatabase(anItem);

            try
            {
                this.Enabled = false;
                await dropboxTools.Upload(openFileDialogImport.FileName, Path.Combine(Global.AppDirectory, textboxNumber.Text + Global.AppExtension));
            }
            catch
            {
                wasSuccessful = false;
            }

            if (wasSuccessful)
            {
                MessageBox.Show("Successful");
            }

            this.Hide();
            var formTemp = new ManagementItemView();

            formTemp.Show();
        }