コード例 #1
0
        private void SaveOrder()
        {
            try
            {
                _sb.Execute("SelectMaxIdOrderOutCapability");
                if (_sb.Success != null)
                {
                    _sb._Id               = (int)_sb.Success;
                    _sb._Paid             = _sb._Total;
                    _sb._Change           = 0;
                    _sb._CreditCardNumber = _pmb._CCNumber;
                    _sb._OrderDate        = DateTime.Now;
                    _sb._Holder           = _pmb._Name;
                    _sb._CustomerId       = _pmb._CustomerId;

                    _sb.Execute("InsertOrderOutCapability");
                    if (_sb.Success != null)
                    {
                        SaveOrderDetail(_sb._Id);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (Session["PurchaseBroker"] != null)
                    {
                        _pb = (CustomerAgent)Session["PurchaseBroker"];
                    }
                    else
                    {
                        _pb = new CustomerAgent();
                        Session["PurchaseBroker"] = _pb;
                    }

                    if (Session["ProfileMonitor"] != null)
                    {
                        _pmb = (CustomerAgent)Session["ProfileMonitor"];
                    }
                    else
                    {
                        _pmb = new CustomerAgent();
                        Session["ProfileMonitor"] = _pmb;
                    }

                    GetCountries();
                    GetCities(int.Parse(CountryDDL.Text.ToString()));

                    _pmb._CustomerId = _pb._CustomerId;
                    _pmb._Flag       = "C";
                    _pmb._Top        = 1;
                    _pmb._PageSize   = 1000;
                    _pmb.Execute("SelectCustomer_AddressByCustomerIdCapability");
                    if (_pmb.Success != null)
                    {
                        DataTable addressDT = (DataTable)_pmb.Success;
                        if (addressDT.Rows.Count > 0)
                        {
                            AddressGV.DataSource = addressDT;
                            AddressGV.DataBind();
                        }
                        else
                        {
                            addresstable.Visible = true;
                            Addbtn.Visible       = false;
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
コード例 #3
0
        protected void updatebtn_Click(object sender, EventArgs e)
        {
            try
            {
                _pmb._ExpirationYear  = int.Parse(ExpirationYeartxt.Text);
                _pmb._ExpirationMonth = int.Parse(ExpirationMonthtxt.Text);

                DateTime d = new DateTime(_pmb._ExpirationYear, _pmb._ExpirationMonth, 1);
                if (d.Month >= DateTime.Now.Month && d.Year >= DateTime.Now.Year)
                {
                    _pmb.Execute("UpdateCustomer_CreditCardCapability");
                    if (_pmb.Success != null)
                    {
                        updatebtn.Visible          = false;
                        ExpirationMonthtxt.Visible = false;
                        ExpirationYeartxt.Visible  = false;
                        ExpirationMonthlbl.Visible = true;
                        ExpirationYearlbl.Visible  = true;
                        ExpirationMonthlbl.Text    = _pmb._ExpirationMonth.ToString();
                        ExpirationYearlbl.Text     = _pmb._ExpirationYear.ToString();
                        Session["ProfileMonitor"]  = _pmb;
                        confirmbtn.Visible         = true;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #4
0
        private void SaveDelivery(int orderId)
        {
            try
            {
                _db._OrderOutId = orderId;
                _db._Status     = "Processing";
                _db._Number     = _pmb._Number;
                _db._Street     = _pmb._Street;
                _db._District   = _pmb._District;
                _db._Country    = _pmb._Country;
                _db._City       = _pmb._City;
                _db._ZipCode    = _pmb._ZipCode;

                _db.Execute("InsertDeliveryCapability");
                if (_db.Success != null)
                {
                    Label1.Text            = "Thank you for ordering, Your order number is " + orderId.ToString();
                    repeatertxt.DataSource = shoppingCartbookDT;
                    repeatertxt.DataBind();
                    //Session.Clear();
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #5
0
        private void Search(string v, string f, int t, int p)
        {
            _sb._Title    = v;
            _sb._Flag     = f;
            _sb._Top      = t;
            _sb._PageSize = p;

            _sb.Execute("SearchBookByTitleCapability");
            if (_sb.Success != null)
            {
                if (_sb._Flag == "C")
                {
                    if (_sb._SearchBookByTitleCount > 0)
                    {
                        maxTop = Math.Ceiling((double)_sb._SearchBookByTitleCount / (double)_sb._PageSize);
                        totalRecordslbl.Visible = true;
                        totalRecordslbl.Text    = _sb._SearchBookByTitleCount.ToString();
                    }
                }

                searchBookDT = (DataTable)_sb.Success;

                BookGV.DataSource = searchBookDT;
                BookGV.DataBind();
            }
        }
コード例 #6
0
        protected void Savebtn_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (RepeaterItem item in repeatertxt.Items)
                {
                    Label        l  = (Label)item.FindControl("Bookidlbl");
                    TextBox      c  = (TextBox)item.FindControl("commenttxt");
                    DropDownList d  = (DropDownList)item.FindControl("rateDDL");
                    ListItem     di = d.SelectedItem;

                    _ib._BookId     = int.Parse(l.Text);
                    _ib._CustomerId = _pb._ShoppingCartId;
                    _ib._Rate       = float.Parse(di.Value.ToString());
                    _ib._Review     = c.Text;

                    _ib.Execute("SelectMaxIdCustomerRateCapability");
                    if (_ib.Success != null)
                    {
                        _ib._Id = int.Parse(_ib.Success.ToString());
                        _ib.Execute("InsertCustomerRateCapability");
                        if (_ib.Success != null)
                        {
                        }
                    }

                    _ib.Execute("SelectMaxIdCustomerReviewCapability");
                    if (_ib.Success != null)
                    {
                        _ib._Id = int.Parse(_ib.Success.ToString());
                        _ib.Execute("InsertCustomerReviewCapability");
                        if (_ib.Success != null)
                        {
                        }
                    }
                }

                Session.Clear();
                Response.Redirect("~/Pages/HomePage.aspx");
            }
            catch (Exception)
            {
            }
        }
コード例 #7
0
 private void DisplayCatgeory()
 {
     try
     {
         _cb._Top      = 1;
         _cb._PageSize = 1000;
         _cb._Flag     = "C";
         _cb.Execute("SelectAllCategoryCapability");
         if (_cb.Success != null)
         {
             CategoryDDL.DataSource     = (DataTable)_cb.Success;
             CategoryDDL.DataTextField  = "Name";
             CategoryDDL.DataValueField = "Id";
             CategoryDDL.DataBind();
         }
     }
     catch (Exception)
     {
     }
 }
コード例 #8
0
        private void SaveShoppingCart(int index)
        {
            DataRow currentRow = searchBookDT.Rows[index];

            if (shoppingCartDT.Rows.Count > 0)
            {
                _pb._ShoppingCartId = int.Parse(shoppingCartDT.Rows[0]["CustomerId"].ToString());
                SaveShoppingCartDetail(currentRow);
            }
            else
            {
                _pb._Date           = DateTime.Now;
                _pb._Total          = float.Parse(currentRow["Price"].ToString());
                _pb._ShoppingCartId = _pb._CustomerId;
                _pb.Execute("InsertShoppingCartCapability");
                if (_pb.Success != null)
                {
                    SaveShoppingCartDetail(currentRow);
                }
            }

            float sum = 0;

            for (int i = 0; i < shoppingCartbookDT.Rows.Count; i++)
            {
                float p = float.Parse(shoppingCartbookDT.Rows[i]["Price"].ToString());
                int   q = int.Parse(shoppingCartbookDT.Rows[i]["Quantity"].ToString());
                sum += p * q;
            }

            _pb._Date  = DateTime.Now;
            _pb._Total = sum;

            _pb.Execute("UpdateShoppingCartCapability");
            if (_pb.Success != null)
            {
            }
        }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    if (Session["ProfileMonitor"] != null)
                    {
                        _pmb = (CustomerAgent)Session["ProfileMonitor"];
                    }
                    else
                    {
                        _pmb = new CustomerAgent();
                        Session["ProfileMonitor"] = _pmb;
                    }
                }

                _pmb.Execute("SelectCustomer_CreditCardByCustomerIdCapability");
                if (_pmb.Success != null)
                {
                    creditCardDT = (DataTable)_pmb.Success;
                    if (creditCardDT.Rows.Count > 0)
                    {
                        CreditCardGV.DataSource = creditCardDT;
                        CreditCardGV.DataBind();
                    }
                    else
                    {
                        CreditCardtable.Visible = true;
                        Addbtn.Visible          = false;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (Session["DeliveryAgent"] != null)
                    {
                        _db = (CustomerAgent)Session["DeliveryAgent"];
                    }
                    else
                    {
                        _db = new CustomerAgent();
                        Session["DeliveryAgent"] = _db;
                    }

                    _db._Top      = 1;
                    _db._PageSize = 100;
                    _db._Flag     = "C";
                    _db.Execute("SelectAllDeliveryMethodCapability");
                    if (_db.Success != null)
                    {
                        deliveryDT = (DataTable)_db.Success;
                        for (int i = 0; i < deliveryDT.Rows.Count; i++)
                        {
                            deliveryDT.Rows[i]["Method"] = deliveryDT.Rows[i]["Method"].ToString().TrimEnd();
                        }

                        DeliveryGV.DataSource = deliveryDT;
                        DeliveryGV.DataBind();
                    }
                }
                catch (Exception)
                {
                }
            }
        }
コード例 #11
0
 private void DisplayShoppingCart()
 {
     try
     {
         _pb._ShoppingCartId = _pb._CustomerId;
         _pb._Flag           = "C";
         _pb._Top            = 1;
         _pb._PageSize       = 1000;
         _pb.Execute("SelectShoppingCartByCustomerIdCapability");
         if (_pb.Success != null)
         {
             shoppingCartDT = (DataTable)_pb.Success;
             if (shoppingCartDT.Rows.Count > 0)
             {
                 DisplayShoppingCartDetial();
             }
         }
     }
     catch (Exception)
     {
     }
 }
コード例 #12
0
        protected void ShoppingCartBookGV_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                string t     = e.CommandName.ToString();
                int    index = int.Parse(e.CommandArgument.ToString());
                if (t == "Inc" || t == "Dec")
                {
                    DataKey currentRow = ShoppingCartBookGV.DataKeys[index];
                    int     a          = int.Parse(shoppingCartbookDT.Rows[index]["Amount"].ToString());
                    int     q          = int.Parse(shoppingCartbookDT.Rows[index]["Quantity"].ToString());
                    float   p          = float.Parse(shoppingCartbookDT.Rows[index]["Price"].ToString());
                    if (t == "Inc")
                    {
                        q++;
                        if (q <= a)
                        {
                            shoppingCartbookDT.Rows[index]["Quantity"] = q;
                        }
                        else
                        {
                        }
                    }
                    else if (t == "Dec")
                    {
                        if (q > 1)
                        {
                            q--;
                            shoppingCartbookDT.Rows[index]["Quantity"] = q;
                        }
                        else
                        {
                        }
                    }

                    shoppingCartbookDT.Rows[index]["Total"] = Math.Round(q * p, 1);

                    _pb._Id             = int.Parse(shoppingCartbookDT.Rows[index]["Id"].ToString());
                    _pb._ShoppingCartId = int.Parse(shoppingCartbookDT.Rows[index]["ShoppingCartId"].ToString());
                    _pb._BookId         = int.Parse(shoppingCartbookDT.Rows[index]["BookId"].ToString());
                    _pb._Price          = float.Parse(shoppingCartbookDT.Rows[index]["Price"].ToString());
                    _pb._Quantity       = int.Parse(shoppingCartbookDT.Rows[index]["Quantity"].ToString());
                    _pb._Total          = float.Parse(shoppingCartbookDT.Rows[index]["Total"].ToString());
                    _pb._Status         = shoppingCartbookDT.Rows[index]["Status"].ToString().TrimEnd();

                    _pb.Execute("UpdateShoppingCart_BookCapability");
                    if (_pb.Success != null)
                    {
                        Calculate();
                        _pb._Date  = DateTime.Now;
                        _pb._Total = float.Parse(totaltxt.Text);
                        _pb.Execute("UpdateShoppingCartCapability");
                        if (_pb.Success != null)
                        {
                            ShoppingCartBookGV.DataSource = shoppingCartbookDT;
                            ShoppingCartBookGV.DataBind();
                            Save();
                        }
                    }
                }
                else if (t == "Delete")
                {
                    _pb._Id = int.Parse(shoppingCartbookDT.Rows[index]["ShoppingCart_BookId"].ToString());
                    _pb.Execute("DeleteShoppingCart_BookCapability");
                    if (_pb.Success != null)
                    {
                        shoppingCartbookDT.Rows.RemoveAt(index);

                        ShoppingCartBookGV.DataSource = shoppingCartbookDT;
                        ShoppingCartBookGV.DataBind();
                        Save();
                    }
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    if (Session["PurchaseBroker"] != null)
                    {
                        _pb = (CustomerAgent)Session["PurchaseBroker"];
                    }
                    else
                    {
                        _pb = new CustomerAgent();
                        Session["PurchaseBroker"] = _pb;
                    }

                    if (Session["InteractionBroker"] != null)
                    {
                        _ib = (CustomerAgent)Session["InteractionBroker"];
                    }
                    else
                    {
                        _ib = new CustomerAgent();
                        Session["InteractionBroker"] = _ib;
                    }

                    if (Session["CatalogueBroker"] != null)
                    {
                        _cb = (CustomerAgent)Session["CatalogueBroker"];
                    }
                    else
                    {
                        _cb = new CustomerAgent();
                        Session["CatalogueBroker"] = _cb;
                    }

                    if (Session["ShoppingCartBook"] != null)
                    {
                        shoppingCartbookDT = (DataTable)Session["ShoppingCartBook"];
                    }

                    if (Session["ShoppingCart"] != null)
                    {
                        shoppingCartDT = (DataTable)Session["ShoppingCart"];
                    }

                    idtxt.Text            = _cb._Id.ToString();
                    ISBNtxt.Text          = _cb._ISBN;
                    titletxt.Text         = _cb._Title;
                    editionNumbertxt.Text = _cb._EditionNumber.ToString();
                    copyRighttxt.Text     = _cb._CopyRight.ToString();
                    Amounttxt.Text        = _cb._Amount.ToString();
                    pricetxt.Text         = _cb._Price.ToString();
                    categorylbl.Text      = _cb._Name;

                    _cb._NumOfVisits++;
                    _cb.Execute("UpdateBookCapability");
                    if (_cb.Success != null)
                    {
                    }

                    _ib._CustomerId = _pb._ShoppingCartId;
                    _ib.Execute("SelectCustomerWishListByCustomerIdCapability");
                    if (_ib.Success != null)
                    {
                        CustomerBookWishListDT = (DataTable)_ib.Success;
                    }

                    _ib._BookId = int.Parse(idtxt.Text);
                    _ib.Execute("SelectCustomerRateByBookIdCapability");
                    if (_ib.Success != null)
                    {
                        CustomerBookRateListDT = (DataTable)_ib.Success;
                        double sum = 0;
                        for (int i = 0; i < CustomerBookRateListDT.Rows.Count; i++)
                        {
                            sum += double.Parse(CustomerBookRateListDT.Rows[i]["Rate"].ToString());
                        }
                        double v = sum / CustomerBookRateListDT.Rows.Count;
                        ratelbl.Text = v.ToString();
                    }

                    _ib._BookId = int.Parse(idtxt.Text);
                    _ib.Execute("SelectCustomerReviewByBookIdCapability");
                    if (_ib.Success != null)
                    {
                        CustomerBookReviewListDT = (DataTable)_ib.Success;
                        CommentGV.DataSource     = CustomerBookReviewListDT;
                        CommentGV.DataBind();
                    }
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #14
0
        private void SaveOrderDetail(int orderId)
        {
            try
            {
                int ce = 0;
                for (int i = 0; i < shoppingCartbookDT.Rows.Count; i++)
                {
                    _sb.Execute("SelectMaxIdOrderOut_ItemCapability");
                    if (_sb.Success != null)
                    {
                        _sb._Id         = (int)_sb.Success;
                        _sb._BookId     = int.Parse(shoppingCartbookDT.Rows[i]["BookId"].ToString());
                        _sb._Price      = float.Parse(shoppingCartbookDT.Rows[i]["Price"].ToString());
                        _sb._Quantity   = int.Parse(shoppingCartbookDT.Rows[i]["Quantity"].ToString());
                        _sb._OrderOutId = orderId;

                        _sb.Execute("InsertOrderOut_ItemCapability");
                        if (_sb.Success != null)
                        {
                            bool v = bool.Parse(_sb.Success.ToString());
                            if (v == true)
                            {
                                _cb._Id            = int.Parse(shoppingCartbookDT.Rows[i]["BookId"].ToString());
                                _cb._ISBN          = shoppingCartbookDT.Rows[i]["ISBN"].ToString().TrimEnd();
                                _cb._Title         = shoppingCartbookDT.Rows[i]["Title"].ToString().TrimEnd();
                                _cb._EditionNumber = int.Parse(shoppingCartbookDT.Rows[i]["EditionNumber"].ToString());
                                _cb._CopyRight     = int.Parse(shoppingCartbookDT.Rows[i]["CopyRight"].ToString());
                                _cb._Amount        = int.Parse(shoppingCartbookDT.Rows[i]["Amount"].ToString()) - int.Parse(_sb._Quantity.ToString());
                                _cb._BookPrice     = float.Parse(shoppingCartbookDT.Rows[i]["Price"].ToString());
                                _cb._CategoryId    = (shoppingCartbookDT.Rows[i]["CategoryId"].ToString() == string.Empty ? 0 : int.Parse(shoppingCartbookDT.Rows[i]["CategoryId"].ToString()));
                                _cb._NumOfVisits   = int.Parse(shoppingCartbookDT.Rows[i]["NumOfVisits"].ToString());
                                _cb._OfferId       = (shoppingCartbookDT.Rows[i]["OfferId"].ToString() == string.Empty?0:int.Parse(shoppingCartbookDT.Rows[i]["OfferId"].ToString()));

                                _cb.Execute("UpdateBookCapability");
                                if (_cb.Success != null)
                                {
                                    bool c = bool.Parse(_cb.Success.ToString());
                                    if (c == true)
                                    {
                                        _pb._Id = int.Parse(shoppingCartbookDT.Rows[i]["Id"].ToString());
                                        _pb.Execute("DeleteShoppingCart_BookCapability");

                                        if (_pb.Success != null)
                                        {
                                            bool s = bool.Parse(_pb.Success.ToString());
                                            if (s == true)
                                            {
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                ce++;
                            }
                        }
                    }
                }

                if (ce == 0)
                {
                    SaveDelivery(orderId);
                }
            }
            catch (Exception)
            {
            }
        }