Ejemplo n.º 1
0
 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), "&nbsp;折扣类型:", str3, "&nbsp;折扣值:", 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 = "&nbsp;免费项目:";
             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, "&nbsp;赠送数量:", 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, "&nbsp;折扣值:", wholesaleDiscountInfo.DiscountValue });
             link.Visible     = true;
             link.NavigateUrl = Globals.GetAdminAbsolutePath("/promotion/PromotionProducts.aspx?ActiveId=" + activityId);
         }
     }
 }