private void NextButton_Click(object sender, EventArgs e)
        {
            //TODO : Make this instance in Program.cs
            //TODO  : Make this code efficient
            this.Hide();
            Product P = new Product();

            P.ProductID = int.Parse(ProductDataGridView.SelectedRows[0].Cells[0].Value.ToString());
            P.Condition = ProductDataGridView.SelectedRows[0].Cells[14].Value.ToString();
            P.Cost      = double.Parse(ProductDataGridView.SelectedRows[0].Cells[1].Value.ToString());
            P.Platform  = ProductDataGridView.SelectedRows[0].Cells[16].Value.ToString();
            P.OS        = ProductDataGridView.SelectedRows[0].Cells[15].Value.ToString();
            P.Manufac   = ProductDataGridView.SelectedRows[0].Cells[2].Value.ToString();
            P.Model     = ProductDataGridView.SelectedRows[0].Cells[3].Value.ToString();
            P.Memory    = ProductDataGridView.SelectedRows[0].Cells[5].Value.ToString();
            P.Lcd       = ProductDataGridView.SelectedRows[0].Cells[7].Value.ToString();
            P.Hdd       = ProductDataGridView.SelectedRows[0].Cells[17].Value.ToString();
            P.CpuBrand  = ProductDataGridView.SelectedRows[0].Cells[10].Value.ToString();
            P.CpuNumber = ProductDataGridView.SelectedRows[0].Cells[13].Value.ToString();
            P.GpuType   = ProductDataGridView.SelectedRows[0].Cells[19].Value.ToString();
            P.CpuType   = ProductDataGridView.SelectedRows[0].Cells[11].Value.ToString();
            P.CpuSpeed  = ProductDataGridView.SelectedRows[0].Cells[12].Value.ToString();
            P.Webcam    = ProductDataGridView.SelectedRows[0].Cells[30].Value.ToString();

            ProductInfoForm PIF = new ProductInfoForm(P);

            PIF.Show();
        }
Пример #2
0
        private void NextButton_Click(object sender, EventArgs e)
        {
            ProductInfoForm productForm = new ProductInfoForm();

            productForm.Show();
            this.Hide();
        }
        private void OpenSavedOrderButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            ProductInfoForm PIF = new ProductInfoForm();

            PIF.Show();
        }
Пример #4
0
        /// <summary>
        /// This method handles the button clicks
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _buttonClickHandler(object sender, EventArgs e)
        {
            Button ClickHandler = sender as Button;

            switch (ClickHandler.Tag.ToString())
            {
            case "Cancel":
                // showing up confirm message when cancel button clicked
                DialogResult result = MessageBox.Show("Are You Sure you want to exit?", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                // Closes the program if OK clicked
                if (result == DialogResult.OK)
                {
                    Application.Exit();
                }
                break;

            case "Next":
                // Instantiate an object to the next form
                ProductInfoForm productInfoForm = new ProductInfoForm(_getSelectedValue());

                // Pass a reference to the current form to the next form
                productInfoForm.selectForm = this;

                // Show the next form
                productInfoForm.Show();

                // Hide the form
                this.Hide();
                break;
            }
        }
Пример #5
0
        private void BackButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            ProductInfoForm PF = new ProductInfoForm(P);

            PF.Show();
        }
Пример #6
0
        private void backToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            ProductInfoForm info = new ProductInfoForm();

            info.Show();
            info.DisplayProd();
            this.Hide();
        }
Пример #7
0
        private void NextButton_Click(object sender, System.EventArgs e)
        {
            ProductInfoForm info = new ProductInfoForm();

            info.previousForm = this;
            info.Show();
            this.Hide();
        }
Пример #8
0
        /// <summary>
        /// Event Handler for open button click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveButton_Click(object sender, EventArgs e)
        {
            // Create product info form object
            ProductInfoForm myProductForm = new ProductInfoForm();

            this.Close();// Close this form
            myProductForm.Show();
        }
Пример #9
0
        private void backToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ProductInfoForm productInfoForm = new ProductInfoForm();

            //show the ProductInfoForm  form
            productInfoForm.Show();
            //close this form
            this.Hide();
        }
Пример #10
0
        private void ButtonSavedOrder_Click(object sender, System.EventArgs e)
        {
            ProductInfoForm infoForm = new ProductInfoForm();

            infoForm.previousForm = this;
            infoForm.Show();
            infoForm.OpenFile();
            this.Hide();
        }
Пример #11
0
        private void Back_button_Click(object sender, EventArgs e)
        {
            ProductInfoForm productInfoForm = new ProductInfoForm();

            //show the ProductInfoForm  form
            productInfoForm.Show();
            //close this form
            this.Hide();
        }
        /// <summary>
        /// this method opens files to get data from file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _clickLoadSavedOrderButton(object sender, EventArgs e)
        {
            ProductInfoForm product = new ProductInfoForm();

            product.Show();
            product.previousForm = new SelectForm();
            this.Hide();
            product.ClickOpenToolStripMenuItem(sender, e);
        }
Пример #13
0
        private void Next_button_Click(object sender, EventArgs e)
        {
            //Instantiate the Next Form
            ProductInfoForm productInfoForm = new ProductInfoForm();

            //Save a reference to the current form in a property of the nextForm
            //Show the next Form
            productInfoForm.Show();
            this.Hide();
        }
Пример #14
0
        /// <summary>
        /// Back button clicked event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BackButton_Click(object sender, EventArgs e)
        {
            // Create a private object for product info form
            ProductInfoForm myProductForm = new ProductInfoForm();

            this.Hide(); // hide orderd form

            // shows product form
            myProductForm.Show();
        }
Пример #15
0
        private void OpenSavedOrderButton_Click(object sender, EventArgs e)
        {
            //open product info form when open button is clicked
            ProductInfoForm productInfoForm = new ProductInfoForm();

            productInfoForm.previousForm = this;
            productInfoForm.Show();
            productInfoForm.loadData();
            this.Hide();
        }
Пример #16
0
        private void NextButton_Click(object sender, EventArgs e)
        {
            ProductInfoForm productInfo = new ProductInfoForm();

            productInfo.NextButtonEnable();
            this.Hide();
            productInfo.previousForm    = this;
            productInfo.SelectedRowData = this.SelectedRow;
            productInfo.SettingTextFromData();
            productInfo.Show();
        }
Пример #17
0
        // Click Event handler for buttons
        private void _SelectFormButtonClickEventHandler(Object sender, EventArgs e)
        {
            // casting the sender object into Button
            Button buttonClicked = sender as Button;

            switch (buttonClicked.Tag.ToString())
            {
            case "cancel":
                // exit the application

                // confirm the closure
                DialogResult result = MessageBox.Show("Are you sure you want to exit the application?", "Confirm Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    Application.Exit();
                }
                break;

            case "next":
                // Collection to store the selected product's properties
                // stored with property name and value both. Example: 'productId' => '7'
                Dictionary <string, string> selectedProduct = new Dictionary <string, string>();

                // Get the selected cells
                DataGridViewSelectedCellCollection selectedRow = ProductsDataGridView.SelectedCells;
                // Add the data from selected cells to the selectedProducts Collection
                for (int i = 0; i <= selectedRow.Count - 1; i++)
                {
                    selectedProduct.Add(ProductsDataGridView.Columns[i].HeaderText, selectedRow[i].Value.ToString());
                }

                // create an instance of the ProductInfoForm
                ProductInfoForm productInfoForm = new ProductInfoForm(selectedProduct);

                // set the SelectForm reference for the ProductInfoForm
                productInfoForm.selectForm = this;

                // Hide the SelectForm
                this.Hide();

                // show the ProductInfoForm
                productInfoForm.Show();
                break;
            }
        }
Пример #18
0
        // Click event handler for the buttons on the StartForm
        private void _StartFormButtonClickHandler(Object sender, EventArgs e)
        {
            // cast the sender object to type Button
            Button buttonClicked = sender as Button;

            switch (buttonClicked.Tag.ToString())
            {
            case "new order":
                // create an instance of the SelectForm
                SelectForm selectForm = new SelectForm();

                // hide the StartForm
                this.Hide();

                // show the SelectForm
                selectForm.Show();

                break;

            case "saved order":
                // create an instance of the ProductInfoForm
                ProductInfoForm productInfoForm = new ProductInfoForm(null);

                // hide the StartForm
                this.Hide();

                // show the ProductInfoForm
                productInfoForm.Show();

                break;

            case "exit":
                // exit the application

                // confirm the closure
                DialogResult result = MessageBox.Show("Are you sure you want to exit the application?", "Confirm Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    Application.Exit();
                }

                break;
            }
        }
Пример #19
0
        /// <summary>
        /// This event handler handles all button clicks
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _buttonClickHandler(object sender, EventArgs e)
        {
            Button ClickHandler = sender as Button;

            switch (ClickHandler.Tag.ToString())
            {
            case "Back":
                // Instantiate an object to the next form
                ProductInfoForm productInfoForm = new ProductInfoForm(null);

                // Pass a reference to the current form to the next form
                productInfoForm.orderForm = this;

                // Show the next form
                productInfoForm.Show();

                // Hide the form
                this.Hide();
                break;

            case "Cancel":
                // showing up confirm message when cancel button clicked
                DialogResult result = MessageBox.Show("Are You Sure you want to exit?", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                // Closes the program if OK clicked
                if (result == DialogResult.OK)
                {
                    Application.Exit();
                }
                break;

            case "Finish":
                DialogResult finish = MessageBox.Show("Thank you for your business." + Environment.NewLine + "Your order will be processed in 7 - 10 business days.", "Thank You!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (finish == DialogResult.OK)
                {
                    Application.Exit();
                }
                break;
            }
        }
Пример #20
0
 /// <summary>
 /// This method goes back to previous form when users click the back button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _clickBackButton(object sender, EventArgs e)
 {
     this.Hide();
     previousForm.Show();
 }
Пример #21
0
 /// <summary>
 /// Event handler for next button clicked
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NextButton_Click(object sender, EventArgs e)
 {
     myProductInfoForm.previousForm = this;
     this.Hide();              // Hide current form
     myProductInfoForm.Show(); // show next form
 }
Пример #22
0
        // Shared click Event handler for buttons and menu items
        private void _OrderFormButtonClickEventHandler(Object sender, EventArgs e)
        {
            // declaring a Button object
            Button            buttonClicked   = null;
            ToolStripMenuItem menuItemClicked = null;

            try
            {
                // casting the sender object into Button
                buttonClicked = sender as Button;

                // if it wasn't clicked by Button, buttonClicked will be null
                if (buttonClicked == null)
                {
                    throw new Exception(); // throw exception so as to cast the sender to menu item now
                }
            }
            catch (Exception ex)
            {
                // casting the sender object into a ToolStripMenuItem
                menuItemClicked = sender as ToolStripMenuItem;
            }

            // perform action based on tag identification
            switch ((buttonClicked != null) ? buttonClicked.Tag.ToString() : menuItemClicked.Tag.ToString())
            {
            case "cancel":
            case "exit":
                // exit the application

                // confirm the closure
                DialogResult result = MessageBox.Show("Are you sure you want to exit the application?", "Confirm Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    Application.Exit();
                }
                break;

            case "finish":
                // Display the message of order sucess
                MessageBox.Show("Thanks for placing your order with us!" + Environment.NewLine + "Your order will be processed in 7-10 business days.", "Order placed");
                // exit the application
                Application.Exit();
                break;

            case "back":
                // Show the previous ProductInfoForm
                productInfoForm.Show();

                // Close this form (no longer required)
                this.Close();
                break;

            case "about":
                // Create an instance of the About Box
                AboutBox aboutBox = new AboutBox();
                // Display the modal About Box
                aboutBox.ShowDialog();
                break;

            case "print":
                // message to inform users the order info being printed
                MessageBox.Show("Your order information for " + this.ManufacturerTextBox.Text + " " + this.ModelTextBox.Text + " is being printed.", "Print Confirmation");
                break;
            }
        }
Пример #23
0
        }//end click anywhere

        private void NextButton_Click(object sender, EventArgs e)
        {
            nextForm.ComputerSpecs = computerSpecs;
            this.Hide();
            nextForm.Show();
        }