public void InitPage(object roleID, object userID, GridView gridTransaction)
 {
     if (Convert.ToInt32(roleID) == 1)//Member
     {
         int UserId = Int32.Parse(userID.ToString());
         HeaderTransasctionHandler.updateGridDataMember(gridTransaction, UserId);
     }
     else if (Convert.ToInt32(roleID) == 2)//Admin
     {
         gridTransaction.Columns[0].Visible = true;;
         HeaderTransasctionHandler.updateGridDataAdmin(gridTransaction);
     }
 }
Esempio n. 2
0
        public void CheckoutCart(object UserID, DropDownList ddlPaymentType, Label lblErrorCheckout)
        {
            int      userId    = Int32.Parse(UserID.ToString());
            int      paymentId = Convert.ToInt32(ddlPaymentType.SelectedValue);
            DateTime now       = DateTime.Now;

            bool check = new CartHandler().checkCartIsEmpty(userId);

            if (check == true)
            {
                lblErrorCheckout.Visible = true;
                return;
            }
            else
            {
                lblErrorCheckout.Visible = false;

                new HeaderTransasctionHandler().InsertHTransaction(userId, paymentId, now);
                int transactionID = new HeaderTransasctionHandler().GetLastTransactionID();
                new DetailTransactionHandler().InsertDTransaction(transactionID, userId);
                new CartHandler().DeleteAllCartByUserID(userId);
            }
        }