示例#1
0
 public ProceedOrderBAL()
 {
     this.cartBal    = new CartBAL();
     this.accountBal = new AccountBAL();
     this.orderBal   = new OrderBAL();
     this.bookBal    = new BookBAL();
 }
    protected void btnCart_Click(object sender, EventArgs e)
    {
        InsertProductDetails();

        CartBAL balCart = new CartBAL();
        CartENT entCart = new CartENT();

        if (Session["UserID"] != null)
        {
            entCart.UserID = Convert.ToInt32(Session["UserID"]);
        }

        if (tempProductDetailsID != 0)
        {
            entCart.ProductDetailsID = tempProductDetailsID;
        }

        if (balCart.Insert(entCart))
        {
            lblMessage.Text       = "Add to Cart SuccessFullly";
            divMessage.Visible    = true;
            hlMessage.Text        = "View Cart";
            hlMessage.NavigateUrl = ("~/User/Cart.aspx");
            hlMessage.Visible     = true;
        }
        else
        {
            lblMessage.Text    = balCart.Message;
            divMessage.Visible = true;
        }
    }
示例#3
0
    public void FillProductDetailsGridView()
    {
        DataTable dtCartDetails  = new DataTable();
        CartBAL   balCartDetails = new CartBAL();

        dtCartDetails = balCartDetails.SelectALL(Convert.ToInt32(Session["UserID"]));
        if (dtCartDetails != null && dtCartDetails.Rows.Count > 0)
        {
            gvCartDetails.DataSource = dtCartDetails;
            gvCartDetails.DataBind();
        }
        GrandTotal();
    }
示例#4
0
    private void FillRepeatorCart()
    {
        DataTable dtCartDetails  = new DataTable();
        CartBAL   balCartDetails = new CartBAL();

        dtCartDetails = balCartDetails.SelectALL(Convert.ToInt32(Session["UserID"]));
        if (dtCartDetails != null && dtCartDetails.Rows.Count > 0)
        {
            rptCheckout.DataSource = dtCartDetails;
            rptCheckout.DataBind();
        }
        GrandTotal();
    }
    protected void gvProductDetails_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Remove")
        {
            if (e.CommandArgument != null)
            {
                ProductDetailsBAL balProductDetails = new ProductDetailsBAL();
                if (balProductDetails.Delete(Convert.ToInt32(e.CommandArgument.ToString().Trim()), Convert.ToInt32(Session["UserID"])))
                {
                    FillProductDetailsGridView();
                }
                else
                {
                    lblMessage.Text    = balProductDetails.Message;
                    divMessage.Visible = true;
                }
            }
        }
        else if (e.CommandName == "AddtoCart")
        {
            if (e.CommandArgument != null)
            {
                CartBAL balCart = new CartBAL();
                CartENT entCart = new CartENT();

                if (Session["UserID"] != null)
                {
                    entCart.UserID = Convert.ToInt32(Session["UserID"]);
                }

                if (e.CommandArgument != null)
                {
                    entCart.ProductDetailsID = Convert.ToInt32(e.CommandArgument.ToString().Trim());
                }

                if (balCart.Insert(entCart))
                {
                    lblMessage.Text    = "Add to Cart Successfully";
                    divMessage.Visible = true;
                    hlMessage.Text     = "View Cart";
                    hlMessage.Visible  = true;
                }
                else
                {
                    lblMessage.Text    = balCart.Message;
                    divMessage.Visible = true;
                }
            }
        }
    }
示例#6
0
 protected void gvCartDetails_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Remove")
     {
         if (e.CommandArgument != null)
         {
             CartBAL balCart = new CartBAL();
             if (balCart.Delete(Convert.ToInt32(e.CommandArgument.ToString().Trim()), Convert.ToInt32(Session["UserID"])))
             {
                 FillProductDetailsGridView();
             }
             else
             {
                 lblMessage.Text    = balCart.Message;
                 divMessage.Visible = true;
             }
         }
     }
 }
示例#7
0
    protected void btnUpdateCart_Click(object sender, EventArgs e)
    {
        CartBAL balCart = new CartBAL();
        CartENT entCart = new CartENT();

        foreach (GridViewRow row in gvCartDetails.Rows)
        {
            int intCartID = int.Parse((row.FindControl("lblCartID") as Label).Text);
            entCart.ProductDetailsID = int.Parse((row.FindControl("lblProductDetailsID") as Label).Text);
            entCart.Quantity         = int.Parse((row.FindControl("txtQuantity") as TextBox).Text);

            if (balCart.Update(entCart, intCartID, Convert.ToInt32(Session["UserID"])))
            {
                FillProductDetailsGridView();
            }
            else
            {
                lblMessage.Text    = balCart.Message;
                divMessage.Visible = true;
            }
        }
    }
示例#8
0
 public BookInfoBAL()
 {
     this.bookBal     = new BookBAL();
     this.cartBal     = new CartBAL();
     this.categoryBal = new CategoryBAL();
 }
示例#9
0
 public LoginBAL()
 {
     this.accountBal = new AccountBAL();
     this.userBal    = new UserBAL();
     this.cartBal    = new CartBAL();
 }
示例#10
0
 public UserCartBAL()
 {
     this.cartBal     = new CartBAL();
     this.accountBal  = new AccountBAL();
     this.categoryBal = new CategoryBAL();
 }