Esempio n. 1
0
        // when user clicks 'add to cart' button
        private void button1_Click(object sender, EventArgs e)
        {
            // if user chooses '-- Select Book --' option
            if (comboBox1.SelectedIndex == 0 || AuthorTextBox.Text == "")
            {
                MessageBox.Show("Please, choose a book from the list.", "Missing order details", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                comboBox1.Focus();
            }
            // if quantity box value starts with 0 or is empty
            else if (QuantityTextBox.Text == "" || QuantityTextBox.Text.StartsWith("0"))
            {
                MessageBox.Show("Please, enter the valid number of books.", "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error);
                QuantityTextBox.Focus();
            }
            // if user chooses '-- Select Customer --" option
            else if (CustomerComboBox.SelectedIndex == 0)
            {
                MessageBox.Show("Please, choose the customer", "Missing Order Details", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CustomerComboBox.Focus();
            }
            else
            {
                string BookID    = IsbnTextBox.Text.ToString();
                var    index     = this.DataList.Rows.Add(); // add new row and get index of this row
                var    lineTotal = decimal.Parse(PriceTextBox.Text.TrimStart('$')) * decimal.Parse(QuantityTextBox.Text);
                this.DataList.Rows[index].Cells[0].Value = comboBox1.SelectedValue.ToString();
                this.DataList.Rows[index].Cells[1].Value = decimal.Parse(PriceTextBox.Text.TrimStart('$')).ToString("C2");
                this.DataList.Rows[index].Cells[2].Value = QuantityTextBox.Text;
                this.DataList.Rows[index].Cells[3].Value = lineTotal.ToString("C2");

                orderDetailsList.Add(new OrderDetails(BookID, int.Parse(QuantityTextBox.Text), lineTotal));
                this.Lines.Add(lineTotal); // store Line Total values in the list when book is added to the DataGridView
                CalculateTotalAmount();    // calculate total amount for user to pay
            }
        }
Esempio n. 2
0
 //Event Handler for Add Button in Cart
 private void AddButton_Click(object sender, EventArgs e)
 {
     //Conveting CUrrent quantity to integer
     int.TryParse(QuantityTextBox.Text, out int CurrentValue);
     //Adding 1 to current quantity
     CurrentValue += 1;
     //Finding the product in List in conventional Way using sequencial search
     //We can use List Find methods as well in order to find and return us the direct item from list
     for (int i = 0; i < MainForm.ProductList.Count; i++)
     {
         //Matching product selected from list, if Found, Adding one product to the cart
         if (MainForm.ProductList[i].ProductCategory == this.ProdCat &&
             MainForm.ProductList[i].ProductID == this.ProdID)
         {
             //Check if Stock is available
             if (CurrentValue <= MainForm.ProductList[i].ProductQuantity)
             {
                 MainForm.TotalItems += 1;
                 MainForm.GrandTotal += this._ProductPrice;
                 MainForm frm = (MainForm)this.FindForm();
                 frm.TotalItemsLabel.Text    = MainForm.TotalItems.ToString();
                 frm.GrandTotalLabel.Text    = MainForm.GrandTotal.ToString();
                 QuantityTextBox.Text        = CurrentValue.ToString();
                 ProductTotalPriceLabel.Text = (CurrentValue * this._ProductPrice).ToString();
                 break;
             }
             else
             {
                 MessageBox.Show("Requested Quantities of " + this.ProdName + " are not available in inventory",
                                 "Not Enough Items Available", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 QuantityTextBox.Focus();
             }
         }
     }
 }
Esempio n. 3
0
        private void AddDataItem_Click(object sender, RoutedEventArgs e)
        {
            ItemController CallItem = new ItemController();

            //var combo = CategoryComboBox.SelectedValue.ToString();
            //MessageBox.Show(CategoryComboBox.Text);
            if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                ItemNameTextBox.Focus();
                QuantityTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0)
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                ItemNameTextBox.Focus();
                QuantityTextBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                ItemNameTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                QuantityTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0)
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                ItemNameTextBox.Focus();
            }
            else if (QuantityTextBox.Text.Length == 0)
            {
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                QuantityTextBox.Focus();
            }
            else if (CategoryComboBox.Text == "")
            {
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                CategoryComboBox.Focus();
            }
            else
            {
                string Iname = ItemNameTextBox.Text;
                int    Iqty  = Convert.ToInt32(QuantityTextBox.Text);
                int    Icat  = Convert.ToInt32(CategoryComboBox.SelectedValue.ToString());

                CallItem.AddItem(Iname, Iqty, Icat, email, name, roles);
            }
        }
Esempio n. 4
0
        private bool IsValidated()
        {
            if (QuantityTextBox.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Please add new quantity.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                QuantityTextBox.Clear();
                QuantityTextBox.Focus();
                HasValidationFailed = true;
                return(false);
            }

            int  result    = 0;
            bool isNumeric = int.TryParse(QuantityTextBox.Text.Trim(), out result);

            if (!isNumeric)
            {
                MessageBox.Show("Quantity should be interger (1,2,3,...).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                QuantityTextBox.Clear();
                QuantityTextBox.Focus();
                HasValidationFailed = true;
                return(false);
            }

            return(true);
        }
Esempio n. 5
0
        private void UpdateDataItem_Click(object sender, RoutedEventArgs e)
        {
            ItemController CallItem = new ItemController();

            if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                ItemNameTextBox.Focus();
                QuantityTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0)
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                ItemNameTextBox.Focus();
                QuantityTextBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                ItemNameTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "")
            {
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                QuantityTextBox.Focus();
                CategoryComboBox.Focus();
            }
            else if (ItemNameTextBox.Text.Length == 0)
            {
                ItemNameErrorMessage.Text = "Item Name Can't Be Empty!";
                ItemNameTextBox.Focus();
            }
            else if (QuantityTextBox.Text.Length == 0)
            {
                QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!";
                QuantityTextBox.Focus();
            }
            else if (CategoryComboBox.Text == "")
            {
                CategoryErrorMessage.Text = "You Must Choose Category Item!";
                CategoryComboBox.Focus();
            }
            else
            {
                string Iname = ItemNameTextBox.Text;
                int    Iqty  = Convert.ToInt32(QuantityTextBox.Text);
                int    Icat  = Convert.ToInt32(CategoryComboBox.SelectedValue.ToString());

                CallItem.UpdateItem(Convert.ToInt16((dataGrid.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text), Iname, Iqty, Icat);
            }
        }
Esempio n. 6
0
        private bool IsValidated()
        {
            if (ClientNameTextBox.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Client Name is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ClientNameTextBox.Focus();
                return(false);
            }

            if (ItemNameComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Item Name is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (QuantityTextBox.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Quantity is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                QuantityTextBox.Focus();
                return(false);
            }

            else
            {
                int  tempQuantity;
                bool isNumeric = int.TryParse(QuantityTextBox.Text.Trim(), out tempQuantity);

                if (!isNumeric)
                {
                    MessageBox.Show("Quantity should be integer value.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    QuantityTextBox.Clear();
                    QuantityTextBox.Focus();
                    return(false);
                }
            }

            if (UnitPriceTextBox.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Unit Price is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                UnitPriceTextBox.Focus();
                return(false);
            }
            else
            {
                decimal n;
                bool    isDecimal = decimal.TryParse(UnitPriceTextBox.Text.Trim(), out n);

                if (!isDecimal)
                {
                    MessageBox.Show("Unit Price should be decimal value.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    UnitPriceTextBox.Clear();
                    UnitPriceTextBox.Focus();
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 7
0
        private void ClearButton_Click(object sender, EventArgs e)
        {
            //Clear Textboxes
            TitleTextBox.Clear();
            PriceTextBox.Clear();
            ExtendedPriceTextBox.Clear();
            DiscountedPriceTextBox.Clear();
            DiscountTextBox.Clear();
            QuantityTextBox.Clear();

            //Set focus on Quantity
            QuantityTextBox.Focus();
        }
Esempio n. 8
0
        private void GetSelectedItem()
        {
            Product = ProductsGrid.SelectedRows[0].DataBoundItem as Product;
            double temp;

            if (double.TryParse(QuantityTextBox.Text, out temp))
            {
                Quantity = temp;
            }
            else
            {
                Quantity = 1;
            }
            QuantityTextBox.Focus();
        }
        private void PriceTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.Enter: {
                if (!decimal.TryParse(this.PriceTextBox.Text, out decimal price))
                {
                    this.PriceTextBox.Text = this.PriceTextBox.Text.Replace('.', ',');
                    if (!decimal.TryParse(this.PriceTextBox.Text, out price))
                    {
                        MessageBox.Show("Введите корректную цену!");
                        return;
                    }    //if
                }        //if
                QuantityTextBox.Focus();
            }
            break;

            default: break;
            }//switch
        }
        private void AddToOrderButton_Click(object sender, RoutedEventArgs e)
        {
            if (IsAddOrderItemEligible())
            {
                _selectedOrderEntry = new SupplyOrderEntry(_orderId, _selectedItem.Id, _selectedItem.Name,
                                                           int.Parse(QuantityTextBox.Text), decimal.Parse(PriceTextBox.Text));
                if (_newOrder.AddEntry(_selectedOrderEntry))
                {
                    RefreshSupplyDataGrid();
                    TotalAmountTextBox.Text = _newOrder.Total.ToString();
                    FinalInfoRefresh();
                }
                else
                {
                    MessageBox.Show("Item Is Already in the Order", "Information", MessageBoxButton.OK,
                                    MessageBoxImage.Information);
                }
            }

            QuantityTextBox.Focus();
        }
Esempio n. 11
0
        //Event Handler for QuantityTextBox change
        //If user directly enters value of quantity
        private void QuantityTextBox_Leave(object sender, EventArgs e)
        {
            int Value = 0;

            try
            {
                int CurrentValue = int.Parse(QuantityTextBox.Text);
                //checking if input is less than zero
                if (CurrentValue <= 0)
                {
                    MessageBox.Show("Zero or Less quantity not Allowed. You can use delete button to remove the product from Cart");
                    QuantityTextBox.Undo();
                    QuantityTextBox.SelectAll();
                    QuantityTextBox.Focus();
                }
                //if input is greater than 0
                else
                {
                    for (int i = 0; i < MainForm.ProductList.Count; i++)
                    {
                        //finding the product
                        if (MainForm.ProductList[i].ProductCategory == this.ProdCat &&
                            MainForm.ProductList[i].ProductID == this.ProdID)
                        {
                            //checking the available stock quantity
                            if (CurrentValue <= MainForm.ProductList[i].ProductQuantity)
                            {
                                //Rechecking the previous quantity
                                QuantityTextBox.Undo();

                                if (QuantityTextBox.Text != CurrentValue.ToString())
                                {
                                    Value = CurrentValue;
                                    try
                                    {
                                        CurrentValue         = CurrentValue - int.Parse(QuantityTextBox.Text);
                                        QuantityTextBox.Text = Value.ToString();
                                    }
                                    catch
                                    {
                                        QuantityTextBox.Text = Value.ToString();
                                    }
                                }

                                //Calculating Items and Totals using provided quantity
                                MainForm.TotalItems += CurrentValue;
                                MainForm.GrandTotal += (CurrentValue * this._ProductPrice);
                                MainForm frm = (MainForm)this.FindForm();
                                frm.TotalItemsLabel.Text    = MainForm.TotalItems.ToString();
                                frm.GrandTotalLabel.Text    = MainForm.GrandTotal.ToString();
                                ProductTotalPriceLabel.Text = (Value * this._ProductPrice).ToString();
                                break;
                            }
                            else
                            {
                                MessageBox.Show("Requested Quantities of " + this.ProdName + " are not available in inventory",
                                                "Not Enough Items Available", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                QuantityTextBox.Undo();
                                QuantityTextBox.Focus();
                            }
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("Only Numbers are allowed in quantity. Please enter valid quantity",
                                "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error);
                QuantityTextBox.Focus();
                QuantityTextBox.SelectAll();
                QuantityTextBox.Undo();
            }
        }
Esempio n. 12
0
        /// <summary>
        /// The currently selected book in the ComboBox will be added to the order summary grid.
        /// If the selection already exists in the table, the quantity is updated and the line total recalculates.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddTitleButton_Click(object sender, EventArgs e)
        {
            // Check if user has selected a book in the dropDown menu. If not,
            // show message and set focus to the dropDown.
            if (BookSelectionBox.SelectedIndex == -1)
            {
                BookSelectionBox.Focus();
                MessageBox.Show("Select a Book from the DropDown Menu first.", "No Book Selected");
                return;
            }

            // Following block checks if value passed in quantity box is valid.
            // If not, display message and set focus to quantity box.
            int parse;

            if (int.TryParse(QuantityTextBox.Text, out parse) == false || parse == 0)
            {
                MessageBox.Show("Enter a valid quantity.", "Invalid Quantity");
                QuantityTextBox.Clear();
                QuantityTextBox.Focus();
                return;
            }

            string[] bookData         = new string[4];
            string   connectionString = "server=localhost;user=root;database=book store;password="******"select title, author, isbn, price from books where title='{BookSelectionBox.Text}'", DBConnect);
                // Open Connection and retrieve data using mysql reader
                // SRC: https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/retrieving-data-using-a-datareader
                DBConnect.Open();

                // Read book data into bookData array.
                MySqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();
                    bookData[0] = reader.GetString(0);
                    bookData[1] = reader.GetString(1);
                    bookData[2] = reader.GetString(2);
                    bookData[3] = reader.GetString(3);
                }
                DBConnect.Close();
            }

            Book tempBook   = new Book(bookData[1], bookData[2], bookData[3], bookData[0]); // Create a tempBook to alias the currently selected item in the comboBox.
            int  currentQty = 0;                                                            // Variable will track quantity of selected book already in the data grid.
            bool inTable    = false;                                                        // Variable tracks whether the selected book is already in the grid.

            // Foreach loop checks if entry already exists. Also updates global qty.
            foreach (DataGridViewRow row in OrderSummaryData.Rows)
            {
                // If entry already exists, update currentQty.
                if (row.Cells[0].Value.ToString().Contains(tempBook.Title))
                {
                    currentQty     += Convert.ToInt32(row.Cells[2].Value);
                    currentRowIndex = row.Index;
                    inTable         = true;
                }
            }


            // If entry didn't exist in table, create a row and set row index to the new row.
            if (!inTable)
            {
                // If this is a subsequent addition.
                if (firstTitleAdded)
                {
                    // Add a row and set to the new row's index - 1. I could not figure out why this was
                    // necessary but it was the only way I could get the form to work.
                    OrderSummaryData.Rows.Add();
                    currentRowIndex = OrderSummaryData.NewRowIndex - 1;
                }
                // If this is the first addition, set the bool and continue at first index.
                else
                {
                    firstTitleAdded = true;
                }
            }
            // Set the cells of the added row to the book's attributes.
            OrderSummaryData.Rows[currentRowIndex].Cells[0].Value = tempBook.Title;
            OrderSummaryData.Rows[currentRowIndex].Cells[1].Value = tempBook.Price;
            // Update the quantity with the previous qty, if any, plus the new user-input qty.
            OrderSummaryData.Rows[currentRowIndex].Cells[2].Value = Convert.ToInt32(QuantityTextBox.Text) + currentQty;

            // Extract the price, without the dollar sign, and multiply it with the quantity.
            double num1  = Convert.ToDouble(OrderSummaryData.Rows[currentRowIndex].Cells[2].Value);
            double num2  = Convert.ToDouble(tempBook.Price.Substring(1));
            double total = num1 * num2;

            OrderSummaryData.Rows[currentRowIndex].Cells[3].Value = total.ToString("C2");   // Add to 0.00 to keep 2 numbers after decimal point.

            // Calculate subtotal, tax, and total. Re-using num1 and num2 as subtotal and tax, respectively.
            num1 = 0; num2 = 0; total = 0;
            // Loop adds each line total and stores in num1 (subtotal).
            foreach (DataGridViewRow row in OrderSummaryData.Rows)
            {
                string temp = row.Cells[3].Value.ToString();   // First create a temp string with the line total string.
                num1 += Convert.ToDouble(temp.Substring(1));   // Extract the string without the '$' and store as subtotal.
            }

            num2  = 0.1 * num1;     // Calculate tax (10% of subtotal).
            total = num1 + num2;    // Total = tax + subtotal.

            // Set the textBoxes with subtotal, tax, total.
            SubtotalTextBox.Text      = num1.ToString("C2");
            TaxTextBox.Text           = num2.ToString("C2");
            TotalTextBox.Text         = total.ToString("C2");
            CancelOrderButton.Enabled = true;       // Allow cancel order
        }
Esempio n. 13
0
    protected void QuantityButton_Click(object sender, EventArgs e)
    {
        Valid = new Validation();
        string  UserID             = "Tturner";
        Utility UT                 = new Utility();
        string  PickZone           = CurrentZone;
        string  ProductID          = UT.GetProductID(ProductTextBox.Text);
        string  LocationID         = LocationTextBox.Text;
        string  shipmentID         = Valid.GetShipmentID(BoxID);
        string  OrderNumber        = Valid.GetOrderNumber(BoxID);
        string  Quantity           = QuantityTextBox.Text;
        int     NumberOfMoveQueues = 0;
        int     n;
        string  orderLine;
        string  InventoryRID;
        bool    isNumeric = int.TryParse(Quantity, out n);


        if (isNumeric == true)
        {
            int EnteredQuantity = Convert.ToInt16(Quantity);
            if (Valid.IsValidQuantity(shipmentID, OrderNumber, ProductID, Quantity) == true)
            {
                QuantityTextBox.Text = "";
                LocationTextBox.Text = "";
                ProductTextBox.Text  = "";
                LocationTextBox.Focus();
                QuantityInputGroup.Attributes["class"] = "form-group has-success";
                orderLine = UT.GetOrderLine(shipmentID, OrderNumber, Quantity, ProductID);

                NumberOfMoveQueues = UT.GetNumberOfMoveQueues(shipmentID, OrderNumber, orderLine);

                int NQuantity = Convert.ToInt16(Quantity);
                for (int i = 0; i < NumberOfMoveQueues; i++)
                {
                    string MoveQRID      = UT.GetMoveQueueRID(shipmentID, OrderNumber, orderLine);
                    int    moveQQuantity = UT.GetMoveQueueQuantity(MoveQRID);
                    InventoryRID = UT.GetInventoryRID(MoveQRID);
                    UT.InsertPickIntoInventory(moveQQuantity.ToString(), shipmentID, OrderNumber, orderLine, UserID, InventoryRID);

                    UT.deleteMoveQueue(MoveQRID);
                    if (InventoryRID != "")
                    {
                        UT.UpdateInventory(UserID, moveQQuantity.ToString(), InventoryRID);
                        UT.MoveToQCEmpty(InventoryRID, shipmentID, OrderNumber, orderLine);
                        UT.InsertIntoAuditInventory(UserID, moveQQuantity.ToString(), shipmentID, OrderNumber, orderLine, ProductID, LocationID, InventoryRID);
                    }
                    else
                    {
                        //error message
                    }
                }

                if (Valid.OrderDone(shipmentID, OrderNumber) == true)
                {
                    UT.UpdateOoutboundShipments(shipmentID, OrderNumber);
                }

                if (Valid.IsQCRequired(UserID) == true)
                {
                    UT.SetQCRequired(shipmentID, OrderNumber);
                }

                UT.DeleteInventoryAllocation(shipmentID, OrderNumber, orderLine);

                QuantityInputGroup.Attributes["class"] = "form-group";
                LocationInputGroup.Attributes["class"] = "form-group";

                ProductInputGroup.Attributes["class"] = "form-group";

                //check to see if we need more inventory from another
                //updateLocationStatus
            }
            else
            {
                QuantityTextBox.Text = "";
                QuantityTextBox.Attributes["placeholder"] = "Incorrect Quantity";
                QuantityTextBox.Focus();

                QuantityInputGroup.Attributes["class"] = "form-group has-error";
            }
        }
        else
        {
            QuantityTextBox.Text = "";
            BoxScannTextBox.Attributes["placeholder"] = "Please enter a number";
            QuantityInputGroup.Attributes["class"]    = "form-group has-error";
        }
    }
Esempio n. 14
0
    protected void ProductCheckButton_Click(object sender, EventArgs e)
    {
        Valid = new Validation();

        string GTIN        = ProductTextBox.Text;
        string ProductID   = Valid.GtinToPruductID(GTIN);
        string LocationID  = LocationTextBox.Text;
        string shipmentID  = Valid.GetShipmentID(BoxID);
        string OrderNumber = Valid.GetOrderNumber(BoxID);

        if (Valid.inNumeric(GTIN) == true)
        {
            ProductID = Valid.GtinToPruductID(GTIN);
        }
        else
        {
            ProductID = GTIN;
        }



        if (ProductID != "" && LocationID != "")
        {
            if (Valid.ProductIsInTHisOrder(Valid.GetShipmentID(BoxID), Valid.GetOrderNumber(BoxID), ProductID) == true || Valid.DescriptionInThisOrder(Valid.GetShipmentID(BoxID), Valid.GetOrderNumber(BoxID), ProductID, LocationID) == true)
            {
                if (Valid.ProductInEnteredLocation(Valid.GetShipmentID(BoxID), Valid.GetOrderNumber(BoxID), LocationID, ProductID) == true || Valid.DescriptionInEnteredLocation(LocationID, ProductID) == true)
                {
                    if (Valid.IsThereAPriority1ReplenComingHere(LocationID) != true)
                    {
                        ProductTextBox.Text = ProductID.ToUpper();

                        LocationTextBox.Focus();
                        ProductInputGroup.Attributes["class"] = "form-group has-success";
                        QuantityTextBox.Focus();
                    }
                    else
                    {
                        ProductTextBox.Text = "";
                        ProductTextBox.Attributes["placeholder"] = "Replen Can Not Pick";
                        ProductInputGroup.Attributes["class"]    = "form-group has-error";
                    }
                }
                else
                {
                    ProductTextBox.Text = "";
                    ProductTextBox.Attributes["placeholder"] = "Item not in This Location";
                    ProductInputGroup.Attributes["class"]    = "form-group has-error";
                }
            }
            else
            {
                ProductTextBox.Text = "";
                ProductTextBox.Attributes["placeholder"] = "Item not in order";
                ProductInputGroup.Attributes["class"]    = "form-group has-error";
            }
        }
        else
        {
            ProductTextBox.Text = "";
            ProductTextBox.Attributes["placeholder"] = "Enter Product";
            ProductInputGroup.Attributes["class"]    = "form-group has-error";
        }
    }