Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cbbPaymentTerms.Text == "Select") //"Select" is the default option
            {
                MessageBox.Show("Please select an option for Payment Terms.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["TabQuotationDetails"]; //Directs user to the Request Details tab.
                return;
            }

            if (cbbDeliveryTerms.Text == "Select")
            {
                MessageBox.Show("Please select an option for Delivery Terms.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["TabQuotationDetails"]; //Directs user to the Request Details tab.
                return;
            }


            if (cbbInFavorOf.Text == "Select")
            {
                MessageBox.Show("Please select an option for In Favor Of.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["TabQuotationDetails"]; //Directs user to the Request Details tab.
                return;
            }

            //If there are no items added to the RFQ
            if (dgvPOItems.Rows.Count == 0)
            {
                MessageBox.Show("Please include item(s) in the Price Quotation.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["tabItemDetails"]; //Directs user to the Item Details tab.
                return;
            }

            else
            {
                CustomerIDFK = sql.SelectCustomerID(CustomerName);
                for (int i = 0; i < dgvPOItems.RowCount; i++)
                {
                    DataGridViewRow row = dgvPOItems.Rows[i]; //Store row number
                    poList.Add(new PO_OrderLine(txtPQNumber.Text,
                                                row.Cells["POItemPartNo"].Value.ToString(),
                                                double.Parse(row.Cells["SupplierREICPrice"].Value.ToString()),
                                                int.Parse(row.Cells["Qty"].Value.ToString()),
                                                double.Parse(row.Cells["TotalItem"].Value.ToString())));
                }
                cancel = false;
                Close();
            }
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            dateResult = DateTime.Compare(FromDate, ToDate);


            if (DateTime.Now < PQDate)
            {
                MessageBox.Show("It is not the date today for Price Quotation Date.", "Invalid Date", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["tabQuotationDetails"];
                return;
            }

            if (dateResult > 0)
            {
                MessageBox.Show("To Date of Validity Period should be later than From Date.", "Invalid Date", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["tabQuotationDetails"];
                return;
            }

            if (dateResult == 0)
            {
                MessageBox.Show("To Date of Validity Period should be later than From Date.", "Invalid Date", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["tabQuotationDetails"];
                return;
            }

            if (cbbPaymentTerms.Text == "Select") //"Select" is the default option
            {
                MessageBox.Show("Please select an option for Payment Terms.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["TabQuotationDetails"]; //Directs user to the Request Details tab.
                return;
            }

            if (cbbDeliveryTerms.Text == "Select")
            {
                MessageBox.Show("Please select an option for Delivery Terms.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["TabQuotationDetails"]; //Directs user to the Request Details tab.
                return;
            }

            if (cbbBillTo.Text == "Select")
            {
                MessageBox.Show("Please select an option for Bill To.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["TabQuotationDetails"]; //Directs user to the Request Details tab.
                return;
            }

            if (cbbShipTo.Text == "Select")
            {
                MessageBox.Show("Please select an option for Ship To.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["TabQuotationDetails"]; //Directs user to the Request Details tab.
                return;
            }

            if (cbbInFavorOf.Text == "Select")
            {
                MessageBox.Show("Please select an option for In Favor Of.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["TabQuotationDetails"]; //Directs user to the Request Details tab.
                return;
            }

            //If there are no items added to the RFQ
            if (dgvPQItems.Rows.Count == 0)
            {
                MessageBox.Show("Please include item(s) in the Price Quotation.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabPQForm.SelectedTab = tabPQForm.TabPages["tabItemDetails"];     //Directs user to the Item Details tab.
                return;
            }

            else
            {
                CustomerIDFK = sql.SelectCustomerID(CustomerName);
                for (int i = 0; i < dgvPQItems.RowCount; i++)
                {
                    DataGridViewRow row = dgvPQItems.Rows[i]; //Store row number
                    pqOrderLineList.Add(new PQ_OrderLine(txtPQNumber.Text,
                                                         row.Cells["PQItemPartNo"].Value.ToString(),
                                                         double.Parse(row.Cells["UnitREICPrice"].Value.ToString()),
                                                         int.Parse(row.Cells["Qty"].Value.ToString()),
                                                         double.Parse(row.Cells["TotalItem"].Value.ToString())));
                }
                cancel = false;
                Close();
            }
        }
Exemplo n.º 3
0
        //-------------------
        //  BUTTON METHODS  |
        //-------------------

        /* FOR: btnSave_Click,
         *      btnCancel_Click,
         *      btnSearch_Click,
         *      btnClearSearch_Click,
         *      btnAddToRequest_Click,
         *      btnRemoveItem_Click,
         *      btnClearItems_Click     */

        private void btnSave_Click(object sender, EventArgs e)
        {   //-------------------------------------------------------
            // btnSave_Click: ERROR MESSAGES FOR INCOMPLETE FIELDS  |
            //-------------------------------------------------------
            //If any text field that can't be null is empty, display error message.
            if (cbbPaymentTerms.Text == "Select")
            {
                MessageBox.Show("Please select an option for Payment Terms.", "Incomplete Fields", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabRFQForm.SelectedTab = tabRFQForm.TabPages["tabRequestDetails"]; //Directs user to the Request Details tab.
                return;
            }

            if (cbbDeliveryTerms.Text == "Select")
            {
                MessageBox.Show("Please select an option for Delivery Terms.", "Incomplete Fields", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabRFQForm.SelectedTab = tabRFQForm.TabPages["tabRequestDetails"]; //Directs user to the Request Details tab.
                return;
            }

            //If no Customer was selected
            if (cbbCustomerName.Text == "Select Customer")
            {
                MessageBox.Show("Please select a Customer.", "Incomplete Fields", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabRFQForm.SelectedTab = tabRFQForm.TabPages["tabRequestDetails"]; //Directs user to the Request Details tab.
                return;
            }

            //If no Supplier was selected
            if (cbbSupplierName.Text == "Select Supplier")
            {
                MessageBox.Show("Please select a Supplier.", "Incomplete Fields", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabRFQForm.SelectedTab = tabRFQForm.TabPages["tabRequestDetails"]; //Directs user to the Request Details tab.
                return;
            }

            //If there are no items added to the RFQ
            if (dgvRFQItems.Rows.Count == 0)
            {
                MessageBox.Show("Please include item(s) in the Request for Price Quotation.", "Incomplete Fields", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tabRFQForm.SelectedTab = tabRFQForm.TabPages["tabItemDetails"]; //Directs user to the Item Details tab.
                return;
            }

            //--------------------------------------
            // btnSave_Click: CONFIRMATION MESSAGE |
            //--------------------------------------
            DialogResult result = MessageBox.Show("Are you ABSOLUTELY SURE of ALL the details in the Request for Price Quotation? Once the form has been created, it CANNOT be edited anymore.",
                                                  "Confirm Creation of RFQ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                //---SET CUSTOMER ID Foreign Key
                CustomerIDFK = sql.SelectCustomerID(CustomerName);

                //---SET SUPPLIER ID Foreign Key
                SupplierIDFK = sql.SelectSupplierID(SupplierName);

                //---ADD all items in RFQ to the rfqOrderLineList. (Parameters based on Data Dictionary)
                for (int i = 0; i < dgvRFQItems.RowCount; i++)
                {
                    DataGridViewRow row = dgvRFQItems.Rows[i]; //Store row number
                    rfqOrderLineList.Add(new RFQ_OrderLine(txtRFQNo.Text,
                                                           row.Cells["RFQItemPartNo"].Value.ToString(),
                                                           int.Parse(row.Cells["Qty"].Value.ToString())));
                }

                //---CLOSING THE FORM
                cancel = false; //Will be used by RFQ Main Screen
                Close();        //Only RFQ_MainScreen.cs remains
            }
        }