Пример #1
0
        public bool IsAppPushRecordDuplicate(AppPushRecordInfo appPushRecordInfo)
        {
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand("SELECT COUNT(*) FROM Hishop_AppPushRecords WHERE PushTitle=@PushTitle AND PushContent=@PushContent AND PushTag=@PushTag AND PushSendDate>=@timeFlag");

            base.database.AddInParameter(sqlStringCommand, "PushTitle", DbType.String, appPushRecordInfo.PushTitle);
            base.database.AddInParameter(sqlStringCommand, "PushContent", DbType.String, appPushRecordInfo.PushContent);
            base.database.AddInParameter(sqlStringCommand, "PushTag", DbType.String, appPushRecordInfo.PushTag);
            base.database.AddInParameter(sqlStringCommand, "timeFlag", DbType.DateTime, DateTime.Now.AddHours(-1.0));
            return(base.database.ExecuteScalar(sqlStringCommand).ToInt(0) > 0);
        }
Пример #2
0
 protected void btnSend_Click(object sender, EventArgs e)
 {
     lock (ManualPushAgain.objLock)
     {
         AppPushRecordInfo appPushRecordInfo = VShopHelper.SendAgainAppPushRecord(this.pushRecordId);
         if (appPushRecordInfo.PushStatus.Equals(EnumPushStatus.PushFailure))
         {
             this.ShowMsg("推送失败", false);
         }
         else
         {
             this.ShowMsg("推送成功", true, "PushRecords.aspx");
         }
     }
 }
Пример #3
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            lock (ManualPush.objLock)
            {
                string text  = this.txtURL.Text.Trim();
                string str   = string.Empty;
                string text2 = this.txtPushContent.Text.Trim();
                string text3 = this.txtPushTitle.Text.Trim();
                string value = this.hidUserIds.Value;
                if (string.IsNullOrEmpty(value))
                {
                    this.ShowMsg("请选择要推送消息的会员", false);
                }
                else if (string.IsNullOrEmpty(text3))
                {
                    this.ShowMsg("请填写推送标题", false);
                }
                else if (string.IsNullOrEmpty(text2))
                {
                    this.ShowMsg("请填写推送内容", false);
                }
                else
                {
                    EnumPushType enumPushType = (EnumPushType)this.rblPushType.SelectedValue.ToInt(0);
                    switch (enumPushType)
                    {
                    case EnumPushType.Link:
                        if (string.IsNullOrEmpty(text))
                        {
                            this.ShowMsg("请填写链接", false);
                            return;
                        }
                        if (!Regex.IsMatch(text, "(http|ftp|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?"))
                        {
                            this.ShowMsg("请输入正确的链接,比如 https://www.huz.com.cn", false);
                            return;
                        }
                        str = string.Format("url{1}{0}{2}", this.txtURL.Text.Trim(), VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY);
                        break;

                    case EnumPushType.ProductTopic:
                        if (string.IsNullOrEmpty(this.topicId))
                        {
                            this.ShowMsg("请选择专题", false);
                            return;
                        }
                        str = string.Format("url{1}{0}{2}", Globals.HostPath(HttpContext.Current.Request.Url) + "/appshop/Topics?TopicId=" + this.topicId, VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY);
                        break;

                    case EnumPushType.Activity:
                        switch (this.rblActivity.SelectedValue.ToInt(0))
                        {
                        case 2:
                            str = string.Format("url{1}{0}{2}", Globals.HostPath(HttpContext.Current.Request.Url) + "/appshop/CountDownProducts.aspx", VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY);
                            break;

                        case 1:
                            str = string.Format("url{1}{0}{2}", Globals.HostPath(HttpContext.Current.Request.Url) + "/appshop/GroupBuyList.aspx", VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY);
                            break;
                        }
                        break;

                    case EnumPushType.Product:
                        if (string.IsNullOrEmpty(this.productId))
                        {
                            this.ShowMsg("请选择商品", false);
                            return;
                        }
                        str = string.Format("productid{1}{0}{2}", this.productId, VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY);
                        break;
                    }
                    DateTime now  = DateTime.Now;
                    int      num  = 14;
                    int      num2 = 20;
                    if (text3.Length > num)
                    {
                        this.ShowMsg($"推送标题不能超过{num}", false);
                    }
                    else if (text2.Length > num2)
                    {
                        this.ShowMsg($"推送内容不能超过{num2}个字", false);
                    }
                    else
                    {
                        str += string.Format("type{1}{0}{2}", (int)enumPushType, VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY);
                        AppPushRecordInfo appPushRecordInfo = new AppPushRecordInfo
                        {
                            PushType     = (int)enumPushType,
                            PushContent  = text2,
                            PushTitle    = text3,
                            SendUserIds  = value,
                            PushStatus   = 1,
                            PushSendType = 1,
                            PushSendDate = now,
                            ToAll        = false,
                            Extras       = str
                        };
                        if (VShopHelper.CheckAppPushRecordDuplicate(appPushRecordInfo))
                        {
                            this.ShowMsg("不能在一小时内推送重复的信息", false);
                        }
                        else
                        {
                            VShopHelper.AppPushRecordSendAboutAtOnce(appPushRecordInfo);
                            if (appPushRecordInfo.PushStatus.Equals(EnumPushStatus.PushFailure))
                            {
                                this.ShowMsg("推送失败", false);
                            }
                            else
                            {
                                this.ShowMsg("推送成功", true);
                            }
                        }
                    }
                }
            }
        }
Пример #4
0
        private void BindDefaultData()
        {
            AppPushRecordInfo appPushRecordInfo = VShopHelper.GetAppPushRecordInfo(this.pushRecordId);

            if (appPushRecordInfo != null)
            {
                int num = appPushRecordInfo.PushStatus;
                if (num.Equals(EnumPushStatus.NoPush))
                {
                    this.sendTitle.InnerText = "立即推送";
                }
                this.lblPushTypeText.Text       = ((Enum)(object)(EnumPushType)appPushRecordInfo.PushType).ToDescription();
                this.spanPushTypeText.InnerHtml = $"{this.lblPushTypeText.Text}:";
                this.lblPushContent.Text        = appPushRecordInfo.PushContent;
                this.lblPushTag.Text            = appPushRecordInfo.PushTagText;
                this.lblPushTitle.Text          = appPushRecordInfo.PushTitle;
                this.lblState.Text = ((Enum)(object)(EnumPushStatus)appPushRecordInfo.PushStatus).ToDescription();
                num = appPushRecordInfo.PushSendType;
                if (num.Equals(EnumPushSendType.AtOnce))
                {
                    this.lblSendType.Text = ((Enum)(object)EnumPushSendType.AtOnce).ToDescription();
                }
                else
                {
                    num = appPushRecordInfo.PushSendType;
                    if (num.Equals(EnumPushSendType.Timer))
                    {
                        this.lblSendType.Text = appPushRecordInfo.PushSendDate.ToString("yyyy-MM-dd HH:mm");
                    }
                }
                Dictionary <string, string> extras = this.GetExtras(appPushRecordInfo.Extras);
                switch (appPushRecordInfo.PushType)
                {
                case 3:
                    extras.ForEach(delegate(KeyValuePair <string, string> c)
                    {
                        if (c.Key == "url")
                        {
                            if (c.Value.IndexOf("CountDownProducts") >= 0)
                            {
                                this.lblPushTypeContext.Text = ((Enum)(object)EnumActivity.CountDownBuy).ToDescription();
                            }
                            else
                            {
                                this.lblPushTypeContext.Text = ((Enum)(object)EnumActivity.GroupBuy).ToDescription();
                            }
                        }
                    });
                    break;

                case 1:
                    extras.ForEach(delegate(KeyValuePair <string, string> c)
                    {
                        if (c.Key == "url")
                        {
                            this.lblPushTypeContext.Text = c.Value;
                        }
                    });
                    break;

                case 2:
                    extras.ForEach(delegate(KeyValuePair <string, string> c)
                    {
                        if (c.Key == "url")
                        {
                            int topicId    = 0;
                            string[] array = c.Value.Split('=');
                            if (array.Count() > 0)
                            {
                                topicId = array[1].ToInt(0);
                            }
                            TopicInfo topicInfo          = VShopHelper.Gettopic(topicId);
                            this.lblPushTypeContext.Text = ((topicInfo != null) ? topicInfo.Title : string.Empty);
                        }
                    });
                    break;

                case 4:
                    extras.ForEach(delegate(KeyValuePair <string, string> c)
                    {
                        if (c.Key == "productid")
                        {
                            int num2         = c.Value.ToInt(0);
                            IList <int> list = null;
                            Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >);
                            ProductInfo productDetails = ProductHelper.GetProductDetails(num2.ToInt(0), out dictionary, out list);
                            if (productDetails != null)
                            {
                                this.lblPushTypeContext.Text = productDetails.ProductName;
                            }
                        }
                    });
                    break;
                }
            }
        }