Ejemplo n.º 1
0
        private void searchBuyers()
        {
            string buyerNick    = txtNickName.Text.Trim();
            string status       = drpStatus.SelectedValue.ToString();
            string area         = drpArea.SelectedValue.ToString();
            string grade        = drpGrade.SelectedValue.ToString();
            string tradeAmount1 = txtMin.Text.Trim();
            string tradeAmount2 = txtMax.Text.Trim();
            string buyCount     = txtBuyCount.Text.Trim();

            if (!String.IsNullOrEmpty(Request.QueryString["type"]) && drpGroup.SelectedValue.Equals("全部"))
            {
                if (Request.QueryString["type"].ToString().Equals("newCus") && string.IsNullOrEmpty(ViewState["flag"] as string))
                {
                    drpGroup.SelectedValue = "新客户";
                }
            }
            if (!String.IsNullOrEmpty(Request.QueryString["type"]) && drpGroup.SelectedValue.Equals("全部"))
            {
                if (Request.QueryString["type"].ToString().Equals("oldCus") && string.IsNullOrEmpty(ViewState["flag"] as string))
                {
                    drpGroup.SelectedValue = "老客户";
                }
            }
            string group = drpGroup.SelectedItem.Text.ToString();

            DataTable ds = BuyerBLL.GetBuyerInfo(buyerNick, status, area, grade, group, tradeAmount1, tradeAmount2, Users.Nick, buyCount);

            AspNetPager1.RecordCount = ds.DefaultView.Count;

            this.AspNetPager1.CustomInfoHTML = string.Format("当前第{0}/{1}页 共{2}条记录 每页{3}条", new object[] { this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageCount, this.AspNetPager1.RecordCount, this.AspNetPager1.PageSize });

            PagedDataSource pds = new PagedDataSource();

            pds.DataSource       = ds.DefaultView;
            pds.AllowPaging      = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize         = AspNetPager1.PageSize;

            //根据分页情况将数据写入或者更新到数据库
            this.grdBuyer.DataSource = pds;
            this.grdBuyer.DataBind();
        }
Ejemplo n.º 2
0
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (string.IsNullOrEmpty(TextBox2.Text))
            {
                Response.Write("<script language='javascript'>alert('请输入发送内容!');</script>");
                return;
            }

            DataTable trade   = null;
            string    sigName = "【" + SellersBLL.GetSignName(Users.Nick) + "】";
            string    select  = drpSType.SelectedValue.ToString();

            switch (select)
            {
            case "sign_notSure":
                trade = TradeBLL.GetTradeData(Users.Nick, "taobao_trade_TradeSellerShip");
                break;

            case "sure_notSign":
                trade = TradeBLL.GetTradeDataNosign(Users.Nick, "taobao_trade_TradeSellerShip");
                break;

            case "sure_notSucce":
                trade = TradeBLL.GetTradeDataNoSuccess(Users.Nick, "taobao_trade_TradeSellerShip");
                break;
            }
            if (trade == null || trade.Rows.Count == 0)
            {
                Response.Write("<script language='javascript'>alert('无数据!');</script>");
                return;
            }
            for (int i = 0; i < trade.Rows.Count; i++)
            {
                DataTable ds = BuyerBLL.GetBuyerInfo(trade.Rows[i]["buyer_nick"].ToString(), "all", "all", "all", "", "", "", Users.Nick, "");
                if (ds == null || ds.Rows.Count == 0)
                {
                    continue;
                }
                string cellPhone = ds.Rows[i]["CellPhone"].ToString();

                try
                {
                    //判断手机
                    if (Utility.IsCellPhone(cellPhone))
                    {
                        if (MsgBLL.CheckSellerMsgStatus())
                        {
                            MsgSendHis objHis = new MsgSendHis();
                            objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellPhone;//手机号码 2016 yao c
                            objHis.SellerNick  = Users.Nick;
                            //objHis.SellerNick = "澄腾科技";
                            objHis.Buyer_nick = "*****";
                            objHis.CellPhone  = cellPhone;
                            objHis.SendDate   = DateTime.Now;
                            objHis.SendType   = "手工发送";
                            objHis.SendStatus = "0";
                            objHis.Count      = "1";
                            //objHis.MsgContent = "【" + SellersBLL.GetSignName(Users.Nick) + "】" + txtContent.Text.Trim();// +"退订回T";
                            objHis.MsgContent = sigName + TextBox2.Text + " 退订回N";
                            if (!Utility.IsYiDongCellPhoneNo(cellPhone))
                            {
                                objHis.HelpSellerNick = "电信联通";
                            }
                            else
                            {
                                objHis.HelpSellerNick = "移动";
                            }
                            //if (true) test
                            if (SmartBLL.AddMsgSendHis(objHis))
                            {
                                try
                                {
                                    objHis.MsgContent = objHis.MsgContent.Replace(" ", "");
                                    if (objHis.MsgContent.Length <= 70)
                                    {
                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1);
                                    }
                                    else if (objHis.MsgContent.Length > 70 && objHis.MsgContent.Length <= 134)
                                    {
                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2);
                                    }
                                    else if (objHis.MsgContent.Length > 134 && objHis.MsgContent.Length <= 195)
                                    {
                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3);
                                    }
                                    else if (objHis.MsgContent.Length > 195 && objHis.MsgContent.Length <= 260)
                                    {
                                        MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4);
                                    }


                                    if (!Utility.IsYiDongCellPhoneNo(cellPhone))
                                    {
                                        //string sendStatus = Mobile.SendMsgKeTongDX(cellPhone, objHis.MsgContent);

                                        string      sendStatus = Mobile.PostDataToMyServer(cellPhone, objHis.MsgContent.Trim());//20160626 yao c
                                        IDictionary resultDic  = TopUtils.ParseJson(sendStatus);
                                        SmartBLL.UpdateSendStatus(resultDic["status"].ToString(), objHis.TransNumber);
                                    }
                                    else
                                    {
                                        string sendStatus = Mobile.SendMsgHubeiYDPost(cellPhone, objHis.MsgContent);//\r\n\r\n\r\n\r\n0
                                        sendStatus = sendStatus.Replace("\r", "").Replace("\n", "");
                                        if (sendStatus.Equals("0"))
                                        {
                                            sendStatus = "100";
                                        }
                                        SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    continue;
                                }
                            }
                        }
                        else
                        {
                            Response.Write("<script language='javascript'>alert('余额不足!');</script>");
                            return;
                        }
                    }
                }
                catch (Exception ex)
                {
                    continue;
                }
            }
            Response.Write("<script language='javascript'>alert('发送成功!');</script>");
        }