示例#1
0
        protected void PopulateGridview(List <InvoiceItems> list)
        {
            string method = "populateGridview";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                GrdInventorySearched.Visible = true;
                //Binds returned items to gridview for display
                GrdInventorySearched.DataSource = list;
                GrdInventorySearched.DataBind();
                //grdInventorySearched.PageIndex = 0;
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
示例#2
0
        protected void BtnInventorySearch_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnInventorySearch_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                if (txtSearch.Text != "")
                {
                    lblInvalidQty.Visible           = false;
                    GrdInventorySearched.DataSource = ITM.CallReturnInvoiceItemsFromSearchStringForSale(txtSearch.Text, objPageDetails);
                    GrdInventorySearched.DataBind();
                    txtSearch.Text = "";
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
示例#3
0
        protected void BtnClearSearch_Click(object sender, EventArgs e)
        {
            string method = "BtnClearSearch_Click";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                GrdInventorySearched.DataSource = null;
                GrdInventorySearched.DataBind();
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
示例#4
0
        protected void GrdInventorySearched_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //Collects current method for error tracking
            string method = "GrdInventorySearched_RowCommand";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0];
                lblInvalidQty.Visible = false;
                int    index    = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
                int    quantity = 1;
                string qty      = ((TextBox)GrdInventorySearched.Rows[index].Cells[2].FindControl("quantityToAdd")).Text;
                if (qty != "")
                {
                    if (int.TryParse(qty, out quantity))
                    {
                        quantity = Convert.ToInt32(qty);
                    }
                }
                int currentQty = Convert.ToInt32(((Label)GrdInventorySearched.Rows[index].Cells[2].FindControl("QuantityInOrder")).Text);
                if (quantity > currentQty || quantity < 1)
                {
                    lblInvalidQty.Visible = true;
                }
                else
                {
#pragma warning disable IDE0017 // Simplify object initialization
                    InvoiceItems selectedSku = new InvoiceItems();
#pragma warning restore IDE0017 // Simplify object initialization
                    selectedSku.intInventoryID = Convert.ToInt32(e.CommandArgument);
                    selectedSku.intInvoiceID   = invoice.intInvoiceID;
                    if (!IIM.CallItemAlreadyInCart(selectedSku, objPageDetails))
                    {
                        double discount       = 0;
                        string discountAmount = ((TextBox)GrdInventorySearched.Rows[index].Cells[5].FindControl("txtAmountDiscount")).Text;
                        if (discountAmount != "")
                        {
                            if (double.TryParse(discountAmount, out discount))
                            {
                                discount = Convert.ToDouble(discountAmount);
                            }
                        }
                        selectedSku.fltItemDiscount      = discount;
                        selectedSku.varItemDescription   = ((Label)GrdInventorySearched.Rows[index].Cells[3].FindControl("Description")).Text;
                        selectedSku.fltItemRefund        = 0;
                        selectedSku.fltItemPrice         = double.Parse(((Label)GrdInventorySearched.Rows[index].Cells[4].FindControl("rollPrice")).Text, NumberStyles.Currency);
                        selectedSku.fltItemCost          = double.Parse(((Label)GrdInventorySearched.Rows[index].Cells[4].FindControl("rollCost")).Text, NumberStyles.Currency);
                        selectedSku.bitIsDiscountPercent = ((CheckBox)GrdInventorySearched.Rows[index].Cells[5].FindControl("chkDiscountPercent")).Checked;
                        selectedSku.bitIsClubTradeIn     = ((CheckBox)GrdInventorySearched.Rows[index].Cells[6].FindControl("chkTradeInSearch")).Checked;
                        selectedSku.intItemTypeID        = Convert.ToInt32(((Label)GrdInventorySearched.Rows[index].Cells[7].FindControl("lblTypeIDSearch")).Text);
                        selectedSku.intItemQuantity      = quantity;

                        //add item to table and remove the added qty from current inventory
                        IIM.CallInsertItemIntoSalesCart(selectedSku, invoice.intTransactionTypeID, invoice.dtmInvoiceDate, Convert.ToInt32(DdlShippingProvince.SelectedValue), objPageDetails);
                        IIM.CallRemoveQTYFromInventoryWithSKU(selectedSku.intInventoryID, selectedSku.intItemTypeID, (currentQty - quantity), objPageDetails);

                        invoice = IM.CallReturnCurrentInvoice(invoice.intInvoiceID, objPageDetails)[0];
                        //Set an empty variable to bind to the searched items grid view so it is empty
                        GrdInventorySearched.DataSource = null;
                        GrdInventorySearched.DataBind();
                        Session["currentInvoice"] = invoice;
                        //Recalculate the new subtotal
                        UpdateInvoiceTotals();
                    }
                    else
                    {
                        MessageBoxCustom.ShowMessage("Item is already in the cart. Please update item in cart or process a second sale.", this);
                    }
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }