Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.saveBtn.Click += new EventHandler(this.Unnamed_Click);
     if (!base.IsPostBack)
     {
         DataTable couponList = this.GetCouponList();
         if ((couponList != null) && (couponList.Rows.Count > 0))
         {
             for (int i = 0; i < couponList.Rows.Count; i++)
             {
                 ListItem item = new ListItem(couponList.Rows[i]["CouponName"].ToString(), couponList.Rows[i]["CouponId"].ToString());
                 this.cmb_CouponList.Items.Add(item);
             }
         }
         ListItem item2 = new ListItem("请选择", "0");
         this.cmb_CouponList.Items.Insert(0, item2);
         if (base.Request.Params.AllKeys.Contains <string>("id") && base.Request["id"].ToString().bInt(ref this.actId))
         {
             this.shareActId.Value = this.actId.ToString();
             ShareActivityInfo act = new ShareActivityInfo();
             act = ShareActHelper.GetAct(this.actId);
             this.txt_MeetValue.Text             = act.MeetValue.ToString("F2");
             this.txt_Number.Text                = act.CouponNumber.ToString();
             this.cmb_CouponList.SelectedValue   = act.CouponId.ToString();
             this.calendarStartDate.SelectedDate = new DateTime?(act.BeginDate);
             this.calendarEndDate.SelectedDate   = new DateTime?(act.EndDate);
             this.txt_name.Text  = act.ActivityName;
             this.txt_img.Text   = act.ImgUrl;
             this.hidpic.Value   = act.ImgUrl;
             this.txt_title.Text = act.ShareTitle;
             this.txt_des.Text   = act.Description;
         }
     }
 }
Пример #2
0
        protected override void AttachChildControls()
        {
            this.litItemParams = (Literal)this.FindControl("litItemParams");
            string str    = HttpContext.Current.Request.QueryString.Get("shareid");
            int    result = 0;

            if (!string.IsNullOrEmpty(str))
            {
                if (int.TryParse(str, out result))
                {
                    DataView defaultView = ShareActHelper.GetShareActivity().DefaultView;
                    defaultView.RowFilter = " id=" + result;
                    if (defaultView.Count > 0)
                    {
                        ShareActivityInfo act = ShareActHelper.GetAct(result);
                        if (act != null)
                        {
                            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                            if (act.ShareTitle.Contains("{{微信昵称}}"))
                            {
                                act.ShareTitle = act.ShareTitle.Replace("{{微信昵称}}", currentMember.UserName);
                            }
                            if (act.Description.Contains("{{店铺名称}}"))
                            {
                                HttpCookie cookie = new HttpCookie("Vshop-ReferralId");
                                if ((cookie != null) && (cookie.Value != null))
                                {
                                    DistributorsInfo userIdDistributors = new DistributorsInfo();
                                    userIdDistributors = DistributorsBrower.GetUserIdDistributors(int.Parse(cookie.Value));
                                    act.Description    = act.Description.Replace("{{店铺名称}}", userIdDistributors.StoreName);
                                }
                                else
                                {
                                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(true, wid);
                                    act.Description = act.Description.Replace("{{店铺名称}}", masterSettings.SiteName);
                                }
                            }
                            if (currentMember == null)
                            {
                                base.GotoResourceNotFound("用户信息获取错误!");
                            }
                            this.litItemParams.Text = string.Concat(new object[] { Globals.HostPath(HttpContext.Current.Request.Url), act.ImgUrl, "|", act.ShareTitle, "|", Globals.HostPath(HttpContext.Current.Request.Url), "/Vshop/getredpager.aspx?id=", result, "&userid=", currentMember.UserId, "|", act.Description });
                        }
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect("/vshop/MemberCenter.aspx");
                    }
                }
                else
                {
                    base.GotoResourceNotFound("输入的参数不正确!");
                }
            }
            PageTitle.AddSiteNameTitle("分享助力");
        }
Пример #3
0
 protected void Unnamed_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.cmb_CouponList.SelectedValue) || (this.cmb_CouponList.SelectedValue == "0"))
     {
         this.ShowMsg("请选择优惠券!", false);
     }
     else
     {
         int      couponId = int.Parse(this.cmb_CouponList.SelectedValue);
         DateTime date     = this.calendarStartDate.SelectedDate.Value.Date;
         DateTime time2    = this.calendarEndDate.SelectedDate.Value.Date.AddDays(1.0).AddSeconds(-1.0);
         string   text     = this.txt_MeetValue.Text;
         string   val      = this.txt_Number.Text;
         decimal  i        = 0M;
         int      num3     = 0;
         if (string.IsNullOrEmpty(this.txt_name.Text.Trim()))
         {
             this.ShowMsg("活动名称不能为空!", false);
         }
         else if (time2 < date)
         {
             this.ShowMsg("活动结束时间不能小于开始时间!", false);
         }
         else
         {
             CouponInfo coupon = CouponHelper.GetCoupon(couponId);
             if (coupon == null)
             {
                 this.ShowMsg("优惠券不存在!", false);
             }
             else if (time2 > coupon.EndDate)
             {
                 this.ShowMsg("活动结束时间不能大于优惠券的结束时间!", false);
             }
             else if (!text.bDecimal(ref i))
             {
                 this.ShowMsg("订单满足金额输入错误!", false);
             }
             else if (!val.bInt(ref num3))
             {
                 this.ShowMsg("优惠券张数输入错误!", false);
             }
             else if (string.IsNullOrEmpty(this.txt_img.Text))
             {
                 this.ShowMsg("请上传朋友圈显示图片!", false);
             }
             else if (string.IsNullOrEmpty(this.txt_title.Text.Trim()))
             {
                 this.ShowMsg("朋友圈分享标题不能为空!", false);
             }
             else if (string.IsNullOrEmpty(this.txt_des.Text.Trim()))
             {
                 this.ShowMsg("活动介绍不能为空!", false);
             }
             else
             {
                 ShareActivityInfo act = new ShareActivityInfo();
                 this.actId = int.Parse(this.shareActId.Value);
                 if (this.actId != 0)
                 {
                     act = ShareActHelper.GetAct(this.actId);
                 }
                 act.BeginDate    = date;
                 act.EndDate      = time2;
                 act.CouponId     = couponId;
                 act.CouponNumber = num3;
                 act.CouponName   = coupon.CouponName;
                 act.MeetValue    = i;
                 act.ActivityName = this.txt_name.Text;
                 act.ImgUrl       = this.txt_img.Text;
                 act.ShareTitle   = this.txt_title.Text;
                 act.Description  = this.txt_des.Text;
                 if (this.actId != 0)
                 {
                     string msg = "";
                     ShareActHelper.Update(act, ref msg);
                     this.ShowMsg("修改成功!", true);
                 }
                 else
                 {
                     string str4 = "";
                     ShareActHelper.Create(act, ref str4);
                     this.ShowMsg("保存成功!", true);
                 }
                 base.Response.Redirect("ShareActList.aspx");
             }
         }
     }
 }
Пример #4
0
        protected override void AttachChildControls()
        {
            string text  = System.Web.HttpContext.Current.Request.QueryString.Get("m");
            string text2 = System.Web.HttpContext.Current.Request.QueryString.Get("type");

            this.ltGetTotal                      = (System.Web.UI.WebControls.Literal) this.FindControl("ltGetTotal");
            this.ltOrderAmountCanUse             = (System.Web.UI.WebControls.Literal) this.FindControl("ltOrderAmountCanUse");
            this.ltExpiryTime                    = (System.Web.UI.WebControls.Literal) this.FindControl("ltExpiryTime");
            this.ltRedPagerActivityName          = (System.Web.UI.WebControls.Literal) this.FindControl("ltRedPagerActivityName");
            this.ltRedPagerActivityNameForOrders = (System.Web.UI.WebControls.Literal) this.FindControl("ltRedPagerActivityNameForOrders");
            this.ltRedPagerLimit                 = (System.Web.UI.WebControls.Literal) this.FindControl("ltRedPagerLimit");
            this.ltErrorMessage                  = (System.Web.UI.WebControls.Literal) this.FindControl("ltErrorMessage");
            this.divNoLogin                      = (System.Web.UI.WebControls.Panel) this.FindControl("divNoLogin");
            this.divNoNum    = (System.Web.UI.WebControls.Panel) this.FindControl("divNoNum");
            this.divSuccess  = (System.Web.UI.WebControls.Panel) this.FindControl("divSuccess");
            this.divError    = (System.Web.UI.WebControls.Panel) this.FindControl("divError");
            this.hdCondition = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hdCondition");
            this.hlinkLogin  = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlinkLogin");
            if (text2 == "1" || text2 == "5")
            {
                int num = 0;
                int.TryParse(text, out num);
                if (num > 0)
                {
                    int id = 0;
                    int.TryParse(System.Web.HttpContext.Current.Request["id"], out id);
                    ShareActivityInfo act = ShareActHelper.GetAct(id);
                    if (act != null)
                    {
                        CouponInfo coupon = CouponHelper.GetCoupon(act.CouponId);
                        this.ltGetTotal.Text          = coupon.CouponValue.ToString("F2").Replace(".00", "");
                        this.ltOrderAmountCanUse.Text = coupon.ConditionValue.ToString("F2").Replace(".00", "");
                        this.hdCondition.SetWhenIsNotNull(coupon.ConditionValue.ToString("F2").Replace(".00", ""));
                        this.ltExpiryTime.Text = coupon.EndDate.ToString("yyyy-MM-dd");
                        if (text2 == "5")
                        {
                            this.ltRedPagerActivityName.Text = "该券已经到你的钱包了</div><div class='get-red-explain'><a href='/Vshop/MyCouponLists.aspx'>点击查看</a>";
                        }
                        else
                        {
                            this.ltRedPagerActivityName.Text = (coupon.CouponName ?? "");
                        }
                        if (coupon.IsAllProduct)
                        {
                            this.ltRedPagerLimit.Text = "该券可用于任意商品的抵扣";
                        }
                        else
                        {
                            string couponProductIds = CouponHelper.GetCouponProductIds(act.CouponId);
                            this.ltRedPagerLimit.Text = "该券可用于部分商品的抵扣</div><div class='get-red-explain'><a href='/ProductList.aspx?pIds='" + couponProductIds + ">查看商品</a>";
                        }
                        this.divSuccess.Visible = true;
                    }
                }
                PageTitle.AddSiteNameTitle("成功获取优惠券");
            }
            else
            {
                string text3 = text2;
                if (text3 != null)
                {
                    if (!(text3 == "-1"))
                    {
                        if (!(text3 == "-2"))
                        {
                            if (!(text3 == "-4"))
                            {
                                if (text3 == "-3")
                                {
                                    this.divNoNum.Visible = true;
                                }
                            }
                            else
                            {
                                this.divNoLogin.Visible = true;
                            }
                        }
                        else
                        {
                            this.ltErrorMessage.Text = text;
                            this.divError.Visible    = true;
                        }
                    }
                    else
                    {
                        int id = 0;
                        int.TryParse(System.Web.HttpContext.Current.Request["id"], out id);
                        ShareActivityInfo act = ShareActHelper.GetAct(id);
                        if (act != null)
                        {
                            CouponInfo coupon = CouponHelper.GetCoupon(act.CouponId);
                            if (coupon != null)
                            {
                                this.ltRedPagerActivityNameForOrders.Text = coupon.CouponName;
                                string s = string.Concat(new object[]
                                {
                                    Globals.GetWebUrlStart(),
                                    "/Vshop/GetRedPager.aspx?id=",
                                    id.ToString(),
                                    "&userid=",
                                    Globals.GetCurrentMemberUserId(),
                                    "&ReferralId=",
                                    Globals.GetCurrentDistributorId()
                                });
                                this.hlinkLogin.NavigateUrl = "/UserLogining.aspx?returnUrl=" + System.Web.HttpContext.Current.Server.UrlEncode(s);
                                this.divNoLogin.Visible     = true;
                            }
                            else
                            {
                                System.Web.HttpContext.Current.Response.Redirect("/default.aspx");
                                System.Web.HttpContext.Current.Response.End();
                            }
                        }
                        else
                        {
                            System.Web.HttpContext.Current.Response.Redirect("/default.aspx");
                            System.Web.HttpContext.Current.Response.End();
                        }
                    }
                }
                PageTitle.AddSiteNameTitle("获取优惠券");
            }
        }
Пример #5
0
        protected override void AttachChildControls()
        {
            this.litItemParams = (System.Web.UI.WebControls.Literal) this.FindControl("litItemParams");
            string     text          = System.Web.HttpContext.Current.Request.QueryString.Get("orderid");
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (!string.IsNullOrEmpty(text) && currentMember != null)
            {
                DataTable orderRedPager = ShareActHelper.GetOrderRedPager(text, currentMember.UserId);
                if (orderRedPager != null && orderRedPager.Rows.Count > 0)
                {
                    DataView defaultView = orderRedPager.DefaultView;
                    if (defaultView.Count > 0)
                    {
                        ShareActivityInfo act = ShareActHelper.GetAct(System.Convert.ToInt32(defaultView[0]["RedPagerActivityId"]));
                        if (act != null)
                        {
                            string text2 = act.ShareTitle;
                            string text3 = act.Description;
                            if (text2.Contains("{{店铺名称}}") || text3.Contains("{{店铺名称}}"))
                            {
                                System.Web.HttpCookie httpCookie = new System.Web.HttpCookie("Vshop-ReferralId");
                                if (httpCookie != null && httpCookie.Value != null)
                                {
                                    DistributorsInfo distributorsInfo = new DistributorsInfo();
                                    distributorsInfo = DistributorsBrower.GetUserIdDistributors(int.Parse(httpCookie.Value));
                                    text3            = text3.Replace("{{店铺名称}}", distributorsInfo.StoreName);
                                    text2            = text2.Replace("{{店铺名称}}", distributorsInfo.StoreName);
                                }
                                else
                                {
                                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                                    text3 = text3.Replace("{{店铺名称}}", masterSettings.SiteName);
                                    text2 = text2.Replace("{{店铺名称}}", masterSettings.SiteName);
                                }
                            }
                            if (text2.Contains("{{微信昵称}}"))
                            {
                                text2 = text2.Replace("{{微信昵称}}", currentMember.UserName);
                            }
                            if (text3.Contains("{{微信昵称}}"))
                            {
                                text3 = text3.Replace("{{微信昵称}}", currentMember.UserName);
                            }
                            string webUrlStart = Globals.GetWebUrlStart();
                            this.litItemParams.Text = string.Concat(new object[]
                            {
                                webUrlStart,
                                act.ImgUrl,
                                "|",
                                text2.Replace("|", "|"),
                                "|",
                                Globals.GetWebUrlStart(),
                                "/Vshop/getredpager.aspx?id=",
                                defaultView[0]["RedPagerActivityId"],
                                "&userid=",
                                currentMember.UserId,
                                "&ReferralId=",
                                Globals.GetCurrentDistributorId(),
                                "|",
                                text3.Replace("|", "|")
                            });
                        }
                    }
                    else
                    {
                        System.Web.HttpContext.Current.Response.Redirect("/vshop/MemberCenter.aspx?t=1");
                    }
                }
                else
                {
                    orderRedPager = ShareActHelper.GetOrderRedPager(text, -100);
                    if (orderRedPager.Rows.Count > 0)
                    {
                        System.Web.HttpContext.Current.Response.Redirect(string.Concat(new object[]
                        {
                            "/Vshop/getredpager.aspx?id=",
                            orderRedPager.Rows[0]["RedPagerActivityId"].ToString(),
                            "&userid=",
                            currentMember.UserId,
                            "&ReferralId=",
                            Globals.GetCurrentDistributorId()
                        }));
                        System.Web.HttpContext.Current.Response.End();
                    }
                    else
                    {
                        System.Web.HttpContext.Current.Response.Redirect("/vshop/MemberCenter.aspx?t=2");
                    }
                }
            }
            else
            {
                System.Web.HttpContext.Current.Response.Redirect("/default.aspx");
                System.Web.HttpContext.Current.Response.End();
            }
            PageTitle.AddSiteNameTitle("分享助力");
        }
Пример #6
0
        protected override void AttachChildControls()
        {
            string s    = HttpContext.Current.Request.QueryString.Get("m");
            string str2 = HttpContext.Current.Request.QueryString.Get("type");

            this.ltGetTotal                      = (Literal)this.FindControl("ltGetTotal");
            this.ltOrderAmountCanUse             = (Literal)this.FindControl("ltOrderAmountCanUse");
            this.ltExpiryTime                    = (Literal)this.FindControl("ltExpiryTime");
            this.ltRedPagerActivityName          = (Literal)this.FindControl("ltRedPagerActivityName");
            this.ltRedPagerActivityNameForOrders = (Literal)this.FindControl("ltRedPagerActivityNameForOrders");
            this.ltRedPagerLimit                 = (Literal)this.FindControl("ltRedPagerLimit");
            this.ltErrorMessage                  = (Literal)this.FindControl("ltErrorMessage");
            this.divNoLogin                      = (Panel)this.FindControl("divNoLogin");
            this.divNoNum    = (Panel)this.FindControl("divNoNum");
            this.divSuccess  = (Panel)this.FindControl("divSuccess");
            this.divError    = (Panel)this.FindControl("divError");
            this.hdCondition = (HtmlInputHidden)this.FindControl("hdCondition");
            this.hlinkLogin  = (HyperLink)this.FindControl("hlinkLogin");
            switch (str2)
            {
            case "1":
            case "5":
            {
                int result = 0;
                int.TryParse(s, out result);
                if (result > 0)
                {
                    int num2 = 0;
                    int.TryParse(HttpContext.Current.Request["id"], out num2);
                    ShareActivityInfo act = ShareActHelper.GetAct(num2);
                    if (act != null)
                    {
                        CouponInfo coupon = CouponHelper.GetCoupon(act.CouponId);
                        this.ltGetTotal.Text          = coupon.CouponValue.ToString("F2").Replace(".00", "");
                        this.ltOrderAmountCanUse.Text = coupon.ConditionValue.ToString("F2").Replace(".00", "");
                        this.hdCondition.SetWhenIsNotNull(coupon.ConditionValue.ToString("F2").Replace(".00", ""));
                        this.ltExpiryTime.Text = coupon.EndDate.ToString("yyyy-MM-dd");
                        if (str2 == "5")
                        {
                            this.ltRedPagerActivityName.Text = "该券已经到你的钱包了</div><div class='get-red-explain'><a href='/Vshop/MyCouponLists.aspx'>点击查看</a>";
                        }
                        else
                        {
                            this.ltRedPagerActivityName.Text = coupon.CouponName ?? "";
                        }
                        if (coupon.IsAllProduct)
                        {
                            this.ltRedPagerLimit.Text = "该券可用于任意商品的抵扣";
                        }
                        else
                        {
                            string couponProductIds = CouponHelper.GetCouponProductIds(act.CouponId);
                            this.ltRedPagerLimit.Text = "该券可用于部分商品的抵扣</div><div class='get-red-explain'><a href='/ProductList.aspx?pIds='" + couponProductIds + ">查看商品</a>";
                        }
                        this.divSuccess.Visible = true;
                    }
                }
                PageTitle.AddSiteNameTitle("成功获取优惠券");
                return;
            }

            default:
            {
                string str5 = str2;
                if (str5 != null)
                {
                    if (!(str5 == "-1"))
                    {
                        if (str5 == "-2")
                        {
                            this.ltErrorMessage.Text = s;
                            this.divError.Visible    = true;
                            break;
                        }
                        if (str5 == "-4")
                        {
                            this.divNoLogin.Visible = true;
                            break;
                        }
                        if (str5 == "-3")
                        {
                            this.divNoNum.Visible = true;
                            break;
                        }
                    }
                    else
                    {
                        int num3 = 0;
                        int.TryParse(HttpContext.Current.Request["id"], out num3);
                        ShareActivityInfo info3 = ShareActHelper.GetAct(num3);
                        if (info3 != null)
                        {
                            CouponInfo info4 = CouponHelper.GetCoupon(info3.CouponId);
                            this.ltRedPagerActivityNameForOrders.Text = info4.CouponName;
                            string str4 = string.Concat(new object[] { "http://", Globals.DomainName, Globals.ApplicationPath, "/Vshop/GetRedPager.aspx?id=", num3.ToString(), "&userid=", Globals.GetCurrentMemberUserId() });
                            this.hlinkLogin.NavigateUrl = "/Vshop/UserLogin.aspx?returnUrl=" + HttpContext.Current.Server.UrlEncode(str4 + "&" + this.getopenid());
                            this.divNoLogin.Visible     = true;
                        }
                        else
                        {
                            HttpContext.Current.Response.Redirect("/Vshop/");
                            HttpContext.Current.Response.End();
                        }
                    }
                }
                break;
            }
            }
            PageTitle.AddSiteNameTitle("获取优惠券");
        }
Пример #7
0
        protected void Unnamed_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.cmb_CouponList.SelectedValue) || this.cmb_CouponList.SelectedValue == "0")
            {
                this.ShowMsg("请选择优惠券!", false);
                return;
            }
            int couponId = int.Parse(this.cmb_CouponList.SelectedValue);

            System.DateTime value        = this.calendarStartDate.SelectedDate.Value;
            System.DateTime value2       = this.calendarEndDate.SelectedDate.Value;
            string          text         = this.txt_MeetValue.Text;
            string          text2        = this.txt_Number.Text;
            decimal         meetValue    = 0m;
            int             couponNumber = 0;

            if (string.IsNullOrEmpty(this.txt_name.Text.Trim()))
            {
                this.ShowMsg("活动名称不能为空!", false);
                return;
            }
            if (value2 < value)
            {
                this.ShowMsg("活动结束时间不能小于开始时间!", false);
                return;
            }
            CouponInfo coupon = CouponHelper.GetCoupon(couponId);

            if (coupon == null)
            {
                this.ShowMsg("优惠券不存在!", false);
                return;
            }
            if (value2 > coupon.EndDate)
            {
                this.ShowMsg(string.Concat(new object[]
                {
                    "活动结束时间",
                    value2,
                    "不能大于优惠券的结束时间",
                    coupon.EndDate,
                    "!"
                }), false);
                return;
            }
            if (!text.bDecimal(ref meetValue))
            {
                this.ShowMsg("订单满足金额输入错误!", false);
                return;
            }
            if (!text2.bInt(ref couponNumber))
            {
                this.ShowMsg("优惠券张数输入错误!", false);
                return;
            }
            if (string.IsNullOrEmpty(this.txt_img.Text))
            {
                this.ShowMsg("请上传朋友圈显示图片!", false);
                return;
            }
            if (string.IsNullOrEmpty(this.txt_title.Text.Trim()))
            {
                this.ShowMsg("朋友圈分享标题不能为空!", false);
                return;
            }
            if (string.IsNullOrEmpty(this.txt_des.Text.Trim()))
            {
                this.ShowMsg("活动介绍不能为空!", false);
                return;
            }
            ShareActivityInfo shareActivityInfo = new ShareActivityInfo();

            this.actId = int.Parse(this.shareActId.Value);
            if (this.actId != 0)
            {
                shareActivityInfo = ShareActHelper.GetAct(this.actId);
            }
            shareActivityInfo.BeginDate    = value;
            shareActivityInfo.EndDate      = value2;
            shareActivityInfo.CouponId     = couponId;
            shareActivityInfo.CouponNumber = couponNumber;
            shareActivityInfo.CouponName   = coupon.CouponName;
            shareActivityInfo.MeetValue    = meetValue;
            shareActivityInfo.ActivityName = this.txt_name.Text;
            shareActivityInfo.ImgUrl       = this.txt_img.Text;
            shareActivityInfo.ShareTitle   = this.txt_title.Text;
            shareActivityInfo.Description  = this.txt_des.Text;
            if (this.actId != 0)
            {
                string text3 = "";
                ShareActHelper.Update(shareActivityInfo, ref text3);
                this.ShowMsg("修改成功!", true);
            }
            else
            {
                string text4 = "";
                ShareActHelper.Create(shareActivityInfo, ref text4);
                this.ShowMsg("保存成功!", true);
            }
            base.Response.Redirect("ShareActList.aspx");
        }