示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (WX.Main.CurUser.IsEmployeeUser)
                {
                    this.spanEmployee.Visible = true;
                    //Load UserName
                    this.lblUserName.InnerText = WX.Authentication.GetUserName();
                    //Load Msg
                    this.LoadPrivateMsg(true);
                    //Load Private State
                    WX.WXUser user = WX.Main.CurUser;
                    WX.Model.Employee.MODEL employee = WX.Model.Employee.GetModelToID(user.UserID);
                    user.LoadUserModel(true);
                    if (employee.IDCard.ToString() == "" || employee.Email.ToString() == "")
                    {
                        Response.Redirect("Private/Priv_EditUser.aspx");
                    }
                    user.LoadMyDepartment(true);
                    user.LoadDutyDetailUser(true);
                    user.LoadDutyUser(true);
                    user.LoadMyGrade(false);
                    //判断防止第一次进入错误
                    int grade = 0;
                    if (user.MyGrade != null)
                    {
                        grade = user.DutyDetailUser.GradeID.ToInt32();                       //grade = user.MyGrade.Sort.ToInt32();
                    }
                    grade = user.UserModel.Grade.ToInt32();

                    string deptName = null;
                    if (user.MyDepartMent != null)
                    {
                        deptName = user.MyDepartMent.Name.ToString();
                    }
                    string dutyName = null;
                    if (user.DutyUser != null)
                    {
                        dutyName = user.DutyUser.Name.ToString();
                    }
                    this.lblPrivateState.Text = String.Format("{0},{1},{2}"
                                                              , deptName, dutyName, WX.Model.Grade.GetModel(grade).Name.ToString() + "(" + grade + ")");
                }
                else
                {
                    this.lblUserName.InnerText = WX.Authentication.GetUserName();
                    this.spanEmployee.Visible  = false;
                }
            }
        }
示例#2
0
        private void LoadDuty()
        {
            WX.WXUser user = WX.Main.CurUser;
            user.LoadUserModel(false);
            user.LoadMyDepartment(true);
            user.LoadDutyDetailUser(true);
            user.LoadDutyUser(true);
            user.LoadMyGrade(true);
            int grade = 0;

            if (user.MyGrade != null)
            {
                grade = user.DutyDetailUser.GradeID.ToInt32();                       //grade = user.MyGrade.Sort.ToInt32();
            }
            this.lblDutyState.Text = String.Format("等级:{2}级<br />职务:{1}<br />部门:{0}<br /><span><a>[查看][日志]</a></span>"
                                                   , user.MyDepartMent.Name, user.DutyUser.Name, grade);
        }