Пример #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }
            if (IsPostBack)
            {
                return;
            }

            BreadCrumbUser(AppManager.User.LeftMenu.UserConfiguration, "投稿基本设置", AppManager.User.Permission.UserConfiguration);

            EBooleanUtils.AddListItems(DdlIsWritingEnabled, "开启", "关闭");
            ControlUtils.SelectListItemsIgnoreCase(DdlIsWritingEnabled, ConfigManager.UserConfigInfo.IsWritingEnabled.ToString());
            PhWriting.Visible = ConfigManager.UserConfigInfo.IsWritingEnabled;

            var pairList         = new List <KeyValuePair <int, string> >();
            var defaultGroupInfo = UserGroupManager.GetDefaultGroupInfo();

            pairList.Add(new KeyValuePair <int, string>(defaultGroupInfo.GroupId, defaultGroupInfo.GroupName));
            var groupInfoList = UserGroupManager.GetGroupInfoList();

            foreach (var groupInfo in groupInfoList)
            {
                if (groupInfo.GroupId != defaultGroupInfo.GroupId)
                {
                    pairList.Add(new KeyValuePair <int, string>(groupInfo.GroupId, groupInfo.GroupName));
                }
            }

            RptGroup.DataSource     = pairList;
            RptGroup.ItemDataBound += RptGroup_ItemDataBound;
            RptGroup.DataBind();
        }
Пример #2
0
        public void BindGrid()
        {
            var userGroupInfoList = UserGroupManager.GetGroupInfoList();

            MyDataGrid.DataSource     = userGroupInfoList;
            MyDataGrid.ItemDataBound += MyDataGrid_ItemDataBound;
            MyDataGrid.DataBind();
        }
Пример #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));

            if (!IsPostBack)
            {
                var userGroupInfoList = UserGroupManager.GetGroupInfoList();
                foreach (var theUserGroupInfo in userGroupInfoList)
                {
                    var listItem = new ListItem(theUserGroupInfo.GroupName, theUserGroupInfo.GroupId.ToString());
                    UserGroupIDDropDownList.Items.Add(listItem);
                }
            }
        }
Пример #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));
                try
                {
                    foreach (var userId in userIdList)
                    {
                        BaiRongDataProvider.UserDao.Delete(userId);
                    }

                    Body.AddAdminLog("删除用户", string.Empty);

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (Body.IsQueryExists("Lock"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));
                try
                {
                    BaiRongDataProvider.UserDao.Lock(userIdList);

                    Body.AddAdminLog("锁定用户", string.Empty);

                    SuccessMessage("成功锁定所选会员!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "锁定所选会员失败!");
                }
            }
            else if (Body.IsQueryExists("UnLock"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));
                try
                {
                    BaiRongDataProvider.UserDao.UnLock(userIdList);

                    Body.AddAdminLog("解除锁定用户", string.Empty);

                    SuccessMessage("成功解除锁定所选会员!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "解除锁定所选会员失败!");
                }
            }

            SpContents.ControlToPaginate = RptContents;

            if (string.IsNullOrEmpty(Body.GetQueryString("GroupID")))
            {
                SpContents.ItemsPerPage = TranslateUtils.ToInt(DdlPageNum.SelectedValue) == 0 ? 25 : TranslateUtils.ToInt(DdlPageNum.SelectedValue);

                SpContents.SelectCommand = BaiRongDataProvider.UserDao.GetSelectCommandAll(true, Body.GetQueryInt("UserTypeId"));
            }
            else
            {
                SpContents.ItemsPerPage  = Body.GetQueryInt("PageNum") == 0 ? StringUtils.Constants.PageSize : Body.GetQueryInt("PageNum");
                SpContents.SelectCommand = BaiRongDataProvider.UserDao.GetSelectCommandAll(Body.GetQueryString("Keyword"), Body.GetQueryInt("CreationDate"), Body.GetQueryInt("LastActivityDate"), true, Body.GetQueryInt("GroupID"), Body.GetQueryInt("LoginCount"), Body.GetQueryString("SearchType"), Body.GetQueryInt("TypeId"));
            }

            RptContents.ItemDataBound += rptContents_ItemDataBound;
            SpContents.SortField       = BaiRongDataProvider.UserDao.GetSortFieldName();
            SpContents.SortMode        = SortMode.DESC;

            _lockType = EUserLockTypeUtils.GetEnumType(ConfigManager.UserConfigInfo.LoginLockingType);

            if (IsPostBack)
            {
                return;
            }

            BreadCrumbUser(AppManager.User.LeftMenu.UserManagement, "用户管理", AppManager.User.Permission.UserManagement);

            var theListItem = new ListItem("全部", "0")
            {
                Selected = true
            };

            DdlGroup.Items.Add(theListItem);
            var groupInfoList = UserGroupManager.GetGroupInfoList();

            foreach (var userGroupInfo in groupInfoList)
            {
                var listitem = new ListItem(userGroupInfo.GroupName, userGroupInfo.GroupId.ToString());
                DdlGroup.Items.Add(listitem);
            }

            //添加隐藏属性
            DdlSearchType.Items.Add(new ListItem("用户ID", "userID"));
            DdlSearchType.Items.Add(new ListItem("用户名", "userName"));
            DdlSearchType.Items.Add(new ListItem("邮箱", "email"));
            DdlSearchType.Items.Add(new ListItem("手机", "mobile"));

            //默认选择用户名
            DdlSearchType.SelectedValue = "userName";

            if (!string.IsNullOrEmpty(Body.GetQueryString("SearchType")))
            {
                ControlUtils.SelectListItems(DdlSearchType, Body.GetQueryString("SearchType"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("GroupID")))
            {
                ControlUtils.SelectListItems(DdlGroup, Body.GetQueryString("GroupID"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("PageNum")))
            {
                ControlUtils.SelectListItems(DdlPageNum, Body.GetQueryString("PageNum"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("LoginCount")))
            {
                ControlUtils.SelectListItems(DdlLoginCount, Body.GetQueryString("LoginCount"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("Keyword")))
            {
                TbKeyword.Text = Body.GetQueryString("Keyword");
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("CreationDate")))
            {
                ControlUtils.SelectListItems(DdlCreationDate, Body.GetQueryString("CreationDate"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("LastActivityDate")))
            {
                ControlUtils.SelectListItems(DdlLastActivityDate, Body.GetQueryString("LastActivityDate"));
            }

            var showPopWinString = ModalAddToUserGroup.GetOpenWindowString();
            // BtnAddToGroup.Attributes.Add("onclick", showPopWinString);

            var backgroundUrl = GetRedirectUrl();

            BtnAdd.Attributes.Add("onclick",
                                  $"location.href='{PageUserAdd.GetRedirectUrlToAdd(PageUrl)}';return false;");

            BtnLock.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                       $"{backgroundUrl}?Lock=True", "UserIDCollection", "UserIDCollection", "请选择需要锁定的会员!", "此操作将锁定所选会员,确认吗?"));

            BtnUnLock.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                         $"{backgroundUrl}?UnLock=True", "UserIDCollection", "UserIDCollection", "请选择需要解除锁定的会员!", "此操作将解除锁定所选会员,确认吗?"));

            BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                         $"{backgroundUrl}?Delete=True", "UserIDCollection", "UserIDCollection", "请选择需要删除的会员!", "此操作将删除所选会员,确认吗?"));

            //BtnImport.Attributes.Add("onclick", ModalUserImport.GetOpenWindowString());

            //BtnExport.Attributes.Add("onclick", ModalUserExport.GetOpenWindowString());

            SpContents.DataBind();
        }