private void cancel_btn_Click(object sender, EventArgs e)
        {
            int newID = service.addOrder();

            service.addDetails(newID, newDetail.objectID, newDetail.objectName, newDetail.supplier, newDetail.buyer, newDetail.num, newDetail.unitPrice);
            order_management_system system = (order_management_system)this.Owner;

            system.renewService(service);
            warning warningWindow = new warning();

            warningWindow.setText("Succeeded", "Data has been entered");
            warningWindow.Show();
            this.Close();
        }
Exemplo n.º 2
0
        private void confirm_btn_Click(object sender, EventArgs e)
        {
            string objID             = objID_text.Text;
            string objName           = objName_text.Text;
            string supplier          = supllier_text.Text;
            string buyer             = buyer_text.Text;
            bool   numConvert        = int.TryParse(num_text.Text, out int num);
            bool   unitPriceConvert  = float.TryParse(unitPrice_text.Text, out float unitPrice);
            bool   totalPriceConvert = float.TryParse(totalPrice_text.Text, out float totalPrice);
            string numStr            = "";
            string unitPriceStr      = "";
            string totalStr          = "";

            if (!(numConvert && unitPriceConvert && totalPriceConvert) && (num_text.Text != "" && unitPrice_text.Text != "" && totalPrice_text.Text != ""))
            {
                warning warningWindow = new warning();
                warningWindow.setText("Warning!", "Character illegal.");
                warningWindow.Show();
                return;
            }

            if (numConvert)
            {
                numStr = num_sign.SelectedItem.ToString() + num.ToString();
            }

            if (unitPriceConvert)
            {
                unitPriceStr = unitPrice_sign.SelectedItem.ToString() + unitPrice.ToString();
            }

            if (totalPriceConvert)
            {
                totalStr = totalPrice_sign.SelectedItem.ToString() + totalPrice.ToString();
            }

            List <Order> results = service.find(objID, objName, supplier, buyer, numStr, unitPriceStr, totalStr);

            displayWindow displayWindow = (displayWindow)this.Owner;

            displayWindow.refresh(results);
            this.Close();
        }
        private void OK_btn_Click(object sender, EventArgs e)
        {
            object index = orderBox.SelectedItem;

            if (index != null)
            {
                service.addDetails(int.Parse(index.ToString()), newDetail.objectID, newDetail.objectName, newDetail.supplier, newDetail.buyer, newDetail.num, newDetail.unitPrice);
                order_management_system system = (order_management_system)this.Owner;
                system.renewService(service);
                warning warningWindow = new warning();
                warningWindow.setText("Succeeded", "Data has been entered");
                warningWindow.Show();
                this.Close();
            }
            else
            {
                warning_label.Text      = "Click it to choose!";
                warning_label.ForeColor = Color.Red;
            }
        }
Exemplo n.º 4
0
        private void confirm_btn_Click(object sender, EventArgs e)
        {
            string objID            = objID_text.Text;
            string objName          = objName_text.Text;
            string supplier         = supllier_text.Text;
            string buyer            = buyer_text.Text;
            bool   numConvert       = int.TryParse(num_text.Text, out int num);
            bool   unitPriceConvert = float.TryParse(unitPrice_text.Text, out float unitPrice);

            if (numConvert && unitPriceConvert)
            {
                OrderDetails newDetails = new OrderDetails(objID, objName, supplier, buyer, num, unitPrice);
                int          sameID     = service.isSameDetailsExsist(newDetails);
                if (sameID == -1)
                {
                    int newID = service.addOrder();
                    service.addDetails(newID, objID, objName, supplier, buyer, num, unitPrice);
                    warning warningWindow = new warning();
                    warningWindow.setText("Succeeded", "Data has been entered");
                    warningWindow.Show();
                    order_management_system system = (order_management_system)this.Owner;
                    system.renewService(service);
                    this.Close();
                }

                else
                {
                    ChooseOrder             chooseWindow = new ChooseOrder(service, newDetails);
                    order_management_system system       = (order_management_system)this.Owner;
                    chooseWindow.Show(system);
                    this.Close();
                }
            }

            else
            {
                warning warningWindow = new warning();
                warningWindow.setText("Warning!", "Character illegal.");
                warningWindow.Show();
            }
        }