Пример #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;
                }
            }
        }
        private string GetSysVariable(string Vname)
        {
            string returnstr = "";

            WX.WXUser cu = WX.Main.CurUser;
            WX.Flow.Model.Process.MODEL pmodel = WX.Flow.Model.Process.GetModel("select top 1 * from TE_VarDefine where Title='" + Vname + "'");
            string name = "";

            if (pmodel != null && pmodel.Name.value != null)
            {
                name = pmodel.Name.value.ToString();
            }
            switch (name)
            {
            case "PRCS_Z_UserName":
                cu.LoadUserModel(false);
                returnstr = cu.UserModel.RealName.value.ToString();
                break;

            case "PRCS_Z_UserDuty":
                cu.LoadDutyUser();
                returnstr = cu.DutyUser.Name.value.ToString();
                break;

            case "PRCS_Z_UserDept":
                cu.LoadUserModel(false);
                WX.Model.Department.MODEL dept = WX.Model.Department.GetCache(cu.UserModel.DepartmentID.ToInt32());
                //WX.Model.Department.GetModel("select * from TE_Departments where ID=" + cu.EmployeeUser.DepartmentID.value.ToString());
                returnstr = dept.Name.value.ToString();
                break;

            case "PRCS_Z_UserSupDept":
                cu.LoadUserModel(false);
                WX.Model.Department.MODEL dept2 = WX.Model.Department.GetCache(cu.UserModel.DepartmentID.ToInt32());
                //WX.Model.Department.GetModel("select * from TE_Departments where ID=" + cu.EmployeeUser.DepartmentID.value.ToString());
                dept2 = WX.Model.Department.GetCache(dept2.ParentID.ToInt32());
                //WX.Model.Department.GetModel("select * from TE_Departments where ID=" + dept2.ParentID.value.ToString());
                returnstr = dept2.Name.value.ToString();
                break;

            case "PRCS_ID": returnstr = Request["id"]; break;

            case "Datetime_Now": returnstr = DateTime.Now.ToString("yyyy-MM-dd"); break;

            default: break;
            }
            return(returnstr);
        }
Пример #3
0
        /// <summary>
        /// 简捷使用
        /// </summary>
        /// <param name="functionId">使用功能ID</param>
        /// <returns></returns>
        //public static bool ExecPermission(int functionId)
        //{
        //    if (!GetPermission(functionId))
        //    {
        //        HttpContext.Current.Response.Write("你没有权限访问此功能!");
        //        HttpContext.Current.Response.End();
        //        return false;
        //    }
        //    else
        //        return true;
        //}
        #endregion

        #region //根据职务和功能动态生成左侧菜单 CreateMenu(int DutyID)

        public static string GetMenu()
        {
            WX.WXUser user = WX.Main.CurUser;
            DataTable dt   = ULCode.QDA.XSql.GetDataTable("exec Get_MaxRole '" + user.UserID + "'");

            Duty.MODEL duty = Duty.GetCache(0);
            if (user.IsEmployeeUser)
            {
                user.LoadDutyUser();
                duty = user.DutyUser;
            }
            if (dt != null && dt.Rows.Count > 0 && Convert.ToInt32(dt.Rows[0][0]) > duty.GradeID.ToInt32())
            {
                return(dt.Rows[0][1].ToString());
            }
            return(duty.Menus.ToString());
        }
Пример #4
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);
        }
Пример #5
0
            /// <summary>
            /// 获取单个服务器变量
            /// </summary>
            /// <param name="Vname"></param>
            /// <returns></returns>
            private string GetConditionSql_GetSysVariable(string name)
            {
                string returnstr = "";

                WX.WXUser cu = WX.Public.CurUser;
                //WX.Flow.Model.Process.MODEL pmodel = WX.Flow.Model.Process.GetModel("select top 1 * from TE_VarDefine where Title='" + Vname + "'");
                //string name = "";
                //if (pmodel != null && pmodel.Name.value != null)
                //{
                //    name = pmodel.Name.value.ToString();
                //}
                switch (name)
                {
                case "PRCS_Z_UserName":
                    cu.LoadUserModel(false);
                    returnstr = cu.UserModel.RealName.value.ToString();
                    break;

                case "PRCS_Z_UserDuty":
                    cu.LoadDutyUser();
                    returnstr = cu.DutyUser.Name.value.ToString();
                    break;

                case "PRCS_Z_UserDept":
                    cu.LoadEmployeeUser();
                    cu.LoadMyDepartment();
                    returnstr = cu.MyDepartMent.Name.ToString();
                    break;

                case "PRCS_Z_UserSupDept":
                    cu.LoadEmployeeUser();
                    cu.LoadMyDepartment();
                    WX.Model.Department.MODEL dept2 = WX.Model.Department.GetCache(cu.MyDepartMent.ParentID.ToInt32());
                    //WX.Model.Department.GetModel("select * from TE_Departments where ID=" + cu.MyDepartMent.ParentID.ToString());
                    returnstr = dept2.Name.value.ToString();
                    break;

                case "PRCS_ID": returnstr = Convert.ToInt32(HttpContext.Current.Request.QueryString["Step_Id"]).ToString(); break;

                case "Datetime_Now": returnstr = DateTime.Now.ToString("yyyy-MM-dd"); break;

                default: break;
                }
                return(returnstr);
            }
Пример #6
0
        //此函数暂未用到(可删除)
        public static int GetPermission(int funcID)
        {
            int flag = 0;

            WX.WXUser user = WX.Main.NewCurUser();
            user.LoadDutyUser(false);
            WX.Model.Function.MODEL funcM = WX.Model.Function.GetCache(funcID);
            if (funcM != null)
            {
                if (GetFuncState(funcM) > 0)
                {
                    flag = GetPermission(user.DutyUser, funcM);
                }
                else
                {
                    flag = 0;
                }
            }
            else
            {
                flag = 3;
            }
            return(flag);
        }