Exemple #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
        }
Exemple #2
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
        }