Esempio n. 1
0
    protected override void OnPreRender(EventArgs e)
    {
        using (BPMConnection cn = new BPMConnection())
        {
            cn.WebOpen();

            UserCommonInfo userCommonInfo = UserCommonInfo.FromAccount(cn, YZAuthHelper.LoginUserAccount);

            if (userCommonInfo.OutOfOfficeState == OutOfOfficeState.InOffice)
            {
                this._litJS.Text = String.Format("SetLinkText('leave','{0}');", Resources.YZStrings.BPM_Default_OutofOffice);

                this._litCaption.Text         = Resources.YZStrings.Aspx_CancelLeave_SuccessTitle;
                this._litMsg.Text             = Resources.YZStrings.Aspx_CancelLeave_SuccessMessage;
                this._btnSubmit.Text          = Resources.YZStrings.Aspx_CancelLeave_SuccessSubmit;
                this._btnSubmit.OnClientClick = "window.location.href='Leave.aspx';return false;";
            }
            else
            {
                this._litJS.Text = String.Format("SetLinkText('cancelleave','{0}');", Resources.YZStrings.BPM_GetBack);

                string period = String.Empty;
                if (userCommonInfo.OutOfOfficeState == OutOfOfficeState.Period)
                {
                    period = userCommonInfo.OutOfOfficeFrom.ToString("yyyy-MM-dd HH:mm") + " -> " + userCommonInfo.OutOfOfficeTo.ToString("yyyy-MM-dd HH:mm") + "<br/>";
                }

                this._litMsg.Text = String.Format(period + Resources.YZStrings.Aspx_GetBack_Msg, Resources.YZStrings.BPM_GetBack);
            }
        }

        base.OnPreRender(e);
    }
Esempio n. 2
0
File: User.cs Progetto: radtek/EMIP
        public virtual JObject GetCurrentNotificationSetting(HttpContext context)
        {
            string account = YZAuthHelper.LoginUserAccount;

            NotifyProviderInfoCollection providers;
            UserCommonInfo userCommonInfo;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                providers      = NotifyManager.GetProviders(cn);
                userCommonInfo = UserCommonInfo.FromAccount(cn, account);
            }

            JObject rv         = new JObject();
            JArray  jProviders = new JArray();

            rv["providers"] = jProviders;
            foreach (NotifyProviderInfo provider in providers)
            {
                JObject jProvider = new JObject();
                jProviders.Add(jProvider);

                jProvider["ProviderName"] = provider.Name;
                jProvider["Enabled"]      = !userCommonInfo.RejectedNotifys.Contains(provider.Name);
            }

            rv[YZJsonProperty.success] = true;
            return(rv);
        }
Esempio n. 3
0
        public virtual object GetPersonalInfo(HttpContext context)
        {
            string uid = YZAuthHelper.LoginUserAccount;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                UserCommonInfo   userCommonInfo = UserCommonInfo.FromAccount(cn, uid);
                User             user           = User.FromAccount(cn, uid);
                MemberCollection members        = OrgSvr.GetUserPositions(cn, uid);

                JArray jMembers = new JArray();
                foreach (Member member in members)
                {
                    JObject jMember = new JObject();
                    jMembers.Add(jMember);

                    jMember["LeaderTitle"] = member.LeaderTitle;
                    jMember["Level"]       = member.Level;
                    jMember["OUName"]      = member.GetParentOU(cn).Name;
                }

                return(new
                {
                    user = user,
                    userCommonInfo = userCommonInfo,
                    positions = jMembers
                });
            }
        }
Esempio n. 4
0
        public virtual object GetUserCommonInfo(HttpContext context)
        {
            string uid = YZAuthHelper.LoginUserAccount;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                return(UserCommonInfo.FromAccount(cn, uid));
            }
        }
Esempio n. 5
0
        public virtual object GetCompanyContactInfo(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            string    uid     = request.GetString("uid");

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                User                 user           = User.FromAccount(cn, uid);
                UserCommonInfo       userCommonInfo = UserCommonInfo.FromAccount(cn, uid);
                MemberCollection     members        = OrgSvr.GetUserPositions(cn, user.Account);
                SupervisorCollection supervisors    = new SupervisorCollection();

                foreach (Member member in members)
                {
                    supervisors.AddRange(member.GetSupervisors(cn));
                }

                JArray jMembers = new JArray();
                foreach (Member member in members)
                {
                    JObject jMember = new JObject();
                    jMembers.Add(jMember);

                    jMember["LeaderTitle"] = member.LeaderTitle;
                    jMember["Level"]       = member.Level;
                    jMember["OUName"]      = member.GetParentOU(cn).Name;
                }

                JArray jSupervisors = new JArray();
                foreach (Supervisor supervisor in supervisors)
                {
                    JObject jSupervisor = new JObject();
                    jSupervisors.Add(jSupervisor);

                    jSupervisor["Account"]   = supervisor.UserAccount;
                    jSupervisor["ShortName"] = YZStringHelper.GetUserShortName(supervisor.UserAccount, supervisor.UserFullName);
                    jSupervisor["FGYWs"]     = supervisor.FGYWEnabled ? supervisor.FGYWs.ToStringList(','):"";
                }

                return(new
                {
                    user = user,
                    userCommonInfo = userCommonInfo,
                    positions = jMembers,
                    supervisors = jSupervisors
                });
            }
        }
Esempio n. 6
0
        public virtual object GetMemberDefine(HttpContext context)
        {
            YZRequest request  = new YZRequest(context);
            string    fullname = request.GetString("fullname");
            string    parentou = request.GetString("parentou");

            Member                  member;
            User                    user;
            UserCommonInfo          userCommonInfo;
            DataColumnCollection    userExtAttrsSchema;
            OUCollection            childOUs;
            OUCollection            fgOUs;
            BPMObjectNameCollection fgYWs;
            SupervisorCollection    supervisors;
            DirectXSCollection      directXSs;
            TaskRuleCollection      taskRules;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                member             = Member.FromFullName(cn, fullname);
                user               = member.GetUser(cn);
                userExtAttrsSchema = User.GetExtColumns(cn, user.NameSpace);
                userCommonInfo     = UserCommonInfo.FromAccount(cn, user.Account);
                childOUs           = OU.GetChildren(cn, parentou);

                fgOUs       = member.GetFGOUs(cn);
                fgYWs       = member.GetFGYWs(cn);
                supervisors = member.GetSupervisors(cn);
                directXSs   = member.GetDirectXSs(cn);

                taskRules = User.GetTaskRules(cn, user.Account);
            }

            return(new {
                User = user,
                UserExtAttrsSchema = YZJsonHelper.SerializeExtAttrSchema(userExtAttrsSchema),
                Member = member,
                UserCommonInfo = userCommonInfo,
                ChildOUs = YZJsonHelper.SerializeSimpleOU(childOUs),
                FGOUs = YZJsonHelper.Serialize2Array(fgOUs),
                FGYWs = fgYWs,
                Supervisors = supervisors,
                DirectXSs = directXSs,
                TaskRules = taskRules,
                temporaryUid = "temporary/" + Guid.NewGuid().ToString()
            });
        }
Esempio n. 7
0
    protected override void OnPreRender(EventArgs e)
    {
        using (BPMConnection cn = new BPMConnection())
        {
            cn.WebOpen();

            UserCommonInfo userCommonInfo = UserCommonInfo.FromAccount(cn, YZAuthHelper.LoginUserAccount);
            if (userCommonInfo.OutOfOfficeState != OutOfOfficeState.InOffice)
            {
                this.Response.Redirect("Back.aspx");
            }

            User user = BPM.Client.User.TryGetUser(cn, YZAuthHelper.LoginUserAccount);
            this._labUser.Text = HttpUtility.HtmlEncode(YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName));
        }

        base.OnPreRender(e);
    }
Esempio n. 8
0
File: User.cs Progetto: radtek/EMIP
        public virtual object GetOutOfOffice(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            string    uid     = YZAuthHelper.LoginUserAccount;

            UserCommonInfo userCommonInfo;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                userCommonInfo = UserCommonInfo.FromAccount(cn, uid);
            }

            return(new
            {
                state = userCommonInfo.OutOfOfficeState.ToString(),
                DateFrom = userCommonInfo.OutOfOfficeFrom,
                DateTo = userCommonInfo.OutOfOfficeTo
            });
        }
Esempio n. 9
0
        public virtual JObject GetCurrentLeavingSetting(HttpContext context)
        {
            string account = YZAuthHelper.LoginUserAccount;

            UserCommonInfo userCommonInfo;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                userCommonInfo = UserCommonInfo.FromAccount(cn, account);
            }

            JObject rv = new JObject();

            rv["State"] = userCommonInfo.OutOfOfficeState.ToString();
            rv["From"]  = userCommonInfo.OutOfOfficeFrom;
            rv["To"]    = userCommonInfo.OutOfOfficeTo;

            rv[YZJsonProperty.success] = true;
            return(rv);
        }
Esempio n. 10
0
        private JObject GenLoginResult(string account, bool trial)
        {
            string   andriodPushService = WebConfigurationManager.AppSettings["AndroidPushService"];
            DateTime today = DateTime.Today;
            JObject  rv    = new JObject();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                User           user           = User.FromAccount(cn, account);
                UserCommonInfo userCommonInfo = UserCommonInfo.FromAccount(cn, account);

                JObject juser = new JObject();
                rv["user"] = juser;

                juser["Account"]            = user.Account;
                juser["AndroidPushService"] = String.IsNullOrEmpty(andriodPushService) ? "JPush" : andriodPushService;
                juser["HRID"]        = user.HRID;
                juser["DisplayName"] = user.DisplayName;
                juser["ShortName"]   = YZStringHelper.GetUserShortName(user.Account, user.DisplayName);
                juser["LongName"]    = YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName);
                juser["LoginDate"]   = DateTime.Now;
                juser["ScreenLock"]  = userCommonInfo.ScreenLock;
                juser["TouchUnlock"] = userCommonInfo.TouchUnlock;
                juser["Trial"]       = trial;

                rv["BPMSiteUrl"]   = WebConfigurationManager.AppSettings["BPMSiteUrl"];
                rv["LocalLibrary"] = String.Compare(System.Web.Configuration.WebConfigurationManager.AppSettings["LocalLibrary"], "false", true) == 0 ? false : true;
                rv["JSCache"]      = YZSetting.JSCache;
                rv["JSVersion"]    = YZSetting.JSVersion;
                rv["ver"]          = 2;
            }

            rv["xclass"]  = "EMIP.view.Main";
            rv["success"] = true;

            return(rv);
        }
Esempio n. 11
0
    protected override void OnPreRender(EventArgs e)
    {
        using (BPMConnection cn = new BPMConnection())
        {
            cn.WebOpen();
            User user = BPM.Client.User.TryGetUser(cn, YZAuthHelper.LoginUserAccount);

            this._labUser.Text = HttpUtility.HtmlEncode(YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName));

            NotifyProviderInfoCollection provInfos = NotifyManager.GetProviders(cn);
            UserCommonInfo cInfo = UserCommonInfo.FromAccount(cn, YZAuthHelper.LoginUserAccount);

            this._chksProvider.Items.Clear();
            foreach (NotifyProviderInfo provInfo in provInfos)
            {
                ListItem lstItem = new ListItem(provInfo.Name, provInfo.Name);
                lstItem.Selected = !cInfo.RejectedNotifys.Contains(provInfo.Name);
                this._chksProvider.Items.Add(lstItem);
            }
        }

        base.OnPreRender(e);
    }
Esempio n. 12
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                YZAuthHelper.OAuth();

                //YZAuthHelper.AshxAuthCheck();

                string   method  = context.Request.Params["Method"];
                JsonItem JosonRv = new JsonItem();

                if (YZStringHelper.EquName(method, "GET"))
                {
                    string uid = YZAuthHelper.LoginUserAccount;
                    using (BPMConnection cn = new BPMConnection())
                    {
                        JsonItem data = new JsonItem();
                        JosonRv.Attributes.Add("data", data);

                        cn.WebOpen();

                        UserAccount currentUser = cn.getCurrentUser(uid);


                        User user = User.FromAccount(cn, uid);

                        #region 用户信息
                        data.Attributes["Account"]     = user.Account;
                        data.Attributes["HRID"]        = user.HRID;
                        data.Attributes["DisplayName"] = user.ShortName;
                        data.Attributes["Mobile"]      = user.Mobile;
                        data.Attributes["OfficePhone"] = user.OfficePhone;
                        data.Attributes["HomePhone"]   = user.HomePhone;
                        data.Attributes["EMail"]       = user.EMail;
                        data.Attributes["Office"]      = user.Office;
                        data.Attributes["Birthday"]    = YZStringHelper.DateToString(user.Birthday);
                        data.Attributes["DateHired"]   = YZStringHelper.DateToString(user.DateHired);
                        data.Attributes["Desc"]        = user.Description;
                        #endregion

                        #region 获得OU
                        //获得OU
                        String OULevel = String.Empty;
                        String OUName  = String.Empty;
                        String Dept    = String.Empty;
                        BPMObjectNameCollection depts   = new BPMObjectNameCollection();
                        MemberCollection        members = OrgSvr.GetUserPositions(cn, uid);
                        foreach (Member member in members)
                        {
                            OU ou = member.GetParentOU(cn);
                            OULevel = ou.OULevel;
                            Dept    = ou.Name;

                            String FullName    = member.GetParentOU(cn).FullName;
                            String mFullName   = member.FullName;
                            String mDepartment = member.Department;


                            if (!ou.IsRootOU)
                            {
                                OUName = mFullName.Split(new char[2] {
                                    '/', '/'
                                })[2];
                                depts.Add(OUName);
                            }
                            else
                            {
                                OUName = ou.Name;
                            }

                            if (String.IsNullOrEmpty(member.LeaderTitle))
                            {
                                depts.Add(ou.Name);
                            }
                            else
                            {
                                depts.Add(String.Format("{0}({1})", ou.Name, member.LeaderTitle));
                            }
                        }

                        data.Attributes["Dept"] = String.Join(" > ", depts.ToArray());
                        #endregion


                        UserCommonInfo userCommonInfo = UserCommonInfo.FromAccount(cn, uid);

                        data.Attributes["AppSN"]      = Net.Common.JosonRandom.GetRandomByDateTime(1, 999).Replace("/", "");
                        data.Attributes["AppCompany"] = OUName.GetShortName();
                        data.Attributes["AppDept"]    = Dept;
                        data.Attributes["AppDate"]    = DateTime.Now;
                        data.Attributes["AppHRName"]  = user.ShortName;
                        data.Attributes["AppHRID"]    = YZAuthHelper.LoginUserAccount;
                        data.Attributes["isSkyWorth"] = currentUser.AppFristDept != "制造中心" ? 0 : 1;
                        data.Attributes["AppComDept"] = currentUser.AppCompany.ToConnects("\\") + currentUser.AppDept;



                        JosonRv.Attributes.Add("success", true);
                        JosonRv.Attributes.Add("successMessage", "ok");
                        context.Response.Write(JosonRv.ToString());
                    }
                }
                else if (YZStringHelper.EquName(method, "Submit"))
                {
                    //遍历File表单元素
                    //HttpFileCollection files = HttpContext.Current.Request.Files;
                    //try
                    //{
                    //    for (int iFile = 0; iFile < files.Count; iFile++)
                    //    {
                    //        ///检查文件扩展名字
                    //        HttpPostedFile postedFile = files[iFile];
                    //        string fileName, fileExtension;
                    //        fileName = System.IO.Path.GetFileName(postedFile.FileName);
                    //        if (fileName != "")
                    //        {
                    //            ///注意:可能要修改你的文件夹的匿名写入权限。
                    //            postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("YZSoft/attachment/") + fileName);
                    //        }
                    //    }

                    //    HttpContext.Current.Response.Write("{success:true,msg:'File was successfully uploaded.'}");
                    //}
                    //catch (System.Exception Ex)
                    //{
                    //    HttpContext.Current.Response.Write("{success:true,msg:'File was successfully uploaded.'}");
                    //}



                    #region 接收数据
                    string uid = YZAuthHelper.LoginUserAccount;

                    string EmpID       = Convert.ToString(context.Request.Params["AppHRID"]);
                    string EmpName     = Convert.ToString(context.Request.Params["AppHRName"]);
                    string LeaveID     = Convert.ToString(context.Request.Params["LeaveID"]);
                    string LeaveName   = Convert.ToString(context.Request.Params["LeaveName"]);
                    string LeaveTypeID = Convert.ToString(context.Request.Params["LeaveTypeID"]);


                    String   AppSN      = Convert.ToString(context.Request.Params["AppSN"]);
                    String   AppCompany = Convert.ToString(context.Request.Params["AppCompany"]);
                    String   AppDept    = Convert.ToString(context.Request.Params["AppDept"]);
                    DateTime AppDate    = Convert.ToDateTime(context.Request.Params["AppDate"]);
                    String   AppHRName  = Convert.ToString(context.Request.Params["AppHRName"]);
                    String   AppHRID    = Convert.ToString(context.Request.Params["AppHRID"]);

                    String Address = Convert.ToString(context.Request.Params["Address"]);

                    DateTime FromDate = YZStringHelper.StringToDate(context.Request.Params["startTime"]);
                    DateTime ToDate   = YZStringHelper.StringToDate(context.Request.Params["endTime"]);

                    String allHours = Convert.ToString(context.Request.Params["allHours"]);
                    int    DayInt   = Convert.ToInt32(allHours.Split('天')[0]);
                    int    HourInt  = Convert.ToInt32(allHours.Split('天')[1].Split('小')[0]);


                    String reasonWhyNote = Convert.ToString(context.Request.Params["reasonWhy"]);
                    String suggestionMsg = Convert.ToString(context.Request.Params["suggestionMsg"]);
                    String strAttachment = Convert.ToString(context.Request.Params["strAttachment"]);

                    int isSkyWorth = Convert.ToInt32(context.Request.Params["isSkyWorth"]);



                    #region  iPHone 早期版本 客户端Bug修改

                    String strFromClient = submitFrom.UserAgent(context);

                    //if (suggestionMsg.IndexOf("iphone") > -1 || suggestionMsg.IndexOf("iPhone") > -1)
                    //{

                    //    if (LeaveTypeID == "20")
                    //    {
                    //        LeaveTypeID = "30";

                    //    }
                    //    else
                    //    {
                    //        LeaveTypeID = LeaveTypeID == "30" ? "20" : LeaveTypeID;
                    //    }
                    //}

                    #endregion


                    #endregion

                    using (BPMConnection cn = new BPMConnection())
                    {
                        cn.WebOpen();

                        //  Net.Common.GetRequestForm.Post<T>

                        //   http://extjs.org.cn/node/712


                        #region 提交数据
                        MemoryStream xmlStream = GeneratePostXML(Guid.NewGuid(), cn
                                                                 , AppSN
                                                                 , AppHRID
                                                                 , AppHRName
                                                                 , AppDate
                                                                 , AppDept
                                                                 , AppCompany

                                                                 , EmpID
                                                                 , EmpName
                                                                 , LeaveID
                                                                 , LeaveName
                                                                 , LeaveTypeID
                                                                 , FromDate
                                                                 , ToDate
                                                                 , DayInt
                                                                 , HourInt
                                                                 , reasonWhyNote + suggestionMsg + "\n\r" + strFromClient
                                                                 , strAttachment
                                                                 , isSkyWorth

                                                                 );
                        #endregion

                        PostResult result      = BPMProcess.Post(cn, xmlStream);
                        String     DisplayName = result.Recipients[0].Owner.DisplayName;

                        //JsonItem JosonRv = new JsonItem();
                        JosonRv.Attributes.Add("success", true);
                        JosonRv.Attributes.Add("successMessage", "\n\r <BR> 流程【" + result.SN + "】\n\r <BR> 成功提交给 " + DisplayName);
                        context.Response.Write(JosonRv.ToString());
                    }
                }
                else
                {
                    String strMsg = String.Format(JosonStrings.Aspx_UnknowCommand, method);

                    //JsonItem JosonRv = new JsonItem();
                    JosonRv.Attributes.Add("success", false);
                    JosonRv.Attributes.Add("errorMessage", strMsg);

                    context.Response.Write(JosonRv.ToString());

                    throw new Exception(strMsg);
                }

                //System.Threading.Thread.Sleep(500);
            }
            catch (Exception e)
            {
                JsonItem JosonRv = new JsonItem();
                JosonRv.Attributes.Add("success", false);
                JosonRv.Attributes.Add("errorMessage", e.Message);
                context.Response.Write(JosonRv.ToString());
            }
        }
Esempio n. 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Charset = "UTF-8";
        Response.AddHeader("P3P", "CP=CAO PSA OUR"); //无此行当在ie的iframe中打开应用(default.aspx.cs)时设置cookie后,ajax request时cookie没了
        this.Response.Cache.SetCacheability(HttpCacheability.NoCache);

        if (!YZAuthHelper.IsAuthenticated)
        {
            FormsAuthentication.RedirectToLoginPage();
            return;
        }

        //设置页标题
        this.Page.Title = System.Web.Configuration.WebConfigurationManager.AppSettings["CompanyInfoDefaultPageTitle"];
        if (String.IsNullOrEmpty(this.Page.Title))
        {
            this.Page.Title = Resources.YZStrings.Aspx_DefaultPage_Title;
        }

        //设置HTML标准
        if (String.Compare(this.Request.Browser.Browser, "IE", true) == 0 && this.Request.Browser.MajorVersion == 6)
        {
        }
        else
        {
            this._litTop.Text = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
        }

        //没有site参数,或site参数不正确
        int factoryId = 0;

        Int32.TryParse(this.Request.QueryString["site"], out factoryId);

        //获得帐号信息
        User user = new User();
        int  taskCount;
        int  userLevel = 10;
        bool permSys   = false;
        bool leave     = false;

        using (BPMConnection cn = new BPMConnection())
        {
            cn.WebOpen();

            //获得当前用户
            user.Open(cn, YZAuthHelper.LoginUserAccount);
            taskCount = cn.GetMyTaskCount(null);
            UserCommonInfo userCommonInfo = UserCommonInfo.FromAccount(cn, YZAuthHelper.LoginUserAccount);

            MemberCollection positions = OrgSvr.GetUserPositions(cn, YZAuthHelper.LoginUserAccount);
            foreach (Member member in positions)
            {
                if (member.Level > userLevel)
                {
                    userLevel = (int)member.Level;
                }
            }

            //检查对系统管理模块的权限
            permSys = UserResourceSecurityManager.CheckPermision(cn, YZWellKnowRSID.SYS, "Execute");
            leave   = userCommonInfo.OutOfOfficeState == OutOfOfficeState.InOffice ? false:true;
        }

        JsonItem rv = new JsonItem();

        rv.Attributes["LCID"]               = YZLangHelper.CurrentCulture.LCID;
        rv.Attributes["CompanyName"]        = System.Web.Configuration.WebConfigurationManager.AppSettings["CompanyInfoCompanyName"];
        rv.Attributes["Account"]            = YZAuthHelper.LoginUserAccount;
        rv.Attributes["DisplayName"]        = user.DisplayName;
        rv.Attributes["TaskCount"]          = taskCount;
        rv.Attributes["UserLevel"]          = userLevel;
        rv.Attributes["PermSys"]            = permSys;
        rv.Attributes["Leave"]              = leave;
        rv.Attributes["Link1"]              = System.Web.Configuration.WebConfigurationManager.AppSettings["CompanyInfoLink1"];
        rv.Attributes["DBType"]             = QueryManager.DBProviderName != "SQL Server" ? QueryManager.DBProviderName : "";
        rv.Attributes["UnreadMessageCount"] = 0;

        //获得rootUrl
        string url         = this.Request.Url.GetLeftPart(UriPartial.Authority);
        string virtualPath = HttpRuntime.AppDomainAppVirtualPath;

        if (virtualPath == "/")
        {
            virtualPath = String.Empty;
        }

        url = url + virtualPath + "/";

        //在页面中包含JS
        string             jscode = String.Format("var rootUrl='{0}';\nvar userInfo = {1}", url, rv.ToString());
        HtmlGenericControl js     = new HtmlGenericControl("script");

        js.Attributes["type"] = "text/javascript";
        js.InnerHtml          = jscode;
        this.Page.Header.Controls.AddAt(1, js);

        //设置Cookie
        HttpCookie cookie;

        cookie = new HttpCookie("UserDisplayName", HttpUtility.UrlEncode(Convert.ToString(rv.Attributes["DisplayName"]), System.Text.Encoding.UTF8));
        this.Response.SetCookie(cookie);
        cookie = new HttpCookie("UserLevel", userLevel.ToString());
        this.Response.SetCookie(cookie);

        string startApp = this.Request.QueryString["StartApp"];

        if (String.IsNullOrEmpty(startApp))
        {
            startApp = System.Web.Configuration.WebConfigurationManager.AppSettings["StartApp"];
        }
        if (String.IsNullOrEmpty(startApp))
        {
            startApp = "YZApp";
        }

        this._litStartApp.Text    = String.Format("<script src=\"{0}/MainWindow.js\" type=\"text/javascript\"></script>", startApp);
        this._litStartAppCss.Text = String.Format("<link href=\"{0}/Styles/main.css\" rel=\"stylesheet\" type=\"text/css\" />", startApp);
    }