private void grdPromoteSales_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int activityId = int.Parse(this.grdPromoteSales.DataKeys[e.Row.RowIndex].Value.ToString()); Label label = (Label)e.Row.FindControl("lblmemberGrades"); Label label2 = (Label)e.Row.FindControl("lblPromoteType"); Literal literal = (Literal)e.Row.FindControl("ltrPromotionInfo"); IList <MemberGradeInfo> promoteMemberGrades = PromoteHelper.GetPromoteMemberGrades(activityId); string str = string.Empty; foreach (MemberGradeInfo info in promoteMemberGrades) { str = str + info.Name + ","; } if (!string.IsNullOrEmpty(str)) { str = str.Remove(str.Length - 1); } label.Text = str; switch (((PromoteType)((int)DataBinder.Eval(e.Row.DataItem, "PromoteType")))) { case PromoteType.Discount: label2.Text = "直接打折"; literal.Text = string.Format("折扣值:{0}", DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case PromoteType.Amount: label2.Text = "固定金额出售"; literal.Text = string.Format("固定金额值:{0}", DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case PromoteType.Reduced: label2.Text = "优惠金额出售"; literal.Text = string.Format("优惠金额值:{0}", DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case PromoteType.QuantityDiscount: label2.Text = "按批发数量打折"; literal.Text = string.Format("购买数量:{0} 折扣值:{1}", DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f0}"), DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case PromoteType.SentGift: label2.Text = "买商品送礼品"; literal.Text = "<a href=\"javascript:DialogFrame('promotion/gifts.aspx?isPromotion=true','查看促销礼品',null,null)\">查看促销礼品</a>"; return; case PromoteType.SentProduct: label2.Text = "有买有送"; literal.Text = string.Format("购买数量:{0} 赠送数量:{1}", DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f0}"), DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f0}")); return; default: return; } } }
private void grdPromoteSales_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == System.Web.UI.WebControls.DataControlRowType.DataRow) { int activityId = int.Parse(this.grdPromoteSales.DataKeys[e.Row.RowIndex].Value.ToString()); System.Web.UI.WebControls.Label label = (System.Web.UI.WebControls.Label)e.Row.FindControl("lblmemberGrades"); System.Web.UI.WebControls.Label label2 = (System.Web.UI.WebControls.Label)e.Row.FindControl("lblPromoteType"); System.Web.UI.WebControls.Literal literal = (System.Web.UI.WebControls.Literal)e.Row.FindControl("ltrPromotionInfo"); System.Collections.Generic.IList <MemberGradeInfo> promoteMemberGrades = PromoteHelper.GetPromoteMemberGrades(activityId); string text = string.Empty; foreach (MemberGradeInfo current in promoteMemberGrades) { text = text + current.Name + ","; } if (!string.IsNullOrEmpty(text)) { text = text.Remove(text.Length - 1); } label.Text = text; switch ((int)System.Web.UI.DataBinder.Eval(e.Row.DataItem, "PromoteType")) { case 11: label2.Text = "满额打折"; literal.Text = string.Format("满足金额:{0} 折扣值:{1}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f2}"), System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case 12: label2.Text = "满额优惠金额"; literal.Text = string.Format("满足金额:{0} 优惠金额:{1}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f2}"), System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case 13: label2.Text = "满量打折"; literal.Text = string.Format("满足数量:{0} 折扣值:{1}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f0}"), System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case 14: label2.Text = "满量优惠金额"; literal.Text = string.Format("满足数量:{0},优惠金额:{1}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f0}"), System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case 15: label2.Text = "满额送礼品"; literal.Text = string.Format("满足金额:{0} <a href=\"javascript:DialogFrame('promotion/gifts.aspx?isPromotion=true','查看促销礼品',null,null)\">查看促销礼品</a>", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f2}")); return; case 16: label2.Text = "满额送倍数积分"; literal.Text = string.Format("满足金额:{0},倍数:{1}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f2}"), System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case 17: label2.Text = "满额免运费"; literal.Text = string.Format("满足金额:{0}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f2}")); break; default: return; } } }
private void grdPromoteSales_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int activityId = int.Parse(grdPromoteSales.DataKeys[e.Row.RowIndex].Value.ToString()); Label label = (Label)e.Row.FindControl("lblmemberGrades"); Label label2 = (Label)e.Row.FindControl("lblPromoteType"); Label label3 = (Label)e.Row.FindControl("lblPromoteTypeName"); Literal literal = (Literal)e.Row.FindControl("ltrPromotionInfo"); HyperLink link = (HyperLink)e.Row.FindControl("hpkPromotionProduct"); IList <string> promoteMemberGrades = PromoteHelper.GetPromoteMemberGrades(activityId); string str = string.Empty; foreach (string str2 in promoteMemberGrades) { str = str + str2 + ","; } str = str.Remove(str.Length - 1); label.Text = str; if (int.Parse(label2.Text, CultureInfo.InvariantCulture) == 2) { label3.Text = "满额打折"; FullDiscountInfo fullDiscountInfo = PromoteHelper.GetFullDiscountInfo(activityId); string str3 = (fullDiscountInfo.ValueType == DiscountValueType.Amount) ? "折扣金额" : "百分比折扣"; literal.Text = string.Concat(new object[] { "满足金额:", Globals.FormatMoney(fullDiscountInfo.Amount), " 折扣类型:", str3, " 折扣值:", decimal.Round(decimal.Parse(fullDiscountInfo.DiscountValue.ToString()), 2) }); } if (int.Parse(label2.Text, CultureInfo.InvariantCulture) == 3) { FullFreeInfo fullFreeInfo = PromoteHelper.GetFullFreeInfo(activityId); label3.Text = "满额免费用"; string str4 = " 免费项目:"; if (fullFreeInfo.OptionFeeFree) { str4 = str4 + "订单选项费,"; } if (fullFreeInfo.ServiceChargeFree) { str4 = str4 + "订单支付手续费,"; } if (fullFreeInfo.ShipChargeFree) { str4 = str4 + "订单运费,"; } literal.Text = "满足金额:" + Globals.FormatMoney(fullFreeInfo.Amount) + str4.Remove(str4.Length - 1); } if (int.Parse(label2.Text, CultureInfo.InvariantCulture) == 4) { label3.Text = "买几送几"; PurchaseGiftInfo purchaseGiftInfo = PromoteHelper.GetPurchaseGiftInfo(activityId); literal.Text = string.Concat(new object[] { "购买数量:", purchaseGiftInfo.BuyQuantity, " 赠送数量:", purchaseGiftInfo.GiveQuantity }); link.Visible = true; link.NavigateUrl = Globals.GetAdminAbsolutePath("/promotion/PromotionProducts.aspx?ActiveId=" + activityId); } if (int.Parse(label2.Text, CultureInfo.InvariantCulture) == 5) { label3.Text = "批发打折"; WholesaleDiscountInfo wholesaleDiscountInfo = PromoteHelper.GetWholesaleDiscountInfo(activityId); literal.Text = string.Concat(new object[] { "购买数量:", wholesaleDiscountInfo.Quantity, " 折扣值:", wholesaleDiscountInfo.DiscountValue }); link.Visible = true; link.NavigateUrl = Globals.GetAdminAbsolutePath("/promotion/PromotionProducts.aspx?ActiveId=" + activityId); } } }
private void grdPromoteSales_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == System.Web.UI.WebControls.DataControlRowType.DataRow) { int activityId = int.Parse(this.grdPromoteSales.DataKeys[e.Row.RowIndex].Value.ToString()); System.Web.UI.WebControls.Label label = (System.Web.UI.WebControls.Label)e.Row.FindControl("lblmemberGrades"); System.Web.UI.WebControls.Label label2 = (System.Web.UI.WebControls.Label)e.Row.FindControl("lblPromoteType"); System.Web.UI.WebControls.Literal literal = (System.Web.UI.WebControls.Literal)e.Row.FindControl("ltrPromotionInfo"); System.Collections.Generic.IList <MemberGradeInfo> promoteMemberGrades = PromoteHelper.GetPromoteMemberGrades(activityId); string text = string.Empty; foreach (MemberGradeInfo current in promoteMemberGrades) { text = text + current.Name + ","; } if (!string.IsNullOrEmpty(text)) { text = text.Remove(text.Length - 1); } label.Text = text; switch ((int)System.Web.UI.DataBinder.Eval(e.Row.DataItem, "PromoteType")) { case 1: label2.Text = "直接打折"; literal.Text = string.Format("折扣值:{0}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case 2: label2.Text = "固定金额出售"; literal.Text = string.Format("固定金额值:{0}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case 3: label2.Text = "优惠金额出售"; literal.Text = string.Format("优惠金额值:{0}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case 4: label2.Text = "按批发数量打折"; literal.Text = string.Format("购买数量:{0} 折扣值:{1}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f0}"), System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); return; case 5: label2.Text = "买商品送礼品"; literal.Text = "<a href=\"javascript:DialogFrame('promotion/gifts.aspx?isPromotion=true','查看促销礼品',null,null)\">查看促销礼品</a>"; return; case 6: label2.Text = "有买有送"; literal.Text = string.Format("购买数量:{0} 赠送数量:{1}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f0}"), System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f0}")); break; case 7: label2.Text = "单品满减"; literal.Text = string.Format("满足金额:{0} 减少金额:{1}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f2}"), System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); break; case 8: label2.Text = "第二件减价"; literal.Text = string.Format("减少金额:{0}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); break; case 9: label2.Text = "第二件打折"; literal.Text = string.Format("折扣值:{0}", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f2}")); break; case 10: label2.Text = "有买有送(选择商品)"; string path = Globals.GetAdminAbsolutePath(string.Format("/promotion/ProductsPresent.aspx?ActivityId={0}&PresentNum={1}", DataBinder.Eval(e.Row.DataItem, "ActivityId"), DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f0}"))); literal.Text = string.Format("购买数量:{0} 赠送数量:{1} <a href={2}>赠送商品</a>", System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Condition", "{0:f0}"), System.Web.UI.DataBinder.Eval(e.Row.DataItem, "DiscountValue", "{0:f0}"), path); break; default: return; } } }