コード例 #1
0
        public string GetPrizeType(PrizeTypes PrizeType, int PrizeValue)
        {
            string result = string.Empty;

            switch (PrizeType)
            {
            case PrizeTypes.Integral:
                result = PrizeValue + "积分; ";
                break;

            case PrizeTypes.Coupou:
            {
                CouponInfo coupon = CouponHelper.GetCoupon(PrizeValue);
                result = ((coupon == null) ? " " : ((!(coupon.ClosingTime > coupon.StartTime)) ? (coupon.Price + "元优惠券<font style='color:red;'>(已失效)</font>; ") : (coupon.Price + "元优惠券; ")));
                break;
            }

            case PrizeTypes.Gift:
            {
                GiftInfo giftDetails = GiftHelper.GetGiftDetails(PrizeValue);
                result = ((giftDetails == null) ? " " : (giftDetails.Name + "; "));
                break;
            }
            }
            return(result);
        }
コード例 #2
0
        private void lkbtnDownloadCheck_Click(object sender, System.EventArgs e)
        {
            int num = 0;

            foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdGift.Rows)
            {
                System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol");
                if (checkBox != null && checkBox.Checked)
                {
                    num++;
                }
            }
            if (num == 0)
            {
                this.ShowMsg("请先选择要下载的礼品", false);
                return;
            }
            foreach (System.Web.UI.WebControls.GridViewRow gridViewRow2 in this.grdGift.Rows)
            {
                System.Web.UI.WebControls.CheckBox checkBox2 = (System.Web.UI.WebControls.CheckBox)gridViewRow2.FindControl("checkboxCol");
                if (checkBox2.Checked)
                {
                    int      giftId      = (int)this.grdGift.DataKeys[gridViewRow2.RowIndex].Value;
                    GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId);
                    SubsiteGiftHelper.DownLoadGift(giftDetails);
                }
            }
            this.ShowMsg("下载的礼品成功", true);
            this.ReloadGiftsList(true);
        }
コード例 #3
0
ファイル: MyGifts.aspx.cs プロジェクト: yuelinsoft/himedi
        private void lkbtnDownloadCheck_Click(object sender, EventArgs e)
        {
            int num = 0;

            foreach (GridViewRow row in grdGift.Rows)
            {
                CheckBox box = (CheckBox)row.FindControl("checkboxCol");
                if ((box != null) && box.Checked)
                {
                    num++;
                }
            }
            if (num == 0)
            {
                ShowMsg("请先选择要下载的礼品", false);
            }
            else
            {
                foreach (GridViewRow row2 in grdGift.Rows)
                {
                    CheckBox box2 = (CheckBox)row2.FindControl("checkboxCol");
                    if (box2.Checked)
                    {
                        int giftId = (int)grdGift.DataKeys[row2.RowIndex].Value;
                        SubsiteGiftHelper.DownLoadGift(GiftHelper.GetGiftDetails(giftId));
                    }
                }
                ShowMsg("下载的礼品成功", true);
                ReloadGiftsList(true);
            }
        }
コード例 #4
0
        private void Add(HttpContext context)
        {
            int value  = base.GetIntParam(context, "giftId", false).Value;
            int value2 = base.GetIntParam(context, "quantity", false).Value;

            if (string.IsNullOrWhiteSpace(this.orderId))
            {
                throw new HidistroAshxException("错误的数据编号");
            }
            if (value <= 0)
            {
                throw new HidistroAshxException("错误的数据编号");
            }
            if (value2 <= 0)
            {
                throw new HidistroAshxException("礼品数量填写错误");
            }
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);

            if (!orderInfo.CheckAction(OrderActions.MASTER_SELLER_MODIFY_GIFTS))
            {
                throw new HidistroAshxException("当前订单状态没有订单礼品操作");
            }
            GiftInfo giftDetails = GiftHelper.GetGiftDetails(value);

            if (giftDetails == null)
            {
                throw new HidistroAshxException("错误的数据编号");
            }
            if (!OrderHelper.AddOrderGift(orderInfo, giftDetails, value2, 15.GetHashCode()))
            {
                throw new HidistroAshxException("添加订单礼品失败,可能礼品己存在");
            }
            base.ReturnSuccessResult(context, "操作成功!", 0, true);
        }
コード例 #5
0
        public string GetPrizeName(int PrizeType, int PrizeValue)
        {
            switch (PrizeType)
            {
            case 2:
            {
                CouponInfo coupon = CouponHelper.GetCoupon(PrizeValue);
                if (coupon != null)
                {
                    return(coupon.Price.F2ToString("f2") + "元优惠券");
                }
                return(PrizeValue + "元优惠券");
            }

            case 3:
            {
                GiftInfo giftDetails = GiftHelper.GetGiftDetails(PrizeValue);
                if (giftDetails != null)
                {
                    return(giftDetails.Name);
                }
                return("礼品");
            }

            default:
                return(PrizeValue + "积分");
            }
        }
コード例 #6
0
        protected override void AttachChildControls()
        {
            int num = this.Page.Request["RecordId"].ToInt(0);

            if (num <= 0)
            {
                base.GotoResourceNotFound("记录不存在!");
            }
            else
            {
                UserAwardRecordsInfo userAwardRecordsInfo = ActivityHelper.GetUserAwardRecordsInfo(num);
                if (userAwardRecordsInfo == null)
                {
                    base.GotoResourceNotFound("记录不存在!");
                }
                else if (userAwardRecordsInfo.PrizeType != 3)
                {
                    base.GotoResourceNotFound("记录不存在!");
                }
                else
                {
                    this.litMarketPrice = (Literal)this.FindControl("litMarketPrice");
                    this.litDescript    = (Literal)this.FindControl("litDescript");
                    this.imgPrize       = (Image)this.FindControl("imgPrize");
                    this.goBuy          = (HtmlAnchor)this.FindControl("goBuy");
                    this.litName        = (Literal)this.FindControl("litName");
                    if (userAwardRecordsInfo.Status == 2)
                    {
                        this.goBuy.Visible = false;
                    }
                    else
                    {
                        this.goBuy.HRef = "SubmmitOrder.aspx?from=prize&RecordId=" + num;
                    }
                    GiftInfo giftDetails = GiftHelper.GetGiftDetails(userAwardRecordsInfo.PrizeValue);
                    if (giftDetails != null)
                    {
                        this.litName.Text = giftDetails.Name;
                        if (giftDetails.MarketPrice.HasValue)
                        {
                            this.litMarketPrice.Text = "市场参考价:" + giftDetails.MarketPrice.Value.F2ToString("f2");
                        }
                        else
                        {
                            this.litMarketPrice.Visible = false;
                        }
                        this.litDescript.Text  = giftDetails.LongDescription;
                        this.imgPrize.ImageUrl = giftDetails.ImageUrl;
                        PageTitle.AddSiteNameTitle("奖品详情");
                    }
                    else
                    {
                        base.GotoResourceNotFound("礼品已被删除!");
                    }
                }
            }
        }
コード例 #7
0
        private void LoadGift()
        {
            GiftInfo giftDetails = GiftHelper.GetGiftDetails(this.giftId);

            if (giftDetails == null)
            {
                base.GotoResourceNotFound();
            }
            else
            {
                Globals.EntityCoding(giftDetails, false);
                this.txtGiftName.Text      = Globals.HtmlDecode(giftDetails.Name);
                this.txtPurchasePrice.Text = string.Format("{0:F2}", giftDetails.PurchasePrice);
                this.txtNeedPoint.Text     = giftDetails.NeedPoint.ToString();
                if (!string.IsNullOrEmpty(giftDetails.Unit))
                {
                    this.txtUnit.Text = giftDetails.Unit;
                }
                if (giftDetails.CostPrice.HasValue)
                {
                    this.txtCostPrice.Text = string.Format("{0:F2}", giftDetails.CostPrice);
                }
                if (giftDetails.MarketPrice.HasValue)
                {
                    this.txtMarketPrice.Text = string.Format("{0:F2}", giftDetails.MarketPrice);
                }
                if (!string.IsNullOrEmpty(giftDetails.ShortDescription))
                {
                    this.txtShortDescription.Text = Globals.HtmlDecode(giftDetails.ShortDescription);
                }
                if (!string.IsNullOrEmpty(giftDetails.LongDescription))
                {
                    this.fcDescription.Text = giftDetails.LongDescription;
                }
                if (!string.IsNullOrEmpty(giftDetails.Title))
                {
                    this.txtGiftTitle.Text = Globals.HtmlDecode(giftDetails.Title);
                }
                if (!string.IsNullOrEmpty(giftDetails.Meta_Description))
                {
                    this.txtTitleDescription.Text = Globals.HtmlDecode(giftDetails.Meta_Description);
                }
                if (!string.IsNullOrEmpty(giftDetails.Meta_Keywords))
                {
                    this.txtTitleKeywords.Text = Globals.HtmlDecode(giftDetails.Meta_Keywords);
                }
                if (!string.IsNullOrEmpty(giftDetails.ImageUrl))
                {
                    this.uploader1.UploadedImageUrl = giftDetails.ImageUrl;
                }
                this.chkDownLoad.Checked  = giftDetails.IsDownLoad;
                this.chkPromotion.Checked = giftDetails.IsPromotion;
            }
        }
コード例 #8
0
ファイル: MyGiftList.cs プロジェクト: uvbs/eshopSanQiang
 private void DeleteGriftById()
 {
     if (!string.IsNullOrEmpty(base.Request.QueryString["oper"]) && base.Request.QueryString["oper"].Trim() == "delete" && !string.IsNullOrEmpty(base.Request.QueryString["GiftId"]) && int.Parse(base.Request.QueryString["GiftId"].Trim()) > 0)
     {
         int      giftId      = int.Parse(base.Request.QueryString["GiftId"].Trim());
         GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId);
         if (SubsiteGiftHelper.DeleteGiftById(giftId))
         {
             this.ReloadGiftsList(true);
             this.ShowMsg("删除礼品" + giftDetails.Name + "成功!", true);
             return;
         }
         this.ShowMsg("删除礼品" + giftDetails.Name + "失败!", false);
     }
 }
コード例 #9
0
ファイル: MyGiftList.aspx.cs プロジェクト: yuelinsoft/himedi
 void DeleteGriftById()
 {
     if ((!string.IsNullOrEmpty(base.Request.QueryString["oper"]) && (base.Request.QueryString["oper"].Trim() == "delete")) && (!string.IsNullOrEmpty(base.Request.QueryString["GiftId"]) && (int.Parse(base.Request.QueryString["GiftId"].Trim()) > 0)))
     {
         int      giftId      = int.Parse(base.Request.QueryString["GiftId"].Trim());
         GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId);
         if (SubsiteGiftHelper.DeleteGiftById(giftId))
         {
             ReloadGiftsList(true);
             ShowMsg("删除礼品" + giftDetails.Name + "成功!", true);
         }
         else
         {
             ShowMsg("删除礼品" + giftDetails.Name + "失败!", false);
         }
     }
 }
コード例 #10
0
 private void DownLoad()
 {
     if (!string.IsNullOrEmpty(base.Request.QueryString["oper"]) && base.Request.QueryString["oper"].Trim() == "download" && !string.IsNullOrEmpty(base.Request.QueryString["GiftId"]) && int.Parse(base.Request.QueryString["GiftId"].Trim()) > 0)
     {
         int      giftId      = int.Parse(base.Request.QueryString["GiftId"].Trim());
         GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId);
         if (giftDetails.IsDownLoad && giftDetails.PurchasePrice > 0m)
         {
             if (SubsiteGiftHelper.DownLoadGift(giftDetails))
             {
                 this.ReloadGiftsList(true);
                 this.ShowMsg("下载礼品" + giftDetails.Name + "成功!", true);
                 return;
             }
             this.ShowMsg("下载礼品" + giftDetails.Name + "失败!", false);
         }
     }
 }
コード例 #11
0
ファイル: MyGifts.aspx.cs プロジェクト: yuelinsoft/himedi
 private void DownLoad()
 {
     if ((!string.IsNullOrEmpty(base.Request.QueryString["oper"]) && (base.Request.QueryString["oper"].Trim() == "download")) && (!string.IsNullOrEmpty(base.Request.QueryString["GiftId"]) && (int.Parse(base.Request.QueryString["GiftId"].Trim()) > 0)))
     {
         GiftInfo giftDetails = GiftHelper.GetGiftDetails(int.Parse(base.Request.QueryString["GiftId"].Trim()));
         if (giftDetails.IsDownLoad && (giftDetails.PurchasePrice > 0M))
         {
             if (SubsiteGiftHelper.DownLoadGift(giftDetails))
             {
                 ReloadGiftsList(true);
                 ShowMsg("下载礼品" + giftDetails.Name + "成功!", true);
             }
             else
             {
                 ShowMsg("下载礼品" + giftDetails.Name + "失败!", false);
             }
         }
     }
 }
コード例 #12
0
 private void dlstGifts_ItemCommand(object source, DataListCommandEventArgs e)
 {
     if (e.CommandName == "check")
     {
         if (!order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_GIFTS))
         {
             ShowMsg("当前订单状态没有订单礼品操作", false);
         }
         else
         {
             int     num;
             int     itemIndex = e.Item.ItemIndex;
             int     giftId    = int.Parse(dlstGifts.DataKeys[itemIndex].ToString());
             TextBox box       = dlstGifts.Items[itemIndex].FindControl("txtQuantity") as TextBox;
             if (!int.TryParse(box.Text.Trim(), out num))
             {
                 ShowMsg("礼品数量填写错误", false);
             }
             else if (num <= 0)
             {
                 ShowMsg("礼品赠送数量不能为0", false);
             }
             else
             {
                 GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId);
                 if (giftDetails == null)
                 {
                     base.GotoResourceNotFound();
                 }
                 else if (!OrderHelper.AddOrderGift(order, giftDetails, num))
                 {
                     ShowMsg("添加订单礼品失败", false);
                 }
                 else
                 {
                     BindOrderGifts();
                 }
             }
         }
     }
 }
コード例 #13
0
ファイル: OrderGifts.cs プロジェクト: uvbs/eshopSanQiang
 private void dlstGifts_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e)
 {
     if (e.CommandName == "check")
     {
         if (!this.order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_GIFTS))
         {
             this.ShowMsg("当前订单状态没有订单礼品操作", false);
             return;
         }
         int itemIndex = e.Item.ItemIndex;
         int giftId    = int.Parse(this.dlstGifts.DataKeys[itemIndex].ToString());
         System.Web.UI.WebControls.TextBox textBox = this.dlstGifts.Items[itemIndex].FindControl("txtQuantity") as System.Web.UI.WebControls.TextBox;
         int num;
         if (!int.TryParse(textBox.Text.Trim(), out num))
         {
             this.ShowMsg("礼品数量填写错误", false);
             return;
         }
         if (num <= 0)
         {
             this.ShowMsg("礼品赠送数量不能为0", false);
             return;
         }
         GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId);
         if (giftDetails == null)
         {
             base.GotoResourceNotFound();
             return;
         }
         if (!OrderHelper.AddOrderGift(this.order, giftDetails, num, 0))
         {
             this.ShowMsg("添加订单礼品失败", false);
             return;
         }
         this.BindOrderGifts();
     }
 }
コード例 #14
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            decimal? nullable;
            decimal? nullable2;
            int      num;
            GiftInfo giftDetails = GiftHelper.GetGiftDetails(this.giftId);

            new Regex("^(?!_)(?!.*?_$)(?!-)(?!.*?-$)[a-zA-Z0-9_一-龥-]+$");
            if (this.ValidateValues(out nullable, out nullable2, out num))
            {
                giftDetails.CostPrice        = nullable;
                giftDetails.MarketPrice      = nullable2;
                giftDetails.NeedPoint        = num;
                giftDetails.Name             = Globals.HtmlEncode(this.txtGiftName.Text.Trim());
                giftDetails.Stock            = int.Parse(this.txtStock.Text.Trim());
                giftDetails.Unit             = this.txtUnit.Text.Trim();
                giftDetails.ShortDescription = Globals.HtmlEncode(this.txtShortDescription.Text.Trim());
                giftDetails.LongDescription  = this.fcDescription.Text.Trim();
                giftDetails.Title            = Globals.HtmlEncode(this.txtGiftTitle.Text.Trim());
                giftDetails.Meta_Description = Globals.HtmlEncode(this.txtTitleDescription.Text.Trim());
                giftDetails.Meta_Keywords    = Globals.HtmlEncode(this.txtTitleKeywords.Text.Trim());
                giftDetails.IsPromotion      = this.chkPromotion.Checked;
                giftDetails.ImageUrl         = this.uploader1.UploadedImageUrl;
                giftDetails.ThumbnailUrl40   = this.uploader1.ThumbnailUrl40;
                giftDetails.ThumbnailUrl60   = this.uploader1.ThumbnailUrl60;
                giftDetails.ThumbnailUrl100  = this.uploader1.ThumbnailUrl100;
                giftDetails.ThumbnailUrl160  = this.uploader1.ThumbnailUrl160;
                giftDetails.ThumbnailUrl180  = this.uploader1.ThumbnailUrl180;
                giftDetails.ThumbnailUrl220  = this.uploader1.ThumbnailUrl220;
                giftDetails.ThumbnailUrl310  = this.uploader1.ThumbnailUrl310;
                giftDetails.ThumbnailUrl410  = this.uploader1.ThumbnailUrl410;
                ValidationResults results = Hishop.Components.Validation.Validation.Validate <GiftInfo>(giftDetails, new string[] { "ValGift" });
                string            str     = string.Empty;
                if (!results.IsValid)
                {
                    foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                    {
                        str = str + Formatter.FormatErrorMessage(result.Message);
                    }
                }
                if (!string.IsNullOrEmpty(str))
                {
                    this.ShowMsg(str, false);
                }
                else
                {
                    switch (GiftHelper.UpdateGift(giftDetails))
                    {
                    case GiftActionStatus.Success:
                        this.ShowMsg("成功修改了一件礼品的基本信息", true);
                        return;

                    case GiftActionStatus.DuplicateName:
                        this.ShowMsg("已经存在相同的礼品名称", false);
                        return;

                    case GiftActionStatus.DuplicateSKU:
                        this.ShowMsg("已经存在相同的商家编码", false);
                        return;

                    case GiftActionStatus.UnknowError:
                        this.ShowMsg("未知错误", false);
                        return;
                    }
                }
            }
        }
コード例 #15
0
        private void LoadGift()
        {
            GiftInfo giftDetails = GiftHelper.GetGiftDetails(this.giftId);

            if (giftDetails == null)
            {
                base.GotoResourceNotFound();
            }
            else
            {
                Globals.EntityCoding(giftDetails, false);
                this.txtGiftName.Text  = Globals.HtmlDecode(giftDetails.Name);
                this.txtNeedPoint.Text = giftDetails.NeedPoint.ToString();
                this.ShippingTemplatesDropDownList.DataBind();
                this.ShippingTemplatesDropDownList.SelectedValue = giftDetails.ShippingTemplateId;
                if (!string.IsNullOrEmpty(giftDetails.Unit))
                {
                    this.txtUnit.Text = giftDetails.Unit;
                }
                if (giftDetails.CostPrice.HasValue)
                {
                    this.txtCostPrice.Text = $"{giftDetails.CostPrice:F2}";
                }
                if (giftDetails.MarketPrice.HasValue)
                {
                    this.txtMarketPrice.Text = $"{giftDetails.MarketPrice:F2}";
                }
                if (!string.IsNullOrEmpty(giftDetails.ShortDescription))
                {
                    this.txtShortDescription.Text = Globals.HtmlDecode(giftDetails.ShortDescription);
                }
                if (!string.IsNullOrEmpty(giftDetails.LongDescription))
                {
                    this.fcDescription.Text = giftDetails.LongDescription;
                }
                if (!string.IsNullOrEmpty(giftDetails.Title))
                {
                    this.txtGiftTitle.Text = Globals.HtmlDecode(giftDetails.Title);
                }
                if (!string.IsNullOrEmpty(giftDetails.Meta_Description))
                {
                    this.txtTitleDescription.Text = Globals.HtmlDecode(giftDetails.Meta_Description);
                }
                if (!string.IsNullOrEmpty(giftDetails.Meta_Keywords))
                {
                    this.txtTitleKeywords.Text = Globals.HtmlDecode(giftDetails.Meta_Keywords);
                }
                if (!string.IsNullOrEmpty(giftDetails.ImageUrl))
                {
                    HiddenField hiddenField  = this.hidUploadImages;
                    HiddenField hiddenField2 = this.hidOldImages;
                    string      text2        = hiddenField.Value = (hiddenField2.Value = giftDetails.ImageUrl);
                }
                this.chkPromotion.SelectedValue          = giftDetails.IsPromotion;
                this.chkIsExemptionPostage.SelectedValue = giftDetails.IsExemptionPostage;
                this.onoffIsPointExchange.SelectedValue  = giftDetails.IsPointExchange;
                int shippingTemplateId = giftDetails.ShippingTemplateId;
                ShippingTemplateInfo shippingTemplate = SalesHelper.GetShippingTemplate(shippingTemplateId, false);
                if (shippingTemplate != null)
                {
                    if (shippingTemplate.ValuationMethod != ValuationMethods.Weight)
                    {
                        this.weightRow.Style.Add("display", "none");
                    }
                    if (shippingTemplate.ValuationMethod != ValuationMethods.Volume)
                    {
                        this.volumeRow.Style.Add("display", "none");
                    }
                    if (shippingTemplate.ValuationMethod == ValuationMethods.Number)
                    {
                        this.volumeRow.Style.Add("display", "none");
                        this.weightRow.Style.Add("display", "none");
                    }
                }
                else
                {
                    this.volumeRow.Style.Add("display", "none");
                    this.weightRow.Style.Add("display", "none");
                }
                this.txtVolume.Text = giftDetails.Volume.F2ToString("f2");
                this.txtWeight.Text = giftDetails.Weight.F2ToString("f2");
            }
        }
コード例 #16
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            GiftInfo giftDetails = GiftHelper.GetGiftDetails(this.giftId);

            if (ActivityHelper.ExistGiftNoReceive(this.giftId))
            {
                this.liprize.Visible = true;
                this.ShowMsg("有用户存在此礼品未领取,如编辑领取的礼品将以最新信息的为准", false);
            }
            else if (ActivityHelper.ExistValueInActivity(this.giftId, ActivityEnumPrizeType.Gift))
            {
                this.liprize.Visible = true;
                this.ShowMsg("有活动中正在使用此礼品最为奖品,如编辑中奖的礼品将以最新的信息为准", false);
            }
            int     shippingTemplateId = 0;
            decimal weight             = default(decimal);
            decimal volume             = default(decimal);
            bool    isExemptionPostage = false;
            Regex   regex       = new Regex("^(?!_)(?!.*?_$)(?!-)(?!.*?-$)[a-zA-Z0-9_一-龥-]+$");
            decimal?costPrice   = default(decimal?);
            decimal?marketPrice = default(decimal?);
            int     needPoint   = default(int);

            if (this.ValidateValues(out costPrice, out marketPrice, out needPoint, out shippingTemplateId, out weight, out volume, out isExemptionPostage))
            {
                giftDetails.CostPrice          = costPrice;
                giftDetails.MarketPrice        = marketPrice;
                giftDetails.NeedPoint          = needPoint;
                giftDetails.Name               = Globals.HtmlEncode(this.txtGiftName.Text.Trim());
                giftDetails.Unit               = this.txtUnit.Text.Trim();
                giftDetails.ShortDescription   = Globals.HtmlEncode(this.txtShortDescription.Text.Trim());
                giftDetails.LongDescription    = this.fcDescription.Text.Trim();
                giftDetails.Title              = Globals.HtmlEncode(this.txtGiftTitle.Text.Trim());
                giftDetails.Meta_Description   = Globals.HtmlEncode(this.txtTitleDescription.Text.Trim());
                giftDetails.Meta_Keywords      = Globals.HtmlEncode(this.txtTitleKeywords.Text.Trim());
                giftDetails.IsPromotion        = this.chkPromotion.SelectedValue;
                giftDetails.IsExemptionPostage = isExemptionPostage;
                giftDetails.IsPointExchange    = this.onoffIsPointExchange.SelectedValue;
                ProductImagesInfo productImagesInfo = this.SaveGiftImage();
                if (productImagesInfo != null)
                {
                    giftDetails.ImageUrl        = productImagesInfo.ImageUrl1;
                    this.hidOldImages.Value     = giftDetails.ImageUrl;
                    giftDetails.ThumbnailUrl40  = productImagesInfo.ThumbnailUrl40;
                    giftDetails.ThumbnailUrl60  = productImagesInfo.ThumbnailUrl60;
                    giftDetails.ThumbnailUrl100 = productImagesInfo.ThumbnailUrl100;
                    giftDetails.ThumbnailUrl160 = productImagesInfo.ThumbnailUrl160;
                    giftDetails.ThumbnailUrl180 = productImagesInfo.ThumbnailUrl180;
                    giftDetails.ThumbnailUrl220 = productImagesInfo.ThumbnailUrl220;
                    giftDetails.ThumbnailUrl310 = productImagesInfo.ThumbnailUrl310;
                    giftDetails.ThumbnailUrl410 = productImagesInfo.ThumbnailUrl410;
                }
                else if (this.hidUploadImages.Value.Trim().Length == 0)
                {
                    if (!string.IsNullOrEmpty(giftDetails.ImageUrl))
                    {
                        this.hidUploadImages.Value = giftDetails.ImageUrl;
                    }
                    this.ShowMsg("必须上传礼品图片", false);
                    return;
                }
                giftDetails.IsExemptionPostage = isExemptionPostage;
                giftDetails.Weight             = weight;
                giftDetails.Volume             = volume;
                giftDetails.ShippingTemplateId = shippingTemplateId;
                ValidationResults validationResults = Validation.Validate(giftDetails, "ValGift");
                string            text = string.Empty;
                if (!validationResults.IsValid)
                {
                    foreach (ValidationResult item in (IEnumerable <ValidationResult>)validationResults)
                    {
                        text += Formatter.FormatErrorMessage(item.Message);
                    }
                }
                if (!string.IsNullOrEmpty(text))
                {
                    this.ShowMsg(text, false);
                }
                else if (GiftHelper.UpdateGift(giftDetails))
                {
                    base.Response.Redirect("Gifts.aspx?flag=2");
                }
                else
                {
                    this.ShowMsg("已经存在相同的礼品名称", false);
                }
            }
        }
コード例 #17
0
        public void GetActivityInfo(HttpContext context)
        {
            int          activityId   = context.Request["ActivityId"].ToInt(0);
            ActivityInfo activityInfo = ActivityHelper.GetActivityInfo(activityId);

            if (activityInfo == null)
            {
                this.ReturnError(context, 1007, "活动不存在!");
            }
            else
            {
                ActivityJsonModel activityJsonModel = new ActivityJsonModel();
                MemberInfo        user = HiContext.Current.User;
                DateTime          dateTime;
                if (user.UserId == 0)
                {
                    activityJsonModel.FreeTimes = activityInfo.FreeTimes;
                }
                else
                {
                    activityJsonModel.FreeTimes = activityInfo.FreeTimes;
                    ActivityJoinStatisticsInfo currUserActivityStatisticsInfo = ActivityHelper.GetCurrUserActivityStatisticsInfo(user.UserId, activityId);
                    if (currUserActivityStatisticsInfo == null)
                    {
                        activityJsonModel.FreeTimes = activityInfo.FreeTimes;
                    }
                    else if (activityInfo.ResetType == 2)
                    {
                        dateTime = DateTime.Now;
                        DateTime date = dateTime.Date;
                        dateTime = currUserActivityStatisticsInfo.LastJoinDate;
                        if (date == dateTime.Date)
                        {
                            activityJsonModel.FreeTimes = activityInfo.FreeTimes - currUserActivityStatisticsInfo.FreeNum;
                        }
                        else
                        {
                            activityJsonModel.FreeTimes = activityInfo.FreeTimes;
                        }
                    }
                    else
                    {
                        Globals.AppendLog("5", "", "", "");
                        activityJsonModel.FreeTimes = activityInfo.FreeTimes - currUserActivityStatisticsInfo.FreeNum;
                    }
                }
                activityJsonModel.ResetType           = activityInfo.ResetType;
                activityJsonModel.ActivityId          = activityInfo.ActivityId;
                activityJsonModel.ActivityName        = activityInfo.ActivityName;
                activityJsonModel.ActivityType        = activityInfo.ActivityType;
                activityJsonModel.ConsumptionIntegral = activityInfo.ConsumptionIntegral;
                activityJsonModel.Description         = activityInfo.Description;
                ActivityJsonModel activityJsonModel2 = activityJsonModel;
                dateTime = activityInfo.EndDate;
                activityJsonModel2.EndDate = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
                ActivityJsonModel activityJsonModel3 = activityJsonModel;
                dateTime = activityInfo.StartDate;
                activityJsonModel3.StartDate = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
                if (DateTime.Now < activityInfo.StartDate)
                {
                    activityJsonModel.Statu = 1;
                }
                else if (DateTime.Now > activityInfo.EndDate)
                {
                    activityJsonModel.Statu = 2;
                }
                else
                {
                    activityJsonModel.Statu = 0;
                }
                activityJsonModel.AwardList = new List <AwardItemInfo>();
                List <ActivityAwardItemInfo> activityItemList = ActivityHelper.GetActivityItemList(activityId);
                foreach (ActivityAwardItemInfo item in activityItemList)
                {
                    AwardItemInfo awardItemInfo = new AwardItemInfo();
                    awardItemInfo.ActivityId = item.ActivityId;
                    awardItemInfo.AwardGrade = this.CapitalLetters(item.AwardGrade);
                    awardItemInfo.AwardId    = item.AwardId;
                    awardItemInfo.PrizeType  = item.PrizeType;
                    if (item.PrizeType == 2)
                    {
                        CouponInfo coupon = CouponHelper.GetCoupon(item.PrizeValue);
                        if (coupon != null)
                        {
                            awardItemInfo.AwardName = coupon.Price.F2ToString("f2") + "元";
                        }
                        else
                        {
                            awardItemInfo.AwardName = "";
                        }
                        awardItemInfo.AwardPic = "";
                    }
                    else if (item.PrizeType == 3)
                    {
                        GiftInfo giftDetails = GiftHelper.GetGiftDetails(item.PrizeValue);
                        if (giftDetails != null)
                        {
                            awardItemInfo.AwardName = giftDetails.Name;
                            awardItemInfo.AwardPic  = giftDetails.ThumbnailUrl60;
                        }
                        else
                        {
                            awardItemInfo.AwardName = "礼品";
                            awardItemInfo.AwardPic  = "";
                        }
                    }
                    else
                    {
                        awardItemInfo.AwardPic  = "";
                        awardItemInfo.AwardName = item.PrizeValue.ToString();
                    }
                    activityJsonModel.AwardList.Add(awardItemInfo);
                }
                string s = JsonConvert.SerializeObject(new
                {
                    Result = activityJsonModel
                });
                context.Response.Write(s);
                context.Response.End();
            }
        }
コード例 #18
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            decimal? nullable;
            decimal  num;
            decimal? nullable2;
            int      num2;
            GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId);

            if (ValidateValues(out nullable, out num, out nullable2, out num2))
            {
                giftDetails.PurchasePrice    = num;
                giftDetails.CostPrice        = nullable;
                giftDetails.MarketPrice      = nullable2;
                giftDetails.NeedPoint        = num2;
                giftDetails.Name             = txtGiftName.Text.Trim();
                giftDetails.Unit             = txtUnit.Text.Trim();
                giftDetails.ShortDescription = txtShortDescription.Text.Trim();
                giftDetails.LongDescription  = fcDescription.Text.Trim();
                giftDetails.Title            = txtGiftTitle.Text.Trim();
                giftDetails.Meta_Description = txtTitleDescription.Text.Trim();
                giftDetails.Meta_Keywords    = txtTitleKeywords.Text.Trim();
                giftDetails.IsDownLoad       = ckdown.Checked;
                giftDetails.ImageUrl         = uploader1.UploadedImageUrl;
                giftDetails.ThumbnailUrl40   = uploader1.ThumbnailUrl40;
                giftDetails.ThumbnailUrl60   = uploader1.ThumbnailUrl60;
                giftDetails.ThumbnailUrl100  = uploader1.ThumbnailUrl100;
                giftDetails.ThumbnailUrl160  = uploader1.ThumbnailUrl160;
                giftDetails.ThumbnailUrl180  = uploader1.ThumbnailUrl180;
                giftDetails.ThumbnailUrl220  = uploader1.ThumbnailUrl220;
                giftDetails.ThumbnailUrl310  = uploader1.ThumbnailUrl310;
                giftDetails.ThumbnailUrl410  = uploader1.ThumbnailUrl410;
                ValidationResults results = Hishop.Components.Validation.Validation.Validate <GiftInfo>(giftDetails, new string[] { "ValGift" });
                string            str     = string.Empty;
                if (giftDetails.PurchasePrice < giftDetails.CostPrice)
                {
                    str = str + Formatter.FormatErrorMessage("礼品采购价不能小于成本价");
                }
                if (!results.IsValid)
                {
                    foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                    {
                        str = str + Formatter.FormatErrorMessage(result.Message);
                    }
                }
                if (!string.IsNullOrEmpty(str))
                {
                    ShowMsg(str, false);
                }
                else
                {
                    switch (GiftHelper.UpdateGift(giftDetails))
                    {
                    case GiftActionStatus.Success:
                        ShowMsg("成功修改了一件礼品的基本信息", true);
                        return;

                    case GiftActionStatus.DuplicateName:
                        ShowMsg("已经存在相同的礼品名称", false);
                        return;

                    case GiftActionStatus.DuplicateSKU:
                        ShowMsg("已经存在相同的商家编码", false);
                        return;

                    case GiftActionStatus.UnknowError:
                        ShowMsg("未知错误", false);
                        return;
                    }
                }
            }
        }
コード例 #19
0
ファイル: EditGift.cs プロジェクト: damoOnly/e-commerce
        private void btnUpdate_Click(object sender, System.EventArgs e)
        {
            GiftInfo giftDetails = GiftHelper.GetGiftDetails(this.giftId);

            new System.Text.RegularExpressions.Regex("^(?!_)(?!.*?_$)(?!-)(?!.*?-$)[a-zA-Z0-9_一-龥-]+$");
            decimal?costPrice;
            decimal?marketPrice;
            int     needPoint;

            if (!this.ValidateValues(out costPrice, out marketPrice, out needPoint))
            {
                return;
            }
            giftDetails.CostPrice        = costPrice;
            giftDetails.MarketPrice      = marketPrice;
            giftDetails.NeedPoint        = needPoint;
            giftDetails.Name             = Globals.HtmlEncode(this.txtGiftName.Text.Trim());
            giftDetails.Unit             = this.txtUnit.Text.Trim();
            giftDetails.ShortDescription = Globals.HtmlEncode(this.txtShortDescription.Text.Trim());
            giftDetails.LongDescription  = this.fcDescription.Text.Trim();
            giftDetails.Title            = Globals.HtmlEncode(this.txtGiftTitle.Text.Trim());
            giftDetails.Meta_Description = Globals.HtmlEncode(this.txtTitleDescription.Text.Trim());
            giftDetails.Meta_Keywords    = Globals.HtmlEncode(this.txtTitleKeywords.Text.Trim());
            giftDetails.IsPromotion      = this.chkPromotion.Checked;
            giftDetails.ImageUrl         = this.uploader1.UploadedImageUrl;
            giftDetails.ThumbnailUrl40   = this.uploader1.ThumbnailUrl40;
            giftDetails.ThumbnailUrl60   = this.uploader1.ThumbnailUrl60;
            giftDetails.ThumbnailUrl100  = this.uploader1.ThumbnailUrl100;
            giftDetails.ThumbnailUrl160  = this.uploader1.ThumbnailUrl160;
            giftDetails.ThumbnailUrl180  = this.uploader1.ThumbnailUrl180;
            giftDetails.ThumbnailUrl220  = this.uploader1.ThumbnailUrl220;
            giftDetails.ThumbnailUrl310  = this.uploader1.ThumbnailUrl310;
            giftDetails.ThumbnailUrl410  = this.uploader1.ThumbnailUrl410;
            ValidationResults validationResults = Validation.Validate <GiftInfo>(giftDetails, new string[]
            {
                "ValGift"
            });
            string text = string.Empty;

            if (!validationResults.IsValid)
            {
                foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)
                {
                    text += Formatter.FormatErrorMessage(current.Message);
                }
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.ShowMsg(text, false);
                return;
            }
            GiftActionStatus giftActionStatus  = GiftHelper.UpdateGift(giftDetails);
            GiftActionStatus giftActionStatus2 = giftActionStatus;

            switch (giftActionStatus2)
            {
            case GiftActionStatus.Success:
                this.ShowMsg("成功修改了一件礼品的基本信息", true);
                return;

            case GiftActionStatus.DuplicateName:
                this.ShowMsg("已经存在相同的礼品名称", false);
                return;

            case GiftActionStatus.DuplicateSKU:
                this.ShowMsg("已经存在相同的商家编码", false);
                return;

            default:
                if (giftActionStatus2 != GiftActionStatus.UnknowError)
                {
                    return;
                }
                this.ShowMsg("未知错误", false);
                return;
            }
        }