Ejemplo n.º 1
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.º 2
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.º 3
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.º 4
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
        }