Exemplo n.º 1
0
        //Other functionality
        protected void BtnCancelSale_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "btnCancelSale_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                InvoiceItemsManager IIM     = new InvoiceItemsManager();
                Invoice             invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0];
                IIM.LoopThroughTheItemsToReturnToInventory(invoice.intInvoiceID, invoice.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails);
                IIM.CallRemoveInitialTotalsForTable(invoice.intInvoiceID, objPageDetails);
                //Changes to the Home page
                Response.Redirect("HomePage.aspx", false);
            }
            //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);
            }
        }
        private int ReturnInventoryIDFromSKU(string sku, int itemTypeID, object[] objPageDetails)
        {
            string strQueryName     = "ReturnInventoryIDFromSKU";
            InvoiceItemsManager IIM = new InvoiceItemsManager();
            string sqlCmd           = "SELECT intInventoryID FROM tbl_" + IIM.CallReturnTableNameFromTypeID(itemTypeID, objPageDetails) + " WHERE varSku = @varSku";

            object[][] parms =
            {
                new object[] { "@varSku", sku }
            };
            return(DBC.MakeDataBaseCallToReturnInt(sqlCmd, parms, objPageDetails, strQueryName));
        }
Exemplo n.º 3
0
        //Finalizing the trade-in item
        protected void BtnAddTradeIN_Click(object sender, EventArgs e)
        {
            string method = "BtnAddTradeIN_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                CU = (CurrentUser)Session["currentUser"];
                //Creating a new club
                Clubs tradeIN = new Clubs
                {
                    intInventoryID           = inventoryID,
                    varSku                   = lblSKUDisplay.Text,
                    fltCost                  = Convert.ToDouble(txtCost.Text),
                    fltPrice                 = Convert.ToDouble(txtPrice.Text),
                    fltPremiumCharge         = 0,
                    intItemTypeID            = 1,
                    intBrandID               = Convert.ToInt32(ddlBrand.SelectedValue),
                    intModelID               = Convert.ToInt32(ddlModel.SelectedValue),
                    intQuantity              = Convert.ToInt32(txtQuantity.Text),
                    varTypeOfClub            = txtClubType.Text,
                    varShaftType             = txtShaft.Text,
                    varClubSpecification     = txtClubSpec.Text,
                    varShaftFlexability      = txtShaftFlex.Text,
                    varNumberOfClubs         = txtNumberofClubs.Text,
                    varShaftSpecification    = txtShaftSpec.Text,
                    varClubDexterity         = txtDexterity.Text,
                    varAdditionalInformation = txtComments.Text,
                    bitIsUsedProduct         = true,
                    intLocationID            = CU.location.intLocationID
                };

                //this adds to the temp tradeIncart
                ItM.CallAddTradeInItemToTempTable(tradeIN, objPageDetails);

                //change cost and price for cart
                InvoiceItemsManager IIM             = new InvoiceItemsManager();
                InvoiceItems        selectedTradeIn = new InvoiceItems
                {
                    intInvoiceID       = invoice.intInvoiceID,
                    intInventoryID     = tradeIN.intInventoryID,
                    varSku             = tradeIN.varSku,
                    intItemQuantity    = tradeIN.intQuantity,
                    varItemDescription = ItM.CallReturnBrandlNameFromBrandID(tradeIN.intBrandID, objPageDetails) + " "
                                         + ItM.CallReturnModelNameFromModelID(tradeIN.intModelID, objPageDetails) + " " + tradeIN.varClubSpecification + " "
                                         + tradeIN.varTypeOfClub + " " + tradeIN.varShaftSpecification + " " + tradeIN.varShaftFlexability + " "
                                         + tradeIN.varClubDexterity,
                    fltItemCost          = 0,
                    fltItemPrice         = tradeIN.fltCost * (-1),
                    fltItemDiscount      = 0,
                    fltItemRefund        = 0,
                    bitIsDiscountPercent = false,
                    bitIsClubTradeIn     = true,
                    intItemTypeID        = 1
                };

                IIM.CallInsertItemIntoSalesCart(selectedTradeIn, invoice.intTransactionTypeID, invoice.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails);

                //IIM.NewTradeInChangeChargeTaxToFalse(selectedTradeIn, invoice.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails);

                //Closing the trade in information window
                string redirect = "<script>window.close('TradeINEntry.aspx');</script>";
                Response.Write(redirect);
            }
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }