Ejemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //请求发起用户的在线编号
            string olId = Utils.InputText(context.Request.Form["olid"]);
            //最后获取到的消息编号
            DateTime lastPostTime = Utils.GetDateTime(context.Request.Form["lastTime"], DateTime.Now);

            EyouSoft.BLL.OnLineServer.OLServer bll = new EyouSoft.BLL.OnLineServer.OLServer();
            IList <EyouSoft.Model.OnLineServer.OlServerMessageInfo> messages = bll.GetMessages(olId, lastPostTime);

            context.Response.Write(JsonConvert.SerializeObject(messages));
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //清理过了指定停留时间的在线用户的在线状态为不在线(不含客服人员)
            OlServerUtility.ClearUserOut();


            EyouSoft.Model.OnLineServer.OlServerUserInfo olInfo       = null;
            EyouSoft.Model.OnLineServer.OlServerUserInfo olCookieInfo = OlServerUtility.GetOlCookieInfo(this.IsService);
            EyouSoft.Model.OnLineServer.OlServerConfig   configInfo   = null;
            EyouSoft.BLL.OnLineServer.OLServer           bll          = new EyouSoft.BLL.OnLineServer.OLServer();
            olInfo = bll.ServiceLogin(base.SiteUserInfo, true, base.SiteUserInfo.CompanyID);

            bll = null;

            //获取在线客服配置信息
            configInfo = OlServerUtility.GetOlServerConfig();

            string olserverinfo = "var olserverinfos={{uInfo:{0},configInfo:{1},mInfo:{2},lastTime:\"{3}\",CompanyName:\"{4}\"}};";

            string userInfoJsonString   = JsonConvert.SerializeObject(olInfo);
            string configInfoJsonString = JsonConvert.SerializeObject(configInfo);

            EyouSoft.Model.OnLineServer.OlServerMessageInfo MessageInfo = new EyouSoft.Model.OnLineServer.OlServerMessageInfo();
            MessageInfo.AcceptId   = string.Empty;
            MessageInfo.AcceptName = string.Empty;
            MessageInfo.Message    = string.Empty;
            MessageInfo.MessageId  = string.Empty;
            MessageInfo.SendId     = string.Empty;
            MessageInfo.SendName   = string.Empty;
            MessageInfo.SendTime   = DateTime.Now;
            string messageInfoJsonString = JsonConvert.SerializeObject(MessageInfo);

            //设置cookie
            this.SetOlCookieInfo(this.IsService, userInfoJsonString);

            this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "DEFAULTINFOS", string.Format(olserverinfo, userInfoJsonString, configInfoJsonString, messageInfoJsonString, DateTime.Now.ToString(), SiteUserInfo.CompanyName), true);

            #region 设置企业名称

            lbCompanyName1.Text = SiteUserInfo.CompanyName;
            lbCompanyName.Text  = SiteUserInfo.CompanyName;

            EyouSoft.Model.CompanyStructure.CompanyAttachInfo ImgModel = EyouSoft.BLL.CompanyStructure.CompanyAttachInfo.CreateInstance().GetModel(SiteUserInfo.CompanyID);
            if (ImgModel != null && ImgModel.CompanyLogo != null && !string.IsNullOrEmpty(ImgModel.CompanyLogo.ImagePath))
            {
                CompanyLogPath = Domain.FileSystem + ImgModel.CompanyLogo.ImagePath;
            }

            #endregion
        }
Ejemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //请求退出的在线用户编号
            string olId = Utils.InputText(context.Request.Form["olid"]);
            //是否客服端发起的请求
            bool isService = Utils.GetInt(context.Request["service"], -1) == 2009 ? true : false;

            EyouSoft.BLL.OnLineServer.OLServer bll = new EyouSoft.BLL.OnLineServer.OLServer();

            string exitResultString = bll.Exit(olId, isService) ? "1" : "0";

            context.Response.Write(exitResultString);
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //发起请求的在线用户编号
            string olId = Utils.InputText(context.Request.Form["olid"]);
            //要设置成的客服编号
            string serviceId = Utils.InputText(context.Request.Form["serviceid"]);
            //要设置成的客服名称
            string serviceName = Utils.InputText(context.Request.Form["servicename"]);

            EyouSoft.BLL.OnLineServer.OLServer bll = new EyouSoft.BLL.OnLineServer.OLServer();
            bll.SetService(olId, serviceId, serviceName);

            bll = null;
        }
Ejemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            string saveFileName = HttpUtility.UrlEncode(fileName);

            context.Response.Clear();
            context.Response.Buffer  = true;
            context.Response.Charset = "utf-8";
            context.Response.AppendHeader("Content-Disposition", string.Format("attachment;filename={0}", saveFileName));
            context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
            context.Response.ContentType     = "text/plain";

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("消息记录\r\n\r\n");
            sb.Append("=================================================\r\n");
            sb.AppendFormat("消息保存时间:{0}\r\n", DateTime.Now);
            sb.Append("=================================================\r\n\r\n");

            string olId      = Utils.InputText(context.Request.QueryString["olid"]);
            bool   isService = Utils.GetInt(context.Request.QueryString["service"], 0) == 2009 ? true : false;

            EyouSoft.Model.OnLineServer.OlServerUserInfo info = OlServerUtility.GetOlCookieInfo(isService);

            if (info != null && info.OId == olId)
            {
                EyouSoft.BLL.OnLineServer.OLServer bll = new EyouSoft.BLL.OnLineServer.OLServer();
                IList <EyouSoft.Model.OnLineServer.OlServerMessageInfo> items = bll.GetMessages(olId, null);
                bll = null;

                foreach (EyouSoft.Model.OnLineServer.OlServerMessageInfo item in items)
                {
                    if (item.SendId == olId)
                    {
                        sb.AppendFormat("{0} {1} 对 {2} 说:\r\n{3}\r\n\r\n", item.SendTime, "我", item.AcceptName, item.Message);
                    }
                    else
                    {
                        sb.AppendFormat("{0} {1} 对 {2} 说:\r\n{3}\r\n\r\n", item.SendTime, item.SendName, "我", item.Message);
                    }
                }

                items = null;
            }

            context.Response.Write(sb.ToString());
            context.Response.End();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 清理过了指定停留时间的在线用户的在线状态为不在线(不含客服人员)
        /// </summary>
        public static void ClearUserOut()
        {
            object olServerClearUserOutInterVal = EyouSoft.Cache.Facade.EyouSoftCache.GetCache(EyouSoft.CacheTag.OlServer.OLSERVERCLEARUSEROUTINTERVALCACHENAME);

            //缓存信息为null时执行清理过了指定停留时间的在线用户的在线状态为不在线(不含客服人员)
            if (olServerClearUserOutInterVal == null)
            {
                EyouSoft.BLL.OnLineServer.OLServer bll = new EyouSoft.BLL.OnLineServer.OLServer();
                bll.ClearUserOut(GetOlServerConfig().StayTime);
                bll = null;

                EyouSoft.Model.OnLineServer.OlServerConfig config = GetOlServerConfig();

                //设置缓存及缓存时间
                EyouSoft.Cache.Facade.EyouSoftCache.Add(EyouSoft.CacheTag.OlServer.OLSERVERCLEARUSEROUTINTERVALCACHENAME, config.ClearUserOutInterVal, DateTime.Now.AddMinutes(config.ClearUserOutInterVal));
            }
        }
Ejemplo n.º 7
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //获取发送的消息JSON字符串
            string msginfo = context.Request.Form["msginfo"];

            EyouSoft.Model.OnLineServer.OlServerMessageInfo messageInfo = null;
            //发送消息的结果信息
            EyouSoft.Model.OnLineServer.OlServerSendMessageResultInfo sendResultInfo = new EyouSoft.Model.OnLineServer.OlServerSendMessageResultInfo(string.Empty, DateTime.Now, false);

            //将JSON字符串反序列化
            try
            {
                messageInfo = (EyouSoft.Model.OnLineServer.OlServerMessageInfo)JsonConvert.DeserializeObject(msginfo, typeof(EyouSoft.Model.OnLineServer.OlServerMessageInfo));
            }
            catch {}

            //消息转化成功写入
            if (messageInfo != null)
            {
                messageInfo.SendTime = DateTime.Now;
                EyouSoft.BLL.OnLineServer.OLServer bll = new EyouSoft.BLL.OnLineServer.OLServer();
                messageInfo.SendTime = sendResultInfo.SendTime;
                //消息内容过虑
                messageInfo.Message      = Utils.InputText(messageInfo.Message);
                sendResultInfo.MessageId = bll.InsertMessage(messageInfo);

                messageInfo = null;
                bll         = null;

                sendResultInfo.IsSuccess = true;
            }

            //返回字符串
            string sendResultInfoJsonString = JsonConvert.SerializeObject(sendResultInfo);

            context.Response.Write(sendResultInfoJsonString);
        }
Ejemplo n.º 8
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //返回的JSON字符串
            string usersInfoJsonString = "[]";

            //请求发起用户的在线编号
            string olId = Utils.InputText(context.Request["olid"]);
            //是否客服端发起的请求
            bool isService = Utils.GetInt(context.Request["service"], -1) == 2009 ? true : false;

            //清理过了指定停留时间的在线用户的在线状态为不在线(不含客服人员)
            OlServerUtility.ClearUserOut();

            EyouSoft.BLL.OnLineServer.OLServer bll = new EyouSoft.BLL.OnLineServer.OLServer();
            System.Collections.Generic.IList <EyouSoft.Model.OnLineServer.OlServerUserInfo> users = bll.GetOlUsers(olId, isService);

            usersInfoJsonString = JsonConvert.SerializeObject(users);
            users = null;

            context.Response.Write(usersInfoJsonString);
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetCompanyId();

            //清理过了指定停留时间的在线用户的在线状态为不在线(不含客服人员)
            OlServerUtility.ClearUserOut();


            EyouSoft.Model.OnLineServer.OlServerUserInfo olInfo       = null;
            EyouSoft.Model.OnLineServer.OlServerUserInfo olCookieInfo = OlServerUtility.GetOlCookieInfo(this.IsService);
            EyouSoft.Model.OnLineServer.OlServerConfig   configInfo   = null;
            EyouSoft.BLL.OnLineServer.OLServer           bll          = new EyouSoft.BLL.OnLineServer.OLServer();
            UserInfo userInfo = null;
            bool     isLogin  = EyouSoft.Security.Membership.UserProvider.IsUserLogin(out userInfo);

            if (!isLogin)
            {
                olInfo = bll.GuestLogin(olCookieInfo, _companyid);
            }
            else
            {
                olInfo = bll.ServiceLogin(userInfo, this.IsService, _companyid);
            }

            bll = null;

            //获取在线客服配置信息
            configInfo = OlServerUtility.GetOlServerConfig();

            string olserverinfo = "var olserverinfos={{uInfo:{0},configInfo:{1},mInfo:{2},lastTime:\"{3}\",CompanyName:\"{4}\"}};";

            string userInfoJsonString   = JsonConvert.SerializeObject(olInfo);
            string configInfoJsonString = JsonConvert.SerializeObject(configInfo);

            EyouSoft.Model.OnLineServer.OlServerMessageInfo MessageInfo = new EyouSoft.Model.OnLineServer.OlServerMessageInfo();
            MessageInfo.AcceptId   = string.Empty;
            MessageInfo.AcceptName = string.Empty;
            MessageInfo.Message    = string.Empty;
            MessageInfo.MessageId  = string.Empty;
            MessageInfo.SendId     = string.Empty;
            MessageInfo.SendName   = string.Empty;
            MessageInfo.SendTime   = DateTime.Now;
            string messageInfoJsonString = JsonConvert.SerializeObject(MessageInfo);

            //设置cookie
            this.SetOlCookieInfo(this.IsService, userInfoJsonString);

            this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "DEFAULTINFOS", string.Format(olserverinfo, userInfoJsonString, configInfoJsonString, messageInfoJsonString, DateTime.Now.ToString(), _companyinfo.CompanyName), true);

            #region 设置企业名称

            lbCompanyName1.Text = _companyinfo.CompanyName;
            lbCompanyName.Text  = _companyinfo.CompanyName;
            ltrCompanyName.Text = _companyinfo.CompanyName;
            EyouSoft.Model.CompanyStructure.CompanyAttachInfo ImgModel = EyouSoft.BLL.CompanyStructure.CompanyAttachInfo.CreateInstance().GetModel(_companyid);
            if (ImgModel != null && ImgModel.CompanyLogo != null && !string.IsNullOrEmpty(ImgModel.CompanyLogo.ImagePath))
            {
                CompanyLogPath = Domain.FileSystem + ImgModel.CompanyLogo.ImagePath;
            }
            ImgModel = null;

            if (_companyinfo != null)
            {
                StringBuilder strCompanyInfo = new StringBuilder();
                if (!string.IsNullOrEmpty(_companyinfo.CompanyBrand))
                {
                    strCompanyInfo.AppendFormat("<strong>品牌名称:</strong>{0}<br />", _companyinfo.CompanyBrand);
                }
                if (_companyinfo.ContactInfo != null && !string.IsNullOrEmpty(_companyinfo.ContactInfo.ContactName))
                {
                    strCompanyInfo.AppendFormat("联系人:{0}<br />", _companyinfo.ContactInfo.ContactName);
                }
                if (_companyinfo.ContactInfo != null && !string.IsNullOrEmpty(_companyinfo.ContactInfo.Mobile))
                {
                    strCompanyInfo.AppendFormat("手机:{0}<br />", _companyinfo.ContactInfo.Mobile);
                }
                if (_companyinfo.ContactInfo != null && !string.IsNullOrEmpty(_companyinfo.ContactInfo.Tel))
                {
                    strCompanyInfo.AppendFormat("电话:{0}<br />", _companyinfo.ContactInfo.Tel);
                }
                if (_companyinfo.ContactInfo != null && !string.IsNullOrEmpty(_companyinfo.ContactInfo.Fax))
                {
                    strCompanyInfo.AppendFormat("传真:{0}<br />", _companyinfo.ContactInfo.Fax);
                }
                if (!string.IsNullOrEmpty(_companyinfo.CompanyAddress))
                {
                    strCompanyInfo.AppendFormat("地址:{0}", _companyinfo.CompanyAddress);
                }
                if (strCompanyInfo.Length > 0)
                {
                    strCompanyInfo.Insert(0, "<li>");
                    strCompanyInfo.Append("</li>");
                }
                ltrCompanyInfo.Text = strCompanyInfo.ToString();
            }
            #endregion
        }