/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); int id = RequestHelper.GetQueryString <int>("ID"); giftPack = GiftPackBLL.ReadGiftPack(id); if (giftPack.GiftGroup != string.Empty) { string idList = string.Empty; int count = giftPack.GiftGroup.Split('#').Length; nameArray = new string[count]; countArray = new string[count]; productArray = new string[count]; for (int i = 0; i < count; i++) { string[] giftGroupArray = giftPack.GiftGroup.Split('#')[i].Split('|'); nameArray[i] = giftGroupArray[0]; countArray[i] = giftGroupArray[1]; productArray[i] = giftGroupArray[2]; if (giftGroupArray[2] != string.Empty) { idList += giftGroupArray[2] + ","; } } if (idList != string.Empty) { idList = idList.Substring(0, idList.Length - 1); ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductID = idList; productList = ProductBLL.SearchProductList(productSearch); } } Title = giftPack.Name; }
protected override void PageLoad() { base.PageLoad(); int queryString = RequestHelper.GetQueryString <int>("ID"); this.giftPack = GiftPackBLL.ReadGiftPack(queryString); if (this.giftPack.GiftGroup != string.Empty) { string str = string.Empty; int length = this.giftPack.GiftGroup.Split(new char[] { '#' }).Length; this.nameArray = new string[length]; this.countArray = new string[length]; this.productArray = new string[length]; for (int i = 0; i < length; i++) { string[] strArray = this.giftPack.GiftGroup.Split(new char[] { '#' })[i].Split(new char[] { '|' }); this.nameArray[i] = strArray[0]; this.countArray[i] = strArray[1]; this.productArray[i] = strArray[2]; if (strArray[2] != string.Empty) { str = str + strArray[2] + ","; } } if (str != string.Empty) { str = str.Substring(0, str.Length - 1); ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductID = str; this.productList = ProductBLL.SearchProductList(productSearch); } } base.Title = this.giftPack.Name; }
public int AddGiftPack(GiftPackInfo giftPack) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@name", SqlDbType.NVarChar), new SqlParameter("@photo", SqlDbType.NVarChar), new SqlParameter("@startDate", SqlDbType.DateTime), new SqlParameter("@endDate", SqlDbType.DateTime), new SqlParameter("@price", SqlDbType.Decimal), new SqlParameter("@giftGroup", SqlDbType.NText) }; pt[0].Value = giftPack.Name; pt[1].Value = giftPack.Photo; pt[2].Value = giftPack.StartDate; pt[3].Value = giftPack.EndDate; pt[4].Value = giftPack.Price; pt[5].Value = giftPack.GiftGroup; return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddGiftPack", pt))); }
public void UpdateGiftPack(GiftPackInfo giftPack) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@name", SqlDbType.NVarChar), new SqlParameter("@photo", SqlDbType.NVarChar), new SqlParameter("@startDate", SqlDbType.DateTime), new SqlParameter("@endDate", SqlDbType.DateTime), new SqlParameter("@price", SqlDbType.Decimal), new SqlParameter("@giftGroup", SqlDbType.NText) }; pt[0].Value = giftPack.ID; pt[1].Value = giftPack.Name; pt[2].Value = giftPack.Photo; pt[3].Value = giftPack.StartDate; pt[4].Value = giftPack.EndDate; pt[5].Value = giftPack.Price; pt[6].Value = giftPack.GiftGroup; ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateGiftPack", pt); }
public void PrepareGiftPackModel(SqlDataReader dr, List <GiftPackInfo> giftPackList) { while (dr.Read()) { GiftPackInfo item = new GiftPackInfo(); item.ID = dr.GetInt32(0); item.Name = dr[1].ToString(); item.Photo = dr[2].ToString(); item.StartDate = dr.GetDateTime(3); item.EndDate = dr.GetDateTime(4); item.Price = dr.GetDecimal(5); item.GiftGroup = dr[6].ToString(); giftPackList.Add(item); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { int queryString = RequestHelper.GetQueryString <int>("ID"); if (queryString != -2147483648) { base.CheckAdminPower("ReadGiftPack", PowerCheckType.Single); this.strGiftPackID = queryString.ToString(); GiftPackInfo info = GiftPackBLL.ReadGiftPack(queryString); this.Name.Text = info.Name; this.Photo.Text = info.Photo; this.StartDate.Text = info.StartDate.ToString("yyyy-MM-dd"); this.EndDate.Text = info.EndDate.ToString("yyyy-MM-dd"); this.Price.Text = info.Price.ToString(); if (info.GiftGroup != string.Empty) { string str = string.Empty; int length = info.GiftGroup.Split(new char[] { '#' }).Length; this.nameArray = new string[length]; this.countArray = new string[length]; this.productArray = new string[length]; for (int i = 0; i < length; i++) { string[] strArray = info.GiftGroup.Split(new char[] { '#' })[i].Split(new char[] { '|' }); this.nameArray[i] = strArray[0]; this.countArray[i] = strArray[1]; this.productArray[i] = strArray[2]; if (strArray[2] != string.Empty) { str = str + strArray[2] + ","; } } if (str != string.Empty) { str = str.Substring(0, str.Length - 1); ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductID = str; this.productList = ProductBLL.SearchProductList(productSearch); } } } } }
protected void SubmitButton_Click(object sender, EventArgs e) { GiftPackInfo giftPack = new GiftPackInfo(); giftPack.ID = RequestHelper.GetQueryString <int>("ID"); giftPack.Name = this.Name.Text; giftPack.Photo = this.Photo.Text; giftPack.StartDate = Convert.ToDateTime(this.StartDate.Text); giftPack.EndDate = Convert.ToDateTime(this.EndDate.Text).AddDays(1.0).AddSeconds(-1.0); giftPack.Price = Convert.ToDecimal(this.Price.Text); int form = RequestHelper.GetForm <int>("GiftGroupCount"); string str = string.Empty; for (int i = 0; i < form; i++) { if (RequestHelper.GetForm <string>("GiftGroupValue" + i) != string.Empty) { str = str + RequestHelper.GetForm <string>("GiftGroupValue" + i) + "#"; } } if (str.EndsWith("#")) { str = str.Substring(0, str.Length - 1); } giftPack.GiftGroup = str; string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (giftPack.ID == -2147483648) { base.CheckAdminPower("AddGiftPack", PowerCheckType.Single); int id = GiftPackBLL.AddGiftPack(giftPack); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("GiftPack"), id); } else { base.CheckAdminPower("UpdateGiftPack", PowerCheckType.Single); GiftPackBLL.UpdateGiftPack(giftPack); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("GiftPack"), giftPack.ID); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl); }
public GiftPackInfo ReadGiftPack(int id) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int) }; pt[0].Value = id; GiftPackInfo info = new GiftPackInfo(); using (SqlDataReader reader = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "ReadGiftPack", pt)) { if (reader.Read()) { info.ID = reader.GetInt32(0); info.Name = reader[1].ToString(); info.Photo = reader[2].ToString(); info.StartDate = reader.GetDateTime(3); info.EndDate = reader.GetDateTime(4); info.Price = reader.GetDecimal(5); info.GiftGroup = reader[6].ToString(); } } return(info); }
public static void HandlerCartList(List <CartInfo> cartList, ref List <CartGiftPackVirtualInfo> cartGiftPackVirtualList, ref List <CartCommonProductVirtualInfo> cartCommonProductVirtualList) { string str; string str2; decimal num2; int num3; foreach (CartInfo info in cartList) { CartGiftPackVirtualInfo current; if (!(info.RandNumber != string.Empty) || (info.GiftPackID <= 0)) { goto Label_00F8; } bool flag = false; using (List <CartGiftPackVirtualInfo> .Enumerator enumerator2 = cartGiftPackVirtualList.GetEnumerator()) { while (enumerator2.MoveNext()) { current = enumerator2.Current; if (current.RandNumber == info.RandNumber) { flag = true; current.CartList.Add(info); goto Label_00A5; } } } Label_00A5: if (!flag) { current = new CartGiftPackVirtualInfo(); { current.RandNumber = info.RandNumber; current.GiftPackBuyCount = info.BuyCount; current.LeftStorageCount = info.LeftStorageCount; }; current.CartList.Add(info); cartGiftPackVirtualList.Add(current); } goto Label_018A; Label_00F8: if (info.FatherID == 0) { CartCommonProductVirtualInfo item = new CartCommonProductVirtualInfo(); { item.FatherCart = info; } cartCommonProductVirtualList.Add(item); } else { foreach (CartCommonProductVirtualInfo info3 in cartCommonProductVirtualList) { if (info3.FatherCart.ID == info.FatherID) { info3.ChildCartList.Add(info); break; } } } Label_018A :; } if (cartGiftPackVirtualList.Count > 0) { foreach (CartGiftPackVirtualInfo info2 in cartGiftPackVirtualList) { int id = 0; str = string.Empty; str2 = string.Empty; num2 = 0M; num3 = 0; foreach (CartInfo info in info2.CartList) { if (str == string.Empty) { str = info.ProductID.ToString(); str2 = info.ID.ToString(); } else { str = str + "," + info.ProductID.ToString(); str2 = str2 + "," + info.ID.ToString(); } num2 += info.ProductWeight; num3 += info.SendPoint; id = info.GiftPackID; } GiftPackInfo info4 = GiftPackBLL.ReadGiftPack(id); info2.GiftPackID = id; info2.GiftPackName = info4.Name; info2.GiftPackPhoto = info4.Photo; info2.StrProductID = str; info2.StrCartID = str2; info2.TotalProductWeight = num2; info2.TotalSendPoint = num3; info2.TotalPrice = info4.Price; } } if (cartCommonProductVirtualList.Count > 0) { foreach (CartCommonProductVirtualInfo info3 in cartCommonProductVirtualList) { str = info3.FatherCart.ProductID.ToString(); str2 = info3.FatherCart.ID.ToString(); num2 = 0M; num3 = 0; foreach (CartInfo info in info3.ChildCartList) { str = str + "," + info.ProductID.ToString(); str2 = str2 + "," + info.ID.ToString(); num2 += info.ProductWeight; num3 += info.SendPoint; } info3.StrProductID = str; info3.StrCartID = str2; CartInfo fatherCart = info3.FatherCart; fatherCart.ProductWeight += num2; CartInfo info5 = info3.FatherCart; info5.SendPoint += num3; } } }
public static void UpdateGiftPack(GiftPackInfo giftPack) { dal.UpdateGiftPack(giftPack); UploadBLL.UpdateUpload(TableID, 0, giftPack.ID, Cookies.Admin.GetRandomNumber(false)); }
public static int AddGiftPack(GiftPackInfo giftPack) { giftPack.ID = dal.AddGiftPack(giftPack); UploadBLL.UpdateUpload(TableID, 0, giftPack.ID, Cookies.Admin.GetRandomNumber(false)); return(giftPack.ID); }
public static void HandlerOrderDetailList(List <OrderDetailInfo> orderDetailList, ref List <OrderGiftPackVirtualInfo> orderGiftPackVirtualList, ref List <OrderCommonProductVirtualInfo> orderCommonProductVirtualList) { string str; string str2; decimal num2; int num3; foreach (OrderDetailInfo info in orderDetailList) { OrderGiftPackVirtualInfo current; if (!(info.RandNumber != string.Empty) || (info.GiftPackID <= 0)) { goto Label_00EB; } bool flag = false; using (List <OrderGiftPackVirtualInfo> .Enumerator enumerator2 = orderGiftPackVirtualList.GetEnumerator()) { while (enumerator2.MoveNext()) { current = enumerator2.Current; if (current.RandNumber == info.RandNumber) { flag = true; current.OrderDetailList.Add(info); goto Label_00A5; } } } Label_00A5: if (!flag) { current = new OrderGiftPackVirtualInfo(); current.RandNumber = info.RandNumber; current.GiftPackBuyCount = info.BuyCount; current.OrderDetailList.Add(info); orderGiftPackVirtualList.Add(current); } goto Label_017D; Label_00EB: if (info.FatherID == 0) { OrderCommonProductVirtualInfo item = new OrderCommonProductVirtualInfo(); item.FatherOrderDetail = info; orderCommonProductVirtualList.Add(item); } else { foreach (OrderCommonProductVirtualInfo info3 in orderCommonProductVirtualList) { if (info3.FatherOrderDetail.ID == info.FatherID) { info3.ChildOrderDetailList.Add(info); break; } } } Label_017D :; } if (orderGiftPackVirtualList.Count > 0) { foreach (OrderGiftPackVirtualInfo info2 in orderGiftPackVirtualList) { int id = 0; str = string.Empty; str2 = string.Empty; num2 = 0M; num3 = 0; decimal num4 = 0M; foreach (OrderDetailInfo info in info2.OrderDetailList) { if (str == string.Empty) { str = info.ProductID.ToString(); str2 = info.ID.ToString(); } else { str = str + "," + info.ProductID.ToString(); str2 = str2 + "," + info.ID.ToString(); } num2 += info.ProductWeight; num3 += info.SendPoint; num4 += info.ProductPrice; id = info.GiftPackID; } GiftPackInfo info4 = GiftPackBLL.ReadGiftPack(id); info2.GiftPackID = id; info2.GiftPackName = info4.Name; info2.GiftPackPhoto = info4.Photo; info2.StrProductID = str; info2.StrOrderDetailID = str2; info2.TotalProductWeight = num2; info2.TotalSendPoint = num3; info2.TotalPrice = num4; } } if (orderCommonProductVirtualList.Count > 0) { foreach (OrderCommonProductVirtualInfo info3 in orderCommonProductVirtualList) { str = info3.FatherOrderDetail.ProductID.ToString(); str2 = info3.FatherOrderDetail.ID.ToString(); num2 = 0M; num3 = 0; foreach (OrderDetailInfo info in info3.ChildOrderDetailList) { str = str + "," + info.ProductID.ToString(); str2 = str2 + "," + info.ID.ToString(); num2 += info.ProductWeight; num3 += info.SendPoint; } info3.StrProductID = str; info3.StrOrderDetailID = str2; OrderDetailInfo fatherOrderDetail = info3.FatherOrderDetail; fatherOrderDetail.ProductWeight += num2; OrderDetailInfo info5 = info3.FatherOrderDetail; info5.SendPoint += num3; } } }