Пример #1
0
        protected void imgBtnShowDeductBalance_OnCommand(object sender, CommandEventArgs e)
        {
            this.mPopUpShowDeductPrepaidPkg.Show();

            selectedPrepaidBottle = PrepaidBottleManager.GetPrepaidBottleByID(Convert.ToInt32(e.CommandArgument.ToString()));

            PrepaidBottleList pList = new PrepaidBottleList();

            pList.Add(selectedPrepaidBottle);

            //populate formview
            fview_DeductPrepaidBottle.DataSource = pList;
            fview_DeductPrepaidBottle.DataBind();

            //display current balance
            (fview_DeductPrepaidBottle.FindControl("lblCurrentBalanceValue") as Label).Text = selectedPrepaidBottle.Balance.ToString();

            //set the focus on the deduct qty textbox
            (fview_DeductPrepaidBottle.FindControl("txtDeductQty") as TextBox).Focus();
        }
Пример #2
0
        private void HandlePrepaidWaterPackages(Invoice newInvoice, InvoiceLineItem lineItem)
        {
            if ((lineItem.ProductCode).Contains("WAT PKG"))
            {
                if (newInvoice.AccountID != null)
                {
                    // check if the account has an existing prepaid bottle account
                    // if not, create a new one
                    int           bottleTypeID = ExtractBottleTypeID(lineItem.ProductCode);
                    PrepaidBottle p            = PrepaidBottleManager.GetPrepaidBottle(_accountID, bottleTypeID);

                    if (p == null) //create a new one
                    {
                        p                   = new PrepaidBottle();
                        p.AccountID         = _accountID;
                        p.PrepaidBottleType = bottleTypeID;
                        p.CreatedBy         = User.Identity.Name.ToString();
                        p.TopUpBalance(ProductManager.GetTopUpQty(lineItem.ProductCode) * lineItem.Quantity);
                        p.PrepaidBottleID = PrepaidBottleManager.Save(p);
                    }
                    else
                    {
                        p.TopUpBalance(ProductManager.GetTopUpQty(lineItem.ProductCode));
                        p.ModifiedBy = User.Identity.Name.ToString();
                        PrepaidBottleManager.Save(p);
                    }

                    // save the prepaid bottle transaction
                    PrepaidBottleTransaction pBTransaction = new PrepaidBottleTransaction();
                    pBTransaction.PrepaidBottleID    = p.PrepaidBottleID;
                    pBTransaction.TransactionType    = "topUp";
                    pBTransaction.TopUpQty           = ProductManager.GetTopUpQty(lineItem.ProductCode) * lineItem.Quantity;
                    pBTransaction.LastUpdatedBalance = p.Balance;
                    pBTransaction.CreatedBy          = User.Identity.Name.ToString();
                    pBTransaction.TransactionID      = PrepaidBottleTransactionManager.Save(pBTransaction);
                }
            }
        }
Пример #3
0
        protected void lnkDeductPrepaid_OnCommand(object sender, CommandEventArgs e)
        {
            //get the deduct qty from the formview
            int deductQty = Convert.ToInt32((fview_DeductPrepaidBottle.FindControl("txtDeductQty") as TextBox).Text);

            selectedPrepaidBottle.DeductBalance(deductQty);
            selectedPrepaidBottle.ModifiedBy   = User.Identity.Name.ToString();
            selectedPrepaidBottle.ModifiedDate = DateTime.Now.ToLocalTime();
            PrepaidBottleManager.Save(selectedPrepaidBottle);

            PrepaidBottleTransaction pTransaction = new PrepaidBottleTransaction();

            pTransaction.PrepaidBottleID     = selectedPrepaidBottle.PrepaidBottleID;
            pTransaction.LastUpdatedBalance  = selectedPrepaidBottle.Balance;
            pTransaction.DeductQty           = deductQty;
            pTransaction.TransactionType     = "deduct";
            pTransaction.CreatedBy           = User.Identity.Name.ToString();
            pTransaction.LastTransactionDate = DateTime.Now.ToLocalTime();
            PrepaidBottleTransactionManager.Save(pTransaction);

            //refresh the Prepaid Water Gridview
            DisplayPrepaidWater();
        }
Пример #4
0
 private void DisplayPrepaidWater()
 {
     gviewPrepaidPackage.DataSource = PrepaidBottleManager.GetPrepaidPackagesByAccount(_accountID);
     gviewPrepaidPackage.DataBind();
 }