Exemplo n.º 1
0
        public static string createOrder(string sessionID, string shippingEmail, string payMode, string userID)
        {
            DataTable carDT = HomeService.getCartDT(sessionID);
            string    total = HomeService.getTotal();

            string shippingId = "";

            if (StringUtil.isNullOrEmpty(userID))
            {
                shippingId = ShippingDAO.getShippinIDByEmail(shippingEmail);
            }
            else
            {
                shippingId = ShippingDAO.getShippinIDByUserID(userID);
            }

            int orderID = OrderDAO.createOrder(total, payMode, shippingId);

            OrderDAO.createOrderStatus(orderID);
            OrderDAO.createOrderDetails(carDT, orderID.ToString());
            return(orderID + "");
        }
Exemplo n.º 2
0
        public static Dictionary <string, string> checkInventory(DataTable dt, string sessionId)
        {
            Dictionary <string, string> invDic = new Dictionary <string, string>();

            if (CommonUtil.DT.isEmptyOrNull(dt))
            {
                dt = HomeService.getCartDT(sessionId);
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Dictionary <string, string> dic = new Dictionary <string, string>();
                int inventory = AjaxService.getInventory(dt.Rows[i]["SKU"] + "");
                if (inventory == 0)
                {
                    invDic.Add(dt.Rows[i]["SKU"] + "", "SOLD_OUT");
                }
                else if (inventory < Int32.Parse(dt.Rows[i]["QTY"] + ""))
                {
                    string msg = "Only " + inventory + " Item(s) are left in inventory!!";
                    invDic.Add(dt.Rows[i]["SKU"] + "", msg);
                }
            }
            return(invDic);
        }
Exemplo n.º 3
0
 public static void updateInventroy(string sessionId)
 {
     ProductDAO.updateInventory(HomeService.getCartDT(sessionId));
 }