Example #1
0
        protected void CalculateTotal()
        {
            Decimal discount = Decimal.Zero;

            Discount.IsCashDiscount = true;

            if (!Decimal.TryParse(txtDiscount.Text, out discount) && txtDiscount.Text.Contains("%"))
            {
                Discount.IsCashDiscount = false;
                txtDiscount.Text        = txtDiscount.Text.Replace("%", "");
                Decimal.TryParse(txtDiscount.Text, out discount);
            }

            Discount.DiscountValue = discount;

            if (!Discount.IsCashDiscount)
            {
                lblTotal.Text     = (SaleItemList.Sum(i => i.ProfitPrice) - (SaleItemList.Sum(i => i.ProfitPrice) * Discount.DiscountValue / 100)).ToString("##,##0.00");;
                txtDiscount.Text += "%";
            }
            else
            {
                lblTotal.Text = (SaleItemList.Sum(i => i.ProfitPrice) - Discount.DiscountValue).ToString("##,##0.00");
            };
        }
Example #2
0
 protected void BindGrdSaleItem()
 {
     grdSaleItens.DataSource = SaleItemList;
     lblSubtotal.Text        = SaleItemList.Sum(item => item.ProfitPrice).ToString("##,##0.00");
     CalculateTotal();
     grdSaleItens.DataBind();
     btnPayment.Visible = SaleItemList.Any();
 }