コード例 #1
0
ファイル: main.aspx.cs プロジェクト: fubendong/--CTCRM
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!Page.IsPostBack)
         {
             userName     = Users.Nick == null ? "美国佐敦飞人" : Users.Nick;
             orderVersion = string.IsNullOrEmpty(Users.OrderVersion) ? "最高版本" : Users.OrderVersion.ToString();
             deadline     = Users.Deadline == null ? "当前" : Users.Deadline;
         }
         DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick);
         if (tb != null && tb.Rows.Count > 0)
         {
             msgCount = tb.Rows[0]["msgCanUseCount"].ToString() + "条";
         }
         else
         {
             msgCount = "0条";
         }
     }
     catch (Exception ex)
     {
         ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
     }
 }
コード例 #2
0
        private void MsgDataBind()
        {
            var checkIsExit = MsgBLL.CheckSellerMsgTransIsExit(Users.Nick);

            if (String.IsNullOrEmpty(checkIsExit) || !Convert.ToBoolean(checkIsExit))//账户未开通
            {
                imgMsgISCanUse.ImageUrl = "../Images/cannotuse.png";
                imgMsgISCanUse.ToolTip  = "短信账户尚未开通";
            }
            else
            {//账户开通
                imgMsgISCanUse.ImageUrl = "../Images/canuse.png";
                imgMsgISCanUse.ToolTip  = "短信账户已开通";
            }
            DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick);

            if (tb != null && tb.Rows.Count > 0)
            {
                lbMsgCanUseCount.Text = tb.Rows[0]["msgCanUseCount"].ToString() + "条";
            }
            else
            {
                lbMsgCanUseCount.Text = "0条";
            }
        }
コード例 #3
0
        private void MsgDataBind()
        {
            grdHisMsg.DataSource = MsgBLL.GetMsgHisByNick(Users.Nick);
            grdHisMsg.DataBind();

            var checkIsExit = MsgBLL.CheckSellerMsgTransIsExit(Users.Nick);

            if (String.IsNullOrEmpty(checkIsExit) || !Convert.ToBoolean(checkIsExit))//账户未开通
            {
                MsgISCanUse.Text = "未开通";
            }
            else
            {//账户开通
                MsgISCanUse.Text = "已开通";
            }
            DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick);

            if (tb != null && tb.Rows.Count > 0)
            {
                lbMsgCanUseCount.Text = tb.Rows[0]["msgCanUseCount"].ToString() + "条";
            }
            else
            {
                lbMsgCanUseCount.Text = "0条";
            }
        }
コード例 #4
0
        /// <summary>
        /// 获取用户短信条数
        /// </summary>
        /// <param name="nick"></param>
        /// <returns></returns>
        string getMsgCountByNick()
        {
            DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick);

            if (tb != null && tb.Rows.Count > 0)
            {
                return(tb.Rows[0]["msgCanUseCount"].ToString());
            }
            return("0");
        }
コード例 #5
0
ファイル: index.aspx.cs プロジェクト: fubendong/--CTCRM
        private void GetMsgCount()
        {
            DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick);

            if (tb != null && tb.Rows.Count > 0)
            {
                lbMsgCount.Text = "剩余短信:" + tb.Rows[0]["msgCanUseCount"].ToString() + "条";
            }
            else
            {
                lbMsgCount.Text = "剩余短信:0条";
            }
        }
コード例 #6
0
ファイル: main.aspx.cs プロジェクト: fubendong/--CTCRM
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    //var result = SellersBLL.CheckSeller();
                    //if (result == "0")
                    //{
                    //    Response.Redirect("http://container.api.taobao.com/container/transform?appkey=21088197", false);
                    //}

                    userName     = Users.Nick == null ? "未登录的用户" : Users.Nick;
                    orderVersion = string.IsNullOrEmpty(Users.OrderVersion) ? "最高版本" : Users.OrderVersion.ToString();
                    deadline     = Users.Deadline == null ? "当前" : Users.Deadline;
                    deadline     = deadline.Substring(0, 11);
                    DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick);
                    if (tb != null && tb.Rows.Count > 0)
                    {
                        msgCount = tb.Rows[0]["msgCanUseCount"].ToString() + "条";
                    }
                    else
                    {
                        msgCount = "0条";
                    }
                    string    medo = @" <div><a href='{1}'><lable style='float: left'>{0}</lable><br /></a></div>";
                    DataTable dt   = SystemMessagesBLL.QueryShowMsg();
                    if (dt == null || dt.Rows.Count <= 0)
                    {
                        return;
                    }
                    systemMsg = "";
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        systemMsg += string.Format(medo, dt.Rows[i]["SystemMsg"].ToString(), dt.Rows[i]["SystemLink"].ToString());
                    }
                }
                catch (Exception ex)
                {
                    ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
                }
            }
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //*判断卖家是否是第一次登陆,
                //将卖家信息写入DB
                if (!Page.IsPostBack)
                {
                    //初始化买家会员级别
                    DataTable tbbuyerlevel = ShopsBLL.GetBuyerGrade(Users.Nick);
                    if (tbbuyerlevel != null)
                    {
                        lbQianZai.Text      = tbbuyerlevel.Rows[0]["grade"].ToString();
                        lbCommonBuyer.Text  = tbbuyerlevel.Rows[1]["grade"].ToString();
                        lbAdvanceBuyer.Text = tbbuyerlevel.Rows[2]["grade"].ToString();
                        lbVIP.Text          = tbbuyerlevel.Rows[3]["grade"].ToString();
                        lbTopVIP.Text       = tbbuyerlevel.Rows[4]["grade"].ToString();
                    }
                    else
                    {
                        lbQianZai.Text      = "0";
                        lbCommonBuyer.Text  = "0";
                        lbAdvanceBuyer.Text = "0";
                        lbVIP.Text          = "0";
                        lbTopVIP.Text       = "0";
                    }

                    //从数据库读取最近30天活跃会员总金额排行榜
                    grdTopBuyerTradeAmount.DataSource = null;
                    grdTopBuyerTradeAmount.DataBind();
                    //获取销量最好的前10条宝贝
                    grdTopSales.DataSource = SellersBLL.GetTop10Sales(Users.Nick);
                    grdTopSales.DataBind();
                    //获取店铺统计信息
                    DataTable tbsellerStatic = ShopsBLL.GetShopeInfoStatic(Users.Nick);
                    if (tbsellerStatic != null)
                    {
                        lbTotalSales.Text = "¥" + tbsellerStatic.Rows[0]["Result_Flag"].ToString();
                        var orderCount = tbsellerStatic.Rows[1]["Result_Flag"].ToString();
                        lbOrderCount.Text = orderCount.Substring(0, orderCount.Length - 3);
                        var userCount = tbsellerStatic.Rows[2]["Result_Flag"].ToString();
                        lbUserCount.Text = userCount.Substring(0, userCount.Length - 3);
                        var orderPrice = tbsellerStatic.Rows[3]["Result_Flag"].ToString();
                        lbPerOrderPirce.Text = "¥" + orderPrice.Substring(0, orderPrice.Length - 3);

                        var newUserOrderCount = tbsellerStatic.Rows[4]["Result_Flag"].ToString();
                        lbNewUserOrderCount.Text = newUserOrderCount.Substring(0, newUserOrderCount.Length - 3);

                        var newBuyerCount = tbsellerStatic.Rows[4]["Result_Flag"].ToString();
                        lbNewBuyerCount.Text = newBuyerCount.Substring(0, newBuyerCount.Length - 3);
                        var refundOrderCount = tbsellerStatic.Rows[5]["Result_Flag"].ToString();
                        lbRefundOrderCount.Text = refundOrderCount.Substring(0, refundOrderCount.Length - 3);
                        var qianzaiBuyerCount = tbsellerStatic.Rows[6]["Result_Flag"].ToString();
                        QianZaiBuyerCount.Text = qianzaiBuyerCount.Substring(0, qianzaiBuyerCount.Length - 3);
                        var threeMonthsNoLoginCount = tbsellerStatic.Rows[7]["Result_Flag"].ToString();
                        lb3MonthsNoLoginCount.Text = threeMonthsNoLoginCount.Substring(0, threeMonthsNoLoginCount.Length - 3);
                        var oldBuyerCount = tbsellerStatic.Rows[8]["Result_Flag"].ToString();
                        if (oldBuyerCount.Length > 0)
                        {
                            lbOldBuyerCount.Text = oldBuyerCount.Substring(0, oldBuyerCount.Length - 3);
                        }
                        else
                        {
                            lbOldBuyerCount.Text = "0";
                        }
                    }
                    else
                    {
                        lbTotalSales.Text          = "0";
                        lbOrderCount.Text          = "0";
                        lbUserCount.Text           = "0";
                        lbPerOrderPirce.Text       = "0";
                        lbNewUserOrderCount.Text   = "0";
                        lbRefundOrderCount.Text    = "0";
                        lbNewBuyerCount.Text       = "0";
                        QianZaiBuyerCount.Text     = "0";
                        lb3MonthsNoLoginCount.Text = "0";
                        lbOldBuyerCount.Text       = "0";
                    }

                    //左上角店铺信息初始化
                    DataTable tbShop = ShopsBLL.GetSellerShopInfo(Users.Nick);
                    if (tbShop != null && tbShop.Rows.Count > 0)
                    {
                        shopImg.ImageUrl = "http://logo.taobao.com/shop-logo" + tbShop.Rows[0]["pic_path"].ToString().Trim();
                        lbNickName.Text  = Users.Nick;
                        string shopName = tbShop.Rows[0]["title"].ToString().Trim();
                        if (shopName.Length > 10)
                        {
                            shopName = shopName.Substring(0, shopName.Length - 1) + "...";
                        }
                        lbShopName.Text     = shopName;
                        Session["ShopName"] = lbShopName.Text;
                        //订购服务到期时间
                        //ArticleUserSubscribe userSub = Users.GetDeadLineDate("ts-1811102", Users.Nick);
                        lbUptoDate.Text = "";    //userSub == null ? DateTime.Now.AddMonths(1).ToShortDateString() : Convert.ToDateTime(userSub.Deadline).ToShortDateString();
                    }
                    DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick);
                    if (tb != null && tb.Rows.Count > 0)
                    {
                        lbUnUseMsgCount.Text = tb.Rows[0]["msgCanUseCount"].ToString() + "条";
                    }
                    else
                    {
                        lbUnUseMsgCount.Text = "0条";
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
            }
        }
コード例 #8
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var command = context.Request.Form["command"];

            if (!string.IsNullOrEmpty(command))
            {
                switch (command)
                {
                    #region msgConSave
                case "msgConSave":
                {
                    string content = context.Request.Form["msgContent"];
                    if (MsgBLL.UpdateSellerCusMsgContent(Users.Nick, content))
                    {
                        context.Response.Write("1");
                    }
                    else
                    {
                        context.Response.Write("0");
                    }
                    context.Response.End();
                }
                break;
                    #endregion

                    #region getConSave
                case "getConSave":
                {
                    string content = MsgBLL.GetSellerSendMsgCusContent(Users.Nick);
                    context.Response.Write(content);
                    context.Response.End();
                }
                break;
                    #endregion

                    #region sendTestMsg
                case "sendTestMsg":
                {
                    string   sigNames   = SellersBLL.GetSignName(Users.Nick);
                    string   sigName    = "【" + SellersBLL.GetSignName(Users.Nick) + "】";
                    string   phoneNo    = context.Request.Form["phone"];
                    string   content    = context.Request.Form["content"];
                    string[] noWenmings = new string[] { "傻逼", "草", "靠", "黄片", "尼玛", "你妈", "屌丝", "逗比", "你妹", "装逼", "妈蛋", "逼格", "撕逼", "卧草", "我日", "我擦"
                                                         , "滚粗", "蛋疼", "婊砸", "跪舔", "婊", "碧池", "土肥圆", "矮穷挫" };
                    for (int s = 0; s < noWenmings.Length - 1; s++)
                    {
                        if (content.IndexOf(noWenmings[s]) > 0)
                        {
                            context.Response.Write("6");
                            HttpContext.Current.ApplicationInstance.CompleteRequest();
                            return;
                        }
                    }
                    if (Utility.IsCellPhone(phoneNo))
                    {
                        if (MsgBLL.CheckSellerMsgStatus())
                        {
                            string msgContent = content.Trim() + " 退订回N";
                            //string msgContent = "";
                            //if (RatingBLL.isBshop(Users.Nick))
                            //{
                            //    msgContent = "【天猫】"+ content.Trim() + " 退订N";
                            //}
                            //else
                            //{
                            //    msgContent = "【淘宝】"+ content.Trim() + " 退订N";
                            //}

                            MsgSendHis objHis = new MsgSendHis();
                            //objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + phoneNo;//手机号码
                            objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + phoneNo;        //手机号码 2016 yao c
                            objHis.SellerNick  = Users.Nick;
                            objHis.Buyer_nick  = "*****";
                            objHis.CellPhone   = phoneNo;
                            objHis.SendDate    = DateTime.Now;
                            objHis.SendType    = "自测短信";
                            objHis.SendStatus  = "0";
                            objHis.Count       = "1";
                            objHis.MsgContent  = sigName + msgContent;
                            if (Utility.IsYiDongCellPhoneNo(phoneNo))
                            {
                                objHis.HelpSellerNick = "移动";
                            }
                            if (SmartBLL.AddMsgSendHis(objHis))
                            {
                                //把号码添加到测试池
                                SmartBLL.AddMsgSendHisIntoTestTable(Users.Nick, phoneNo);
                                if (Convert.ToInt32(msgContent.Trim().Length) <= 70)
                                {
                                    MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1);
                                }
                                else if (Convert.ToInt32(msgContent.Trim().Length) > 70 && Convert.ToInt32(msgContent.Trim().Length) <= 134)
                                {
                                    MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2);
                                }
                                else if (Convert.ToInt32(msgContent.Trim().Length) > 134 && Convert.ToInt32(msgContent.Trim().Length) <= 195)
                                {
                                    MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3);
                                }
                                else if (Convert.ToInt32(msgContent.Trim().Length) > 195 && Convert.ToInt32(msgContent.Trim().Length) <= 260)
                                {
                                    MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4);
                                }
                                string sendStatus = "0";
                                if (Utility.IsYiDongCellPhoneNo(phoneNo))
                                {
                                    sendStatus = TBSendMSg.SendMsg(phoneNo, sigNames, objHis.MsgContent.Replace(sigName, ""));
                                    //sendStatus = Mobile.SendMsgHubeiYDPost(phoneNo, msgContent);
                                    //sendStatus = sendStatus.Replace("\r", "").Replace("\n", "");
                                    if (sendStatus.Equals("0"))
                                    {
                                        sendStatus = "100";
                                    }
                                    //sendStatus = Mobile.sendMsgJiuFang(phoneNo, msgContent,"100057", "c9bf7c4cb27c5527c4d757765514498e");//20160621 yao
                                    //更新发送状态
                                    SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber);
                                    //sendStatus = Mobile.SendMsgZhuTongYD(phoneNo, msgContent);
                                }
                                else
                                {
                                    sendStatus = TBSendMSg.SendMsg(phoneNo, sigNames, objHis.MsgContent.Replace(sigName, ""));
                                    //sendStatus = Mobile.PostDataToMyServer(phoneNo, msgContent);
                                    //IDictionary resultDic = null;
                                    //resultDic = TopUtils.ParseJson(sendStatus);
                                    //string realStaus = resultDic["status"].ToString();
                                    //更新发送状态
                                    SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber);
                                    //sendStatus = Mobile.SendMsgKeTongDX(phoneNo, msgContent);
                                }

                                context.Response.Write("发送成功");
                            }
                            else
                            {
                                context.Response.Write("发送阻塞");
                            }
                        }
                        else
                        {
                            context.Response.Write("余额不足");
                            //更新短信账户状态
                            MsgBLL.UpdateMsgTransServiceStatus(Users.Nick, false);
                        }
                    }
                    else
                    {
                        context.Response.Write("手机号码格式不正确");
                    }
                    context.Response.End();
                }
                break;
                    #endregion

                    #region sendMsg
                case "sendMsg":
                {
                    string   content    = context.Request.Form["content"];
                    string[] noWenmings = new string[] { "傻逼", "草", "靠", "黄片", "尼玛", "你妈", "屌丝", "逗比", "你妹", "装逼", "妈蛋", "逼格", "撕逼"
                                                         , "滚粗", "蛋疼", "婊砸", "跪舔", "婊", "碧池", "土肥圆", "矮穷挫" };
                    for (int s = 0; s < noWenmings.Length - 1; s++)
                    {
                        if (content.IndexOf(noWenmings[s]) > 0)
                        {
                            context.Response.Write("6");
                            HttpContext.Current.ApplicationInstance.CompleteRequest();
                            return;
                        }
                    }
                    //控制是否过滤移动号码
                    string     flag         = context.Request.Form["falg"];
                    string     signShopName = SellersBLL.GetSignName(Users.Nick);
                    MsgSendHis objHis       = null;
                    string     msgContent   = "【" + signShopName + "】" + content.Trim() + " 退订回N";
                    DataTable  tb           = HttpContext.Current.Session["MsgData"] as DataTable;
                    if (tb != null && tb.Rows.Count > 0)
                    {
                        for (int i = 0; i < tb.Rows.Count; i++)
                        {
                            try
                            {
                                BlakList objbk = new BlakList();
                                objbk.SellerNick = Users.Nick;
                                objbk.BlakName   = tb.Rows[i]["buyer_nick"].ToString();
                                //黑名单
                                if (!BlcakLstBLL.ChekBlaklist(objbk))
                                {
                                    var cellpone = tb.Rows[i]["cellPhone"].ToString();
                                    if (Utility.IsCellPhone(cellpone) && !string.IsNullOrEmpty(cellpone))
                                    {
                                        #region 短信发送
                                        if (MsgBLL.CheckSellerMsgStatus())
                                        {
                                            objHis = new MsgSendHis();
                                            //objHis.TransNumber = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString()
                                            //                     + DateTime.Now.Day.ToString() + cellpone;
                                            objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellpone;            //手机号码 2016 yao c
                                            objHis.SellerNick  = Users.Nick;
                                            objHis.Buyer_nick  = tb.Rows[i]["buyer_nick"].ToString();
                                            objHis.CellPhone   = cellpone;
                                            objHis.SendDate    = DateTime.Now;
                                            objHis.SendType    = "短信促销";
                                            objHis.SendStatus  = "0";
                                            objHis.Count       = "1";
                                            objHis.MsgContent  = msgContent;
                                            if (Utility.IsYiDongCellPhoneNo(cellpone))
                                            {
                                                objHis.HelpSellerNick = "移动";
                                            }
                                            else
                                            {
                                                objHis.HelpSellerNick = "电信联通";
                                            }
                                            if (SmartBLL.AddMsgSendHis(objHis))
                                            {
                                                try
                                                {
                                                    //string sendStatus = Mobile.sendMsg(lstCellPhoneNo, msgContent);
                                                    if (Convert.ToInt32(msgContent.Trim().Length) <= 70)
                                                    {
                                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1);
                                                    }
                                                    else if (Convert.ToInt32(msgContent.Trim().Length) > 70 && Convert.ToInt32(msgContent.Trim().Length) <= 134)
                                                    {
                                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2);
                                                    }
                                                    else if (Convert.ToInt32(msgContent.Trim().Length) > 134 && Convert.ToInt32(msgContent.Trim().Length) <= 195)
                                                    {
                                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3);
                                                    }
                                                    else if (Convert.ToInt32(msgContent.Trim().Length) > 195 && Convert.ToInt32(msgContent.Trim().Length) <= 260)
                                                    {
                                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4);
                                                    }
                                                    if (Utility.IsYiDongCellPhoneNo(cellpone))
                                                    {
                                                        //string sendStatus = Mobile.SendMsgHuBeiYD(cellpone, msgContent);
                                                        //string sendStatus = Mobile.sendMsgJiuFang(cellpone, msgContent, "100057", "c9bf7c4cb27c5527c4d757765514498e");//20160625 yao
                                                        string sendStatus = Mobile.SendMsgHubeiYDPost(cellpone, msgContent);
                                                        sendStatus = sendStatus.Replace("\r", "").Replace("\n", "");
                                                        if (sendStatus.Equals("0"))
                                                        {
                                                            sendStatus = "100";
                                                        }
                                                        SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber);
                                                    }
                                                    else                //电信联通号码全部群发
                                                    {
                                                        string      sendStatus = Mobile.PostDataToMyServer(cellpone, msgContent.Trim());
                                                        IDictionary resultDic  = TopUtils.ParseJson(sendStatus);
                                                        SmartBLL.UpdateSendStatus(resultDic["status"].ToString(), objHis.TransNumber);
                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    //ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
                                                    continue;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            //更新短信账户状态
                                            MsgBLL.UpdateMsgTransServiceStatus(Users.Nick, false);
                                            context.Response.Write("余额不足");
                                            context.Response.End();
                                            break;
                                        }
                                        #endregion
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                continue;
                            }
                        }
                        HttpContext.Current.Session["MsgData"] = null;
                        //发送成功
                        context.Response.Write("发送成功");
                        context.Response.End();
                    }
                    else
                    {
                        context.Response.Write("没有会员");
                        context.Response.End();
                    }
                }
                break;
                    #endregion

                    #region sendSmartMsg
                case "sendSmartMsg":
                {
                    string     content    = context.Request.Form["content"];
                    string     sendType   = context.Request.Form["sendType"];
                    string     province   = context.Request.Form["provinces"];
                    MsgSendHis objHis     = null;
                    string     msgContent = "【" + SellersBLL.GetSignName(Users.Nick) + "】" + content.Trim() + " 退订回N";
                    //if (RatingBLL.isBshop(Users.Nick))
                    //{
                    //    msgContent = "【天猫】" + content.Trim() + " 退订N";
                    //}
                    //else
                    //{
                    //    msgContent = "【淘宝】" + content.Trim() + " 退订N";
                    //}
                    DataTable tb = null;

                    #region 新会员
                    if (sendType.Equals("10"))
                    {
                        tb = SmartBLL.GetNewBuyer10Days(Users.SellerId);
                    }
                    if (sendType.Equals("30"))
                    {
                        tb = SmartBLL.GetNewBuyer30Days(Users.SellerId);
                    }
                    #endregion

                    #region 会员等级
                    if (sendType.Equals("puTongBuyer"))
                    {
                        tb = SmartBLL.GetBuyersCount(1, Users.SellerId);
                    }
                    if (sendType.Equals("gaoJiBuyer"))
                    {
                        tb = SmartBLL.GetBuyersCount(2, Users.SellerId);
                    }
                    if (sendType.Equals("vipBuyer"))
                    {
                        tb = SmartBLL.GetBuyersCount(3, Users.SellerId);
                    }
                    if (sendType.Equals("gaoJiVIPBuyer"))
                    {
                        tb = SmartBLL.GetBuyersCount(4, Users.SellerId);
                    }
                    #endregion

                    #region 活跃度
                    if (sendType.Equals("HuoYueDiGouMaiQiang"))
                    {
                        tb = SmartBLL.GetHuoYueDiGouMaiQiangBuyersCount(Users.SellerId);
                    }
                    if (sendType.Equals("HuoYueBanGouMaiBan"))
                    {
                        tb = SmartBLL.GetHuoYueBanGouMaiBanBuyersCount(Users.SellerId);
                    }
                    if (sendType.Equals("HuoYueGaoGouMaiBan"))
                    {
                        tb = SmartBLL.GetHuoYueGaoGouMaiBanBuyersCount(Users.SellerId);
                    }
                    if (sendType.Equals("HuoYueGaoGouMaiGao"))
                    {
                        tb = SmartBLL.GetHuoYueGaoGouMaiGaoBuyersCount(Users.SellerId);
                    }
                    #endregion

                    #region 节假日
                    if (sendType.Equals("yuandan"))
                    {
                        string date  = DateTime.Now.AddYears(-1).Year.ToString() + "-01-01";
                        string date2 = DateTime.Now.Year.ToString() + "-01-01";
                        tb = SmartBLL.GetHuoDongBuyersCount(date, Users.SellerId, date2);
                    }
                    if (sendType.Equals("qinren"))
                    {
                        string date2  = DateTime.Now.AddYears(-1).Year.ToString() + "-02-14";
                        string date22 = DateTime.Now.Year.ToString() + "-02-14";
                        tb = SmartBLL.GetHuoDongBuyersCount(date2, Users.SellerId, date22);
                    }
                    if (sendType.Equals("funv"))
                    {
                        string date3  = DateTime.Now.AddYears(-1).Year.ToString() + "-03-18";
                        string date33 = DateTime.Now.Year.ToString() + "-03-18";
                        tb = SmartBLL.GetHuoDongBuyersCount(date3, Users.SellerId, date33);
                    }
                    if (sendType.Equals("wuyi"))
                    {
                        string date4  = DateTime.Now.AddYears(-1).Year.ToString() + "-05-01";
                        string date44 = DateTime.Now.Year.ToString() + "-05-01";
                        tb = SmartBLL.GetHuoDongBuyersCount(date4, Users.SellerId, date44);
                    }
                    if (sendType.Equals("fuqin"))
                    {
                        string date5  = DateTime.Now.AddYears(-1).Year.ToString() + "-06-17";
                        string date55 = DateTime.Now.Year.ToString() + "-06-17";
                        tb = SmartBLL.GetHuoDongBuyersCount(date5, Users.SellerId, date55);
                    }
                    if (sendType.Equals("qixi"))
                    {
                        string date6  = DateTime.Now.AddYears(-1).Year.ToString() + "-08-23";
                        string date66 = DateTime.Now.Year.ToString() + "-08-23";
                        tb = SmartBLL.GetHuoDongBuyersCount(date6, Users.SellerId, date66);
                    }
                    if (sendType.Equals("zhongqiu"))
                    {
                        string date7  = DateTime.Now.AddYears(-1).Year.ToString() + "-09-30";
                        string date77 = DateTime.Now.Year.ToString() + "-09-30";
                        tb = SmartBLL.GetHuoDongBuyersCount(date7, Users.SellerId, date77);
                    }
                    if (sendType.Equals("guoqing"))
                    {
                        string date8  = DateTime.Now.AddYears(-1).Year.ToString() + "-10-01";
                        string date88 = DateTime.Now.Year.ToString() + "-10-01";
                        tb = SmartBLL.GetHuoDongBuyersCount(date8, Users.SellerId, date88);
                    }
                    if (sendType.Equals("11"))
                    {
                        string date9  = DateTime.Now.AddYears(-1).Year.ToString() + "-11-11";
                        string date99 = DateTime.Now.Year.ToString() + "-11-11";
                        tb = SmartBLL.GetHuoDongBuyersCount(date9, Users.SellerId, date99);
                    }
                    if (sendType.Equals("12"))
                    {
                        string date10   = DateTime.Now.AddYears(-1).Year.ToString() + "-12-12";
                        string date1010 = DateTime.Now.Year.ToString() + "-12-12";
                        tb = SmartBLL.GetHuoDongBuyersCount(date10, Users.SellerId, date1010);
                    }
                    if (sendType.Equals("shengdan"))
                    {
                        string date11   = DateTime.Now.AddYears(-1).Year.ToString() + "-12-25";
                        string date1111 = DateTime.Now.Year.ToString() + "-12-25";
                        tb = SmartBLL.GetHuoDongBuyersCount(date11, Users.SellerId, date1111);
                    }
                    #endregion

                    #region 未交易客户营销
                    if (sendType.Equals("unpay"))
                    {
                        tb = SmartBLL.GetUnPayBuyersCount(Users.SellerId);
                    }
                    if (sendType.Equals("unpay7days"))
                    {
                        tb = SmartBLL.GetUnPay7DaysBuyersCount(Users.SellerId);
                    }
                    #endregion

                    #region 地区营销
                    if (sendType.Equals("baifang"))
                    {
                        tb = SmartBLL.GetBaiFangBuyersCount(Users.SellerId);
                    }
                    if (sendType.Equals("nanfang"))
                    {
                        tb = SmartBLL.GetNanFangBuyersCount(Users.SellerId);
                    }
                    if (sendType.Equals("province"))
                    {
                        List <string> list = new List <string>(province.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));
                        tb = SmartBLL.GetProvinceBuyersCount(Users.SellerId, list);
                    }
                    #endregion

                    if (tb != null && tb.Rows.Count > 0)
                    {
                        for (int i = 0; i < tb.Rows.Count; i++)
                        {
                            try
                            {
                                BlakList objbk = new BlakList();
                                objbk.SellerNick = Users.Nick;
                                objbk.BlakName   = tb.Rows[i]["buyer_nick"].ToString();
                                //黑名单
                                if (!BlcakLstBLL.ChekBlaklist(objbk))
                                {
                                    var cellpone = tb.Rows[i]["cellPhone"].ToString();
                                    if (Utility.IsCellPhone(cellpone) && !string.IsNullOrEmpty(cellpone))
                                    {
                                        #region 短信发送
                                        if (MsgBLL.CheckSellerMsgStatus())
                                        {
                                            objHis = new MsgSendHis();
                                            //objHis.TransNumber = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString()
                                            //                     + DateTime.Now.Day.ToString() + cellpone;
                                            objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellpone;        //手机号码 2016 yao c
                                            objHis.SellerNick  = Users.Nick;
                                            objHis.Buyer_nick  = tb.Rows[i]["buyer_nick"].ToString();
                                            objHis.CellPhone   = cellpone;
                                            objHis.SendDate    = DateTime.Now;
                                            objHis.SendType    = "智能营销";
                                            objHis.SendStatus  = "0";
                                            objHis.Count       = "1";
                                            objHis.MsgContent  = msgContent;
                                            if (Utility.IsYiDongCellPhoneNo(cellpone))
                                            {
                                                objHis.HelpSellerNick = "移动";
                                            }
                                            else
                                            {
                                                objHis.HelpSellerNick = "电信联通";
                                            }
                                            if (SmartBLL.AddMsgSendHis(objHis))
                                            {
                                                try
                                                {
                                                    if (Convert.ToInt32(msgContent.Trim().Length) <= 70)
                                                    {
                                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1);
                                                    }
                                                    else if (Convert.ToInt32(msgContent.Trim().Length) > 70 && Convert.ToInt32(msgContent.Trim().Length) <= 134)
                                                    {
                                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2);
                                                    }
                                                    else if (Convert.ToInt32(msgContent.Trim().Length) > 134 && Convert.ToInt32(msgContent.Trim().Length) <= 195)
                                                    {
                                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3);
                                                    }
                                                    else if (Convert.ToInt32(msgContent.Trim().Length) > 195 && Convert.ToInt32(msgContent.Trim().Length) <= 260)
                                                    {
                                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4);
                                                    }
                                                    if (Utility.IsYiDongCellPhoneNo(cellpone))
                                                    {
                                                        //string sendStatus = Mobile.SendMsgHuBeiYD(cellpone, msgContent);
                                                        //string sendStatus = Mobile.sendMsgJiuFang(cellpone, msgContent, "100057", "c9bf7c4cb27c5527c4d757765514498e");//20160625 yao
                                                        string sendStatus = Mobile.SendMsgHubeiYDPost(cellpone, msgContent);
                                                        sendStatus = sendStatus.Replace("\r", "").Replace("\n", "");
                                                        if (sendStatus.Equals("0"))
                                                        {
                                                            sendStatus = "100";
                                                        }
                                                        SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber);
                                                    }
                                                    else
                                                    {
                                                        string      sendStatus = Mobile.PostDataToMyServer(cellpone, msgContent.Trim());
                                                        IDictionary resultDic  = TopUtils.ParseJson(sendStatus);
                                                        SmartBLL.UpdateSendStatus(resultDic["status"].ToString(), objHis.TransNumber);
                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    //ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
                                                    continue;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            //更新短信账户状态
                                            MsgBLL.UpdateMsgTransServiceStatus(Users.Nick, false);
                                            context.Response.Write("余额不足");
                                            context.Response.End();
                                            break;
                                        }
                                        #endregion
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                continue;
                            }
                        }
                        //发送成功
                        context.Response.Write("发送成功");
                        context.Response.End();
                    }
                    else
                    {
                        context.Response.Write("没有会员");
                        context.Response.End();
                    }
                }
                break;
                    #endregion

                    #region getMsgCount
                case "getMsgCount":
                {
                    DataTable tb    = MsgBLL.GetSellerMsgStatus(Users.Nick);
                    string    count = "0";
                    if (tb != null && tb.Rows.Count > 0)
                    {
                        count = "剩余短信:" + tb.Rows[0]["msgCanUseCount"].ToString() + "条";
                    }
                    else
                    {
                        count = "剩余短信:0条";
                    }
                    context.Response.Write(count);
                    context.Response.End();
                }
                break;
                    #endregion
                }
            }
        }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    var result = SellersBLL.CheckSeller();
                    if (result == "0")
                    {
                        //Response.Redirect("http://container.api.taobao.com/container/transform?appkey=21088197", false);
                        Response.Redirect("error_root.aspx");
                    }

                    userName     = Users.Nick == null ? "未登录的用户" : Users.Nick;
                    orderVersion = string.IsNullOrEmpty(Users.OrderVersion) ? "最高版本" : Users.OrderVersion.ToString();
                    deadline     = Users.Deadline == null ? "当前" : Users.Deadline.Substring(0, 10);
                    SellersBLL.UpdateUnUseDate(deadline, userName); //20161106 yao
                    var checkIsExit = MsgBLL.CheckSellerMsgTransIsExit(Users.Nick);
                    if (String.IsNullOrEmpty(checkIsExit))          //卖家第一次订购
                    {
                        MsgPackage obj = new MsgPackage();
                        if (Users.OrderVersion == "订购一年送3000条短信")
                        {
                            obj.PackageName = "店铺管家短信套餐(淘宝)3000条";
                            obj.Type        = "永久有效";
                            obj.SellerNick  = Users.Nick;
                            obj.Price       = 0;
                            obj.PerPrice    = "0";
                            obj.Rank        = "短信套餐(赠送)";
                            obj.OrderDate   = DateTime.Now;
                            obj.PayStatus   = true;
                            MsgBLL.AddMsgPackage(obj);
                            obj.ServiceStatus   = true;
                            obj.CanUseStartDate = DateTime.Now;
                            obj.MsgCanUseCount  = 3000;
                            obj.MsgTotalCount   = 3000;
                            MsgBLL.AddMsgTrans(obj);
                        }
                        else
                        {
                            TimeSpan sp = Convert.ToDateTime(deadline) - DateTime.Now;
                            if (sp.Days > 15)
                            {
                                obj.PackageName = "店铺管家短信套餐(淘宝)200条";
                                obj.Type        = "永久有效";
                                obj.SellerNick  = Users.Nick;
                                obj.Price       = 0;
                                obj.PerPrice    = "0";
                                obj.Rank        = "短信套餐(赠送)";
                                obj.OrderDate   = DateTime.Now;
                                obj.PayStatus   = true;
                                MsgBLL.AddMsgPackage(obj);
                                obj.ServiceStatus   = true;
                                obj.CanUseStartDate = DateTime.Now;
                                obj.MsgCanUseCount  = 200;
                                obj.MsgTotalCount   = 200;
                                MsgBLL.AddMsgTrans(obj);
                            }
                            else
                            {
                                obj.PackageName = "店铺管家短信套餐(淘宝)10条";
                                obj.Type        = "永久有效";
                                obj.SellerNick  = Users.Nick;
                                obj.Price       = 0;
                                obj.PerPrice    = "0";
                                obj.Rank        = "短信套餐(赠送)";
                                obj.OrderDate   = DateTime.Now;
                                obj.PayStatus   = true;
                                MsgBLL.AddMsgPackage(obj);
                                obj.ServiceStatus   = true;
                                obj.CanUseStartDate = DateTime.Now;
                                obj.MsgCanUseCount  = 10;
                                obj.MsgTotalCount   = 10;
                                MsgBLL.AddMsgTrans(obj);
                            }
                        }

                        OpenLogistics(obj.SellerNick);
                    }
                    DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick);
                    if (tb != null && tb.Rows.Count > 0)
                    {
                        msgCount = tb.Rows[0]["msgCanUseCount"].ToString() + "条";
                    }
                    else
                    {
                        msgCount = "0条";
                    }
                    //string medo = @" <div><a href='{1}'><lable style='float: left'>{0}</lable><br /></a></div>";
                    //DataTable dt = SystemMessagesBLL.QueryShowMsg();
                    //if (dt == null || dt.Rows.Count <= 0)
                    //{ return; }
                    //systemMsg = "";
                    //for (int i = 0; i < dt.Rows.Count; i++)
                    //{

                    //    systemMsg += string.Format(medo, dt.Rows[i]["SystemMsg"].ToString(), dt.Rows[i]["SystemLink"].ToString());
                    //}
                }
                catch (Exception ex)
                {
                    ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
                }
                finally
                {
                    DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick);
                    if (tb != null && tb.Rows.Count > 0)
                    {
                        msgCount = tb.Rows[0]["msgCanUseCount"].ToString() + "条";
                    }
                    else
                    {
                        msgCount = "0条";
                    }
                }
            }
        }