コード例 #1
0
        protected void ShowUserManager()
        {
            QJVRMS.Business.Group userGroup = new QJVRMS.Business.Group(CurrentGroupId);

            string loginName = this.txtSeaLoginName.Text.Trim().Replace("'", "''");
            string userName  = this.txtSeaName.Text.Trim().Replace("'", "''");

            string sql = string.Empty;

            if (loginName != string.Empty)
            {
                sql += " loginName like '%" + loginName + "%'";
            }

            if (userName != string.Empty)
            {
                if (sql != string.Empty)
                {
                    sql += " and UserName like '%" + userName + "%'";
                }
                else
                {
                    sql += "  UserName like '%" + userName + "%'";
                }
            }


            if (!IsSuperAdmin)
            {
                if (sql != string.Empty)
                {
                    sql += " and UserId <> '" + CommonInfo.SuperAdminId + "'";
                }
                else
                {
                    sql += "  UserId <> '" + CommonInfo.SuperAdminId + "'";
                }
            }

            if (string.IsNullOrEmpty(sql))
            {
                sql += "  IsLocked=" + this.Status.SelectedValue;
            }
            else
            {
                sql += " And IsLocked=" + this.Status.SelectedValue;
            }
            DataTable dt = userGroup.SelectUsers(sql);

            dt.DefaultView.Sort = "UserName ASC";
            DataTable dtTemp = dt.DefaultView.ToTable();


            this.userList.DataSource = dtTemp;
            this.userList.DataBind();
        }
コード例 #2
0
ファイル: CatalogManager.aspx.cs プロジェクト: rongcheng/benz
        protected void btnSearchUser_Click(object sender, EventArgs e)
        {
            QJVRMS.Business.Group userGroup = new QJVRMS.Business.Group(CurrentGroupId);
            DataTable             dt        = userGroup.SelectUsers(this.txtloginName.Text.Trim(), this.txtUserName.Text.Trim());



            Hashtable userRules = new Hashtable();
            Dictionary <int, string> methodDict = WebUI.UIBiz.CommonInfo.GetMethodDict();

            foreach (DataRow row in dt.Rows)
            {
                ISecurityObject   securityObj = new SecurityObject(new Guid(this.hiCurrentCataId.Value), SecurityObjectType.Items);
                List <ObjectRule> rules       = new List <ObjectRule>();
                User user = new User(new Guid(row["userId"].ToString()));

                foreach (KeyValuePair <int, string> methodEntry in methodDict)
                {
                    OperatorMethod method = (OperatorMethod)((int)methodEntry.Key);
                    ObjectRule     rule   = new ObjectRule(securityObj, user, method);

                    rules.Add(rule);
                }

                userRules.Add(user, rules);

                ObjectRule.CheckRules(rules);
            }


            foreach (KeyValuePair <int, string> methodEntry in methodDict)
            {
                string mIndex = methodEntry.Key.ToString();
                dt.Columns.Add(mIndex, typeof(bool));
            }

            foreach (DictionaryEntry entry in userRules)
            {
                User user = entry.Key as User;
                List <ObjectRule> rules = entry.Value as List <ObjectRule>;

                DataRow[] users = dt.Select("userId='" + user.UserId.ToString() + "'");

                foreach (IRule rule in rules)
                {
                    string methodKey = ((int)rule.Method).ToString();
                    users[0][methodKey] = rule.IsValidate;
                }
            }

            this.userList.DataSource = dt;
            this.userList.DataBind();
        }
コード例 #3
0
ファイル: UserManager.aspx.cs プロジェクト: rongcheng/benz
        protected void ShowUserManager()
        {
            QJVRMS.Business.Group userGroup = new QJVRMS.Business.Group(CurrentGroupId);

            string loginName = this.txtSeaLoginName.Text.Trim().Replace("'", "''");
            string userName = this.txtSeaName.Text.Trim().Replace("'", "''");

            string sql = string.Empty;

            if (loginName != string.Empty)
            {
                sql += " loginName like '%" + loginName + "%'";
            }

            if (userName != string.Empty)
            {
                if (sql != string.Empty)
                    sql += " and UserName like '%" + userName + "%'";
                else
                    sql += "  UserName like '%" + userName + "%'";
            }


            if (!IsSuperAdmin)
            {
                if (sql != string.Empty)
                    sql += " and UserId <> '" + CommonInfo.SuperAdminId + "'";
                else
                    sql += "  UserId <> '" + CommonInfo.SuperAdminId + "'";
            }

            if (string.IsNullOrEmpty(sql))
            {
                sql += "  IsLocked="+this.Status.SelectedValue;
            }
            else
            {
                sql += " And IsLocked="+this.Status.SelectedValue;
            }
            DataTable dt = userGroup.SelectUsers(sql);

            dt.DefaultView.Sort = "UserName ASC";
            DataTable dtTemp = dt.DefaultView.ToTable();


            this.userList.DataSource = dtTemp;
            this.userList.DataBind();
        }
コード例 #4
0
ファイル: CatalogManager.aspx.cs プロジェクト: rongcheng/benz
        protected void btnSearchUser_Click(object sender, EventArgs e)
        {
            QJVRMS.Business.Group userGroup = new QJVRMS.Business.Group(CurrentGroupId);
            DataTable dt = userGroup.SelectUsers(this.txtloginName.Text.Trim(), this.txtUserName.Text.Trim());



            Hashtable userRules = new Hashtable();
            Dictionary<int, string> methodDict = WebUI.UIBiz.CommonInfo.GetMethodDict();
            foreach (DataRow row in dt.Rows)
            {
                ISecurityObject securityObj = new SecurityObject(new Guid(this.hiCurrentCataId.Value), SecurityObjectType.Items);
                List<ObjectRule> rules = new List<ObjectRule>();
                User user = new User(new Guid(row["userId"].ToString()));

                foreach (KeyValuePair<int, string> methodEntry in methodDict)
                {
                    OperatorMethod method = (OperatorMethod)((int)methodEntry.Key);
                    ObjectRule rule = new ObjectRule(securityObj, user, method);

                    rules.Add(rule);
                }

                userRules.Add(user, rules);

                ObjectRule.CheckRules(rules);
            }


            foreach (KeyValuePair<int, string> methodEntry in methodDict)
            {
                string mIndex = methodEntry.Key.ToString();
                dt.Columns.Add(mIndex, typeof(bool));
            }

            foreach (DictionaryEntry entry in userRules)
            {
                User user = entry.Key as User;
                List<ObjectRule> rules = entry.Value as List<ObjectRule>;

                DataRow[] users = dt.Select("userId='" + user.UserId.ToString() + "'");

                foreach (IRule rule in rules)
                {
                    string methodKey = ((int)rule.Method).ToString();
                    users[0][methodKey] = rule.IsValidate;
                }



            }

            this.userList.DataSource = dt;
            this.userList.DataBind();
        }
コード例 #5
0
ファイル: Group.cs プロジェクト: rongcheng/benz
        public static IGroup GetRootGroup()
        {
            QJVRMS.Business.GroupWS.GroupService gs = new QJVRMS.Business.GroupWS.GroupService();
            using (DataTable dt = gs.GetRootGroup())
            {
                if (dt.Rows.Count > 0)
                {
                    DataRow row = dt.Rows[0];
                    Guid groupId = new Guid(row["groupId"].ToString());
                    string groupName = row["groupName"].ToString();
                    string des = row["Description"].ToString();
                    DateTime cDate = DateTime.Parse(row["CreateDate"].ToString());
                    Group g = new Group(groupId, groupName, des, cDate);

                    return g;
                }
            }

            return null;
        }