public void GetCartBriefInfo(Hashtable ht, ref int cartProductCount, ref decimal cartMoneyTotal) { DataSet ds = OnlineListManager.GetInstance().GetCartDs(ht); if (!Util.HasMoreRow(ds)) { return; } foreach (DataRow dr in ds.Tables[0].Rows) { ProductPriceInfo oProductPrice = new ProductPriceInfo(); oProductPrice.ProductSysNo = Util.TrimIntNull(dr["ProductSysNo"]); oProductPrice.CurrentPrice = Util.TrimDecimalNull(dr["CurrentPrice"]); oProductPrice.PointType = Util.TrimIntNull(dr["PointType"]); oProductPrice.IsWholeSale = Util.TrimIntNull(dr["IsWholeSale"]); oProductPrice.Q1 = Util.TrimIntNull(dr["Q1"]); oProductPrice.P1 = Util.TrimDecimalNull(dr["P1"]); oProductPrice.Q2 = Util.TrimIntNull(dr["Q2"]); oProductPrice.P2 = Util.TrimDecimalNull(dr["P2"]); oProductPrice.Q3 = Util.TrimIntNull(dr["Q3"]); oProductPrice.P3 = Util.TrimDecimalNull(dr["P3"]); CartInfo oCart = ht[oProductPrice.ProductSysNo] as CartInfo; cartProductCount += oCart.Quantity; cartMoneyTotal += oCart.Quantity * oProductPrice.GetRealPrice(oCart.Quantity); } }
/// <summary> /// 用户购物车中的商品 /// </summary> /// <returns></returns> public static List <FrontDsiplayProduct> GetShoppingCartProducts(Hashtable ht) { try { DataTable data = OnlineListManager.GetInstance().NewGetCartDs(ht); int rowCount = data.Rows.Count; if (rowCount > 0) { List <FrontDsiplayProduct> productList = new List <FrontDsiplayProduct>(); for (int i = 0; i < rowCount; i++) { productList.Add(new FrontDsiplayProduct() { ProductSysNo = data.Rows[i]["sysno"].ToString().Trim(), ProductBriefName = data.Rows[i]["productname"].ToString().Trim(), C1SysNo = int.Parse(data.Rows[i]["C1SysNo"].ToString().Trim()), C2SysNo = int.Parse(data.Rows[i]["C2SysNo"].ToString().Trim()), C3SysNo = int.Parse(data.Rows[i]["C3SysNo"].ToString().Trim()), Price = float.Parse(data.Rows[i]["currentprice"].ToString().Trim()).ToString("0"), ImgPath = data.Rows[i]["product_simg"].ToString().Trim(), Weight = float.Parse(data.Rows[i]["Weight"].ToString().Trim()), LimitQty = int.Parse(data.Rows[i]["LimitedQty"].ToString().Trim()), AvailableQty = int.Parse(data.Rows[i]["AvailableQty"].ToString().Trim()), Point = int.Parse(data.Rows[i]["Point"].ToString().Trim()), BaiscPrice = float.Parse(data.Rows[i]["BasicPrice"].ToString().Trim()).ToString("0"), }); } return(productList); } else { return(null); } } catch { return(null); } }
private DataTable BuildCartGiftTable() { DataTable table = new DataTable("BuildGiftCartTable"); DataColumn dc0 = new DataColumn("SysNo", typeof(System.Int32)); DataColumn dc1 = new DataColumn("Quantity", typeof(System.Int32)); DataColumn dc2 = new DataColumn("ExpectQty", typeof(System.Int32)); table.Columns.Add(dc0); table.Columns.Add(dc1); table.Columns.Add(dc2); Hashtable ht = CartManager.GetInstance().GetCartHash(); if (ht == null || ht.Count == 0) { return(table); } DataSet ds = OnlineListManager.GetInstance().GetCartGiftDs(ht); foreach (DataRow dr in ds.Tables[0].Rows) { DataRow drShow = table.NewRow(); drShow["SysNo"] = (int)dr["SysNo"]; foreach (CartInfo cartInfo in ht.Values) { if (cartInfo.ProductSysNo == (int)dr["MasterSysNo"]) { drShow["Quantity"] = cartInfo.Quantity; drShow["ExpectQty"] = cartInfo.Quantity; break; } } table.Rows.Add(drShow); } return(table); }
public void DoNotify(int poSysNo) { // 以后增加90天删除的功能。 string sql = @"select product.sysno, productname from po_item, inventory, product, product_price where product.sysno = po_item.productsysno and product.sysno = inventory.productsysno and product.sysno = product_price.productsysno and availableqty+virtualqty>0 @onlineShowLimit and po_item.posysno = @poSysNo" ; sql = sql.Replace("@onlineShowLimit", OnlineListManager.GetInstance().onlineShowLimit); sql = sql.Replace("@poSysNo", poSysNo.ToString()); DataSet ds = SqlHelper.ExecuteDataSet(sql); if (!Util.HasMoreRow(ds)) { return; } foreach (DataRow dr in ds.Tables[0].Rows) { int productSysNo = Util.TrimIntNull(dr["sysno"]); string productName = Util.TrimNull(dr["productname"]); string sql2 = @"select * from product_notify where productsysno =" + productSysNo.ToString() + " and status=" + (int)AppEnum.ProductNotifyStatus.UnNotify; DataSet ds2 = SqlHelper.ExecuteDataSet(sql2); if (!Util.HasMoreRow(ds2)) { continue; } string mailBody = @"您好!<br>您关注的商品@productlink已经到货,请及时到ORS商城网订购。<br>如果您查看的时候,该商品又处于缺货 状态,您可以选择该商品,点击重新提醒。<br>请更新您的到货通知列表,以确保您能得到及时,准确地信息。 <br>所有到货通知,自生成或最后更新日起,保留90天。" ; string mailSubject = "ORS商城网到货通知-@productname"; mailBody = mailBody.Replace("@productlink", "<a href='http://www.baby1one.com.cn/Items/ItemDetail.aspx?ItemID=" + productSysNo.ToString() + "'>" + productName + "</a>"); mailSubject = mailSubject.Replace("@productname", productName); Hashtable ht = new Hashtable(2); foreach (DataRow dr2 in ds2.Tables[0].Rows) { ProductNotifyInfo o = new ProductNotifyInfo(); map(o, dr2); EmailInfo oEmail = new EmailInfo(o.Email, mailSubject, mailBody); EmailManager.GetInstance().InsertEmail(oEmail); ht.Clear(); ht.Add("SysNo", o.SysNo); ht.Add("NotifyTime", DateTime.Now); ht.Add("Status", (int)AppEnum.ProductNotifyStatus.Notified); this.Update(ht); } } }