posts - 13,  comments - 229,  trackbacks - 0
开源代码研究,源代码下载地址:http://download.csdn.net/source/1876659

可以及时的知道了解客户的动向,与站合作利用WebService部分
以下是关键部分的代码

PowerTalkService.FetionInterFace PTFIF = new PowerTalkClient.PowerTalkService.FetionInterFace();
            PowerTalkService.ChatInfo[] LPCI = PTFIF.GetChatInfos("在线客服");
            foreach (PowerTalkService.ChatInfo PTSCI in LPCI)
            {
                //@uplogin:游客ID,IP地址,真实地址,进入时刻,上次访问路径
                if (PTSCI.SendContent.Length > 9)
                {
                    if (PTSCI.SendContent.Substring(0, 9) == "@uplogin:")
                    {
                        string SplitStr = PTSCI.SendContent.Substring(9);
                        string[] ArrStr = SplitStr.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                        if (!HaveYouKe(ArrStr[0]))//如果不存在则添加
                        {
                            dataGridView1.Rows.Add("在线", ArrStr[0], 1, ArrStr[1], ArrStr[2], ArrStr[3], ArrStr[3], ArrStr[3], "在线客服", ArrStr[4]);
                        }
                        else//如果存在则次数加一
                        {
                            for (int i = 0; i < dataGridView1.Rows.Count; i++)
                            {
                                if (dataGridView1.Rows[i].Cells[1].Value.ToString() == ArrStr[0])
                                {
                                    int cs = int.Parse(dataGridView1.Rows[i].Cells[2].Value.ToString());
                                    cs = cs + 1;
                                    dataGridView1.Rows[i].Cells[2].Value = cs;
                                    break;
                                }
                            }
                        }
                       
                        Character.Show(0.1);
                        Character.Play("GETATTENTION");
                        PTSCI.SendContent = ArrStr[0] + "上线了!\r\n";
                    }
                }
                if (PTSCI.SendContent.Length > 11)
                {
                    if (PTSCI.SendContent.Substring(0, 11) == "@downlogin:")
                    {
                        string SplitStr = PTSCI.SendContent.Substring(11);
                        string[] ArrStr = SplitStr.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                   
                            //dataGridView1.Rows.Add("在线", ArrStr[0], 1, ArrStr[1], ArrStr[2], ArrStr[3], ArrStr[3], ArrStr[3], "在线客服", ArrStr[4]);
                            for (int i = 0; i < dataGridView1.Rows.Count; i++)
                            {
                                try
                                {
                                    string youkeid=ArrStr[0];
                                    if (dataGridView1.Rows[i].Cells[1].Value.ToString() == youkeid)
                                    {
                                        dataGridView1.Rows.Remove(dataGridView1.Rows[i]);
                                        break;
                                    }
                                }
                                catch { }
                            }
                                

                        Character.Show(0.1);
                        Character.Play("GETATTENTION");
                        PTSCI.SendContent = ArrStr[0] + "下线了!\r\n";
                    }
                }
                PTSCI.SendContent=Common.MatchImg(PTSCI.SendContent);
                //PTSCI.SendContent = HttpContext.Current.Server.HtmlDecode(PTSCI.SendContent);
                this.richTextBox1.Text += PTSCI.Sender + ":" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n" + "" + PTSCI.SendContent + "\r\n";//"接收者:" + PTSCI.Reciver +
                for (int i = 0; i < dataGridView1.Rows.Count; i++)//更新最后时间
                {
                    try
                    {
                        if (dataGridView1.Rows[i].Cells[1].Value.ToString() == PTSCI.Sender)
                        {

                            dataGridView1.Rows[i].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                            break;
                        }
                    }
                    catch { }
                }
                if (amniationchk.Checked)
                {
                    AngetSpeek(PTSCI.SendContent );//+ ":" + PTSCI.Sender);
                }
            }


posted on 2009-08-31 12:08 powertalkbox 阅读(...) 评论(...) 编辑 收藏