Exemple #1
0
        private void CountTotal(string name)
        {
            ShareActivitySearch query = new ShareActivitySearch
            {
                status     = ShareActivityStatus.All,
                IsCount    = true,
                PageIndex  = this.pager1.PageIndex,
                PageSize   = this.pager1.PageSize,
                SortBy     = "Id",
                SortOrder  = SortAction.Desc,
                CouponName = name
            };
            DataTable data = (DataTable)ShareActHelper.Query(query).Data;

            this.lblAll.Text     = (data != null) ? data.Rows.Count.ToString() : "0";
            query.status         = ShareActivityStatus.In;
            data                 = (DataTable)ShareActHelper.Query(query).Data;
            this.lblIn.Text      = (data != null) ? data.Rows.Count.ToString() : "0";
            query.status         = ShareActivityStatus.End;
            data                 = (DataTable)ShareActHelper.Query(query).Data;
            this.lblEnd.Text     = (data != null) ? data.Rows.Count.ToString() : "0";
            query.status         = ShareActivityStatus.unBegin;
            data                 = (DataTable)ShareActHelper.Query(query).Data;
            this.lblUnBegin.Text = (data != null) ? data.Rows.Count.ToString() : "0";
        }
Exemple #2
0
        protected void lkDelete_Click(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请先选择活动!", false);
                return;
            }
            if (text.Length > 1)
            {
                text = text.TrimStart(new char[]
                {
                    ','
                }).TrimEnd(new char[]
                {
                    ','
                });
            }
            string[] array = text.Split(new char[]
            {
                ','
            });
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string s = array2[i];
                ShareActHelper.Delete(int.Parse(s));
            }
            this.ShowMsg("批量删除成功!", true);
            this.BindData();
        }
Exemple #3
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;
         }
     }
 }
Exemple #4
0
        private void CountTotal(string name)
        {
            ShareActivitySearch shareActivitySearch = new ShareActivitySearch();

            shareActivitySearch.status     = ShareActivityStatus.All;
            shareActivitySearch.IsCount    = true;
            shareActivitySearch.PageIndex  = this.pager1.PageIndex;
            shareActivitySearch.PageSize   = this.pager1.PageSize;
            shareActivitySearch.SortBy     = "Id";
            shareActivitySearch.SortOrder  = SortAction.Desc;
            shareActivitySearch.CouponName = name;
            DbQueryResult dbQueryResult = ShareActHelper.Query(shareActivitySearch);

            System.Data.DataTable dataTable = (System.Data.DataTable)dbQueryResult.Data;
            this.lblAll.Text           = ((dataTable != null) ? dataTable.Rows.Count.ToString() : "0");
            shareActivitySearch.status = ShareActivityStatus.In;
            dbQueryResult              = ShareActHelper.Query(shareActivitySearch);
            dataTable                  = (System.Data.DataTable)dbQueryResult.Data;
            this.lblIn.Text            = ((dataTable != null) ? dataTable.Rows.Count.ToString() : "0");
            shareActivitySearch.status = ShareActivityStatus.End;
            dbQueryResult              = ShareActHelper.Query(shareActivitySearch);
            dataTable                  = (System.Data.DataTable)dbQueryResult.Data;
            this.lblEnd.Text           = ((dataTable != null) ? dataTable.Rows.Count.ToString() : "0");
            shareActivitySearch.status = ShareActivityStatus.unBegin;
            dbQueryResult              = ShareActHelper.Query(shareActivitySearch);
            dataTable                  = (System.Data.DataTable)dbQueryResult.Data;
            this.lblUnBegin.Text       = ((dataTable != null) ? dataTable.Rows.Count.ToString() : "0");
        }
Exemple #5
0
 private void grdDate_ItemCommand(object sender, RepeaterCommandEventArgs e)
 {
     if ((e.CommandName == "Delete") && !string.IsNullOrEmpty(e.CommandArgument.ToString()))
     {
         ShareActHelper.Delete(int.Parse(e.CommandArgument.ToString()));
         this.BindData();
     }
 }
        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("分享助力");
        }
Exemple #7
0
 private void grdDate_ItemCommand(object sender, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         if (string.IsNullOrEmpty(e.CommandArgument.ToString()))
         {
             return;
         }
         ShareActHelper.Delete(int.Parse(e.CommandArgument.ToString()));
         this.BindData();
     }
 }
Exemple #8
0
        protected void lkDelete_Click(object sender, EventArgs e)
        {
            string text = this.txt_Ids.Text;

            this.txt_Ids.Text = "";
            int i = 0;

            if (text.bInt(ref i))
            {
                ShareActHelper.Delete(i);
                this.BindData();
            }
        }
Exemple #9
0
        protected void DelBtn_Click(object sender, EventArgs e)
        {
            string text = this.txt_Ids.Text;

            this.txt_Ids.Text = "";
            if (text.Length > 1)
            {
                text = text.TrimStart(new char[] { ',' }).TrimEnd(new char[] { ',' });
            }
            foreach (string str2 in text.Split(new char[] { ',' }))
            {
                ShareActHelper.Delete(int.Parse(str2));
            }
            this.BindData();
            this.ShowMsg("批量删除成功!", true);
        }
Exemple #10
0
        private void BindData()
        {
            string        text          = this.txt_name.Text.Trim();
            DbQueryResult dbQueryResult = ShareActHelper.Query(new ShareActivitySearch
            {
                status     = this.status,
                IsCount    = true,
                PageIndex  = this.pager1.PageIndex,
                PageSize   = this.pager1.PageSize,
                SortBy     = "Id",
                SortOrder  = SortAction.Desc,
                CouponName = text
            });

            System.Data.DataTable dataSource = (System.Data.DataTable)dbQueryResult.Data;
            this.grdDate.DataSource = dataSource;
            this.grdDate.DataBind();
            this.pager1.TotalRecords = dbQueryResult.TotalRecords;
            this.CountTotal(text);
        }
Exemple #11
0
        private void BindData()
        {
            string name = this.txt_name.Text.Trim();
            ShareActivitySearch query = new ShareActivitySearch {
                status     = this.status,
                IsCount    = true,
                PageIndex  = this.pager1.PageIndex,
                PageSize   = this.pager1.PageSize,
                SortBy     = "Id",
                SortOrder  = SortAction.Desc,
                CouponName = name
            };
            DbQueryResult result = ShareActHelper.Query(query);
            DataTable     data   = (DataTable)result.Data;

            this.grdDate.DataSource = data;
            this.grdDate.DataBind();
            this.pager1.TotalRecords = result.TotalRecords;
            this.CountTotal(name);
        }
Exemple #12
0
        protected void lkDelete_Click(object sender, EventArgs e)
        {
            string str = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(str))
            {
                this.ShowMsg("请先选择活动!", false);
            }
            else
            {
                if (str.Length > 1)
                {
                    str = str.TrimStart(new char[] { ',' }).TrimEnd(new char[] { ',' });
                }
                foreach (string str2 in str.Split(new char[] { ',' }))
                {
                    ShareActHelper.Delete(int.Parse(str2));
                }
                this.ShowMsg("批量删除成功!", true);
                this.BindData();
            }
        }
Exemple #13
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text = base.Request.QueryString.Get("orderId");

            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            System.Collections.Generic.List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(text);
            if (orderMarkingOrderInfo.Count == 0)
            {
                return;
            }
            decimal d = 0m;

            foreach (OrderInfo current in orderMarkingOrderInfo)
            {
                if (current.BargainDetialId > 0)
                {
                    string text2 = BargainHelper.IsCanBuyByBarginDetailId(current.BargainDetialId);
                    if (text2 != "1")
                    {
                        current.OrderStatus = OrderStatus.Closed;
                        current.CloseReason = text2;
                        OrderHelper.UpdateOrder(current);
                        base.Response.Write("<script>alert('" + text2 + ",订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                        base.Response.End();
                        return;
                    }
                }
                else
                {
                    foreach (LineItemInfo current2 in current.LineItems.Values)
                    {
                        if (!ProductHelper.GetProductHasSku(current2.SkuId, current2.Quantity))
                        {
                            current.OrderStatus = OrderStatus.Closed;
                            current.CloseReason = "库存不足";
                            OrderHelper.UpdateOrder(current);
                            base.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                            base.Response.End();
                            return;
                        }
                    }
                }
                d += current.GetTotal();
            }
            PackageInfo packageInfo = new PackageInfo();

            packageInfo.Body       = text;
            packageInfo.NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host);
            packageInfo.OutTradeNo = text;
            packageInfo.TotalFee   = (int)(d * 100m);
            if (packageInfo.TotalFee < 1m)
            {
                packageInfo.TotalFee = 1m;
            }
            string     openId        = "";
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                openId = currentMember.OpenId;
            }
            packageInfo.OpenId = openId;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            PayClient    payClient;

            if (masterSettings.EnableSP)
            {
                payClient = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
            }
            else
            {
                payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
            }
            if (payClient.checkSetParams(out this.CheckValue))
            {
                if (!payClient.checkPackage(packageInfo, out this.CheckValue))
                {
                    return;
                }
                PayRequestInfo payRequestInfo = payClient.BuildPayRequest(packageInfo);
                this.pay_json = this.ConvertPayJson(payRequestInfo);
                if (!payRequestInfo.package.ToLower().StartsWith("prepay_id=wx"))
                {
                    this.CheckValue = payRequestInfo.package;
                }
                System.Data.DataTable shareActivity = ShareActHelper.GetShareActivity();
                int     num = 0;
                decimal d2  = 0m;
                if (shareActivity.Rows.Count > 0)
                {
                    for (int i = 0; i < shareActivity.Rows.Count; i++)
                    {
                        if (d != 0m && d >= decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString()))
                        {
                            num = int.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["Id"].ToString());
                            d2  = decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString());
                            break;
                        }
                        if (d != 0m && d <= decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString()))
                        {
                            num = int.Parse(shareActivity.Rows[0]["Id"].ToString());
                            d2  = decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString());
                            break;
                        }
                        if (d != 0m && d >= decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString()))
                        {
                            num = int.Parse(shareActivity.Rows[i]["Id"].ToString());
                            d2  = decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString());
                        }
                    }
                    if (d >= d2)
                    {
                        this.shareid = num;
                    }
                }
                return;
            }
        }
Exemple #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = base.Request.QueryString.Get("orderId");

            if (!string.IsNullOrEmpty(str))
            {
                List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(str, true);
                if (orderMarkingOrderInfo.Count != 0)
                {
                    PayClient client;
                    decimal   num = 0M;
                    if (orderMarkingOrderInfo[0].UserId != 0)
                    {
                        foreach (OrderInfo info in orderMarkingOrderInfo)
                        {
                            if (info.BargainDetialId > 0)
                            {
                                string str2 = BargainHelper.IsCanBuyByBarginDetailId(info.BargainDetialId);
                                if (str2 != "1")
                                {
                                    info.OrderStatus = OrderStatus.Closed;
                                    info.CloseReason = str2;
                                    OrderHelper.UpdateOrder(info);
                                    base.Response.Write("<script>alert('" + str2 + ",订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                                    base.Response.End();
                                    return;
                                }
                            }
                            else
                            {
                                foreach (LineItemInfo info2 in info.LineItems.Values)
                                {
                                    if (!ProductHelper.GetProductHasSku(info2.SkuId, info2.Quantity))
                                    {
                                        info.OrderStatus = OrderStatus.Closed;
                                        info.CloseReason = "库存不足";
                                        OrderHelper.UpdateOrder(info);
                                        base.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                                        base.Response.End();
                                        return;
                                    }
                                }
                            }
                            num += info.GetCashPayMoney();
                        }
                    }
                    else
                    {
                        num = orderMarkingOrderInfo[0].Amount;
                    }
                    PackageInfo package = new PackageInfo {
                        Body       = str,
                        NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host),
                        OutTradeNo = str,
                        TotalFee   = (int)(num * 100M)
                    };
                    if (package.TotalFee < 1M)
                    {
                        package.TotalFee = 1M;
                    }


                    string     openId        = "";
                    MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                    if (currentMember != null)
                    {
                        openId = currentMember.OpenId;
                    }
                    package.OpenId = openId;
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                    if (masterSettings.EnableSP)
                    {
                        client = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
                    }
                    else
                    {
                        client = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
                    }
                    if (client.checkSetParams(out this.CheckValue) && client.checkPackage(package, out this.CheckValue))
                    {
                        PayRequestInfo req = client.BuildPayRequest(package);
                        this.pay_json = this.ConvertPayJson(req);
                        if (!req.package.ToLower().StartsWith("prepay_id=wx"))
                        {
                            this.CheckValue = req.package;
                        }
                        DataTable shareActivity = ShareActHelper.GetShareActivity();
                        int       num2          = 0;
                        decimal   num3          = 0M;
                        if (shareActivity.Rows.Count > 0)
                        {
                            for (int i = 0; i < shareActivity.Rows.Count; i++)
                            {
                                if ((num != 0M) && (num >= decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString())))
                                {
                                    num2 = int.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["Id"].ToString());
                                    num3 = decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString());
                                    break;
                                }
                                if ((num != 0M) && (num <= decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString())))
                                {
                                    num2 = int.Parse(shareActivity.Rows[0]["Id"].ToString());
                                    num3 = decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString());
                                    break;
                                }
                                if ((num != 0M) && (num >= decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString())))
                                {
                                    num2 = int.Parse(shareActivity.Rows[i]["Id"].ToString());
                                    num3 = decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString());
                                }
                            }
                            if (num >= num3)
                            {
                                this.shareid = num2;
                            }
                        }
                    }
                }
            }
        }
Exemple #15
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");
             }
         }
     }
 }
Exemple #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = base.Request.QueryString.Get("orderId");

            if (!string.IsNullOrEmpty(str))
            {
                List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(str);
                if (orderMarkingOrderInfo.Count != 0)
                {
                    decimal num = 0M;
                    foreach (OrderInfo info in orderMarkingOrderInfo)
                    {
                        num += info.GetTotal();
                    }
                    PackageInfo package = new PackageInfo {
                        Body       = str,
                        NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host),
                        OutTradeNo = str,
                        TotalFee   = (int)(num * 100M)
                    };
                    if (package.TotalFee < 1M)
                    {
                        package.TotalFee = 1M;
                    }
                    string     openId        = "";
                    MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                    if (currentMember != null)
                    {
                        openId = currentMember.OpenId;
                    }
                    package.OpenId = openId;
                    wid            = currentMember.wid;
                    //SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    Chenduo.Model.sf_website website = new Chenduo.BLL.sf_website().GetModelByWid(wid);
                    //PayRequestInfo req = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey).BuildPayRequest(package);
                    PayRequestInfo req = new PayClient(wid, website.appid, website.appsecret, website.weixin_pay_account, website.account_pay_key, "").BuildPayRequest(package);
                    this.pay_json = this.ConvertPayJson(req);
                    DataTable shareActivity = ShareActHelper.GetShareActivity();
                    int       num2          = 0;
                    decimal   num3          = 0M;
                    if (shareActivity.Rows.Count > 0)
                    {
                        for (int i = 0; i < shareActivity.Rows.Count; i++)
                        {
                            if ((num != 0M) && (num >= decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString())))
                            {
                                num2 = int.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["Id"].ToString());
                                num3 = decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString());
                                break;
                            }
                            if ((num != 0M) && (num <= decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString())))
                            {
                                num2 = int.Parse(shareActivity.Rows[0]["Id"].ToString());
                                num3 = decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString());
                                break;
                            }
                            if ((num != 0M) && (num >= decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString())))
                            {
                                num2 = int.Parse(shareActivity.Rows[i]["Id"].ToString());
                                num3 = decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString());
                            }
                        }
                        if (num >= num3)
                        {
                            this.shareid = num2;
                        }
                    }
                }
            }
        }
Exemple #17
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("获取优惠券");
            }
        }
Exemple #18
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("分享助力");
        }
Exemple #19
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("获取优惠券");
        }
Exemple #20
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");
        }