Exemplo n.º 1
0
        public IHttpActionResult Get()
        {
            try
            {
                var request = new RequestImpl();
                if (!request.IsAdminLoggin ||
                    !request.AdminPermissionsImpl.HasSystemPermissions(ConfigManager.SettingsPermissions.User))
                {
                    return(Unauthorized());
                }

                return(Ok(new
                {
                    Value = UserMenuManager.GetAllUserMenuInfoList(),
                    Groups = UserGroupManager.GetUserGroupInfoList()
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
        public IHttpActionResult Main()
        {
            try
            {
                var body = new RequestBody();
                if (!body.IsUserLoggin)
                {
                    return(Unauthorized());
                }

                var groupInfo     = UserGroupManager.GetGroupInfo(body.UserInfo.GroupId);
                var adminUserName = groupInfo.Additional.WritingAdminUserName;

                var publishmentSystemInfoList = PublishmentSystemManager.GetWritingPublishmentSystemInfoList(adminUserName);

                return(Ok(publishmentSystemInfoList));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
 public ClientNotificationsDataController(PageManager pageManager,
                                          SiteContext siteContext,
                                          NotificationManager notificationManager,
                                          UserGroupManager userGroupManager,
                                          SiteManager siteManager,
                                          ILogger <SecurityPoolManager> logger,
                                          IJobsManager jobs,
                                          ClientManager clientManager,
                                          UserContext userContext,
                                          ClientAdminContextAccessor clientContextAccessor,
                                          IAuthorizationService authorizationService,
                                          IOptions <RequestLocalizationOptions> localizationOptions) : base(clientContextAccessor, authorizationService, logger)
 {
     _pageManager         = pageManager;
     _notificationManager = notificationManager;
     _userGroupManager    = userGroupManager;
     _siteManager         = siteManager;
     _clientManager       = clientManager;
     _jobs                = jobs;
     _userContext         = userContext;
     _localizationOptions = localizationOptions;
 }
 public SiteNotificationsDataController(PageManager pageManager,
                                        SiteContext siteContext,
                                        NotificationManager notificationManager,
                                        UserGroupManager userGroupManager,
                                        SiteManager siteManager,
                                        ILogger <SecurityPoolManager> logger,
                                        IJobsManager jobs,
                                        ClientManager clientManager,
                                        UserContext userContext,
                                        SiteAdminContextAccessor siteContextAccessor,
                                        IContextAccessor <UserContext> userContextAccessor,
                                        IOptions <RequestLocalizationOptions> localizationOptions) : base(siteContextAccessor, logger)
 {
     _pageManager         = pageManager;
     _notificationManager = notificationManager;
     _userGroupManager    = userGroupManager;
     _siteManager         = siteManager;
     _clientManager       = clientManager;
     _jobs                = jobs;
     _userContext         = userContext;
     _userContextAccessor = userContextAccessor;
     _localizationOptions = localizationOptions;
 }
Exemplo n.º 5
0
        public void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var userInfo = new UserInfo(e.Item.DataItem);

            var ltlUserName         = (Literal)e.Item.FindControl("ltlUserName");
            var ltlDisplayName      = (Literal)e.Item.FindControl("ltlDisplayName");
            var ltlGroupName        = (Literal)e.Item.FindControl("ltlGroupName");
            var ltlEmail            = (Literal)e.Item.FindControl("ltlEmail");
            var ltlMobile           = (Literal)e.Item.FindControl("ltlMobile");
            var ltlLastActivityDate = (Literal)e.Item.FindControl("ltlLastActivityDate");
            var ltlLoginCount       = (Literal)e.Item.FindControl("ltlLoginCount");
            var ltlCreationDate     = (Literal)e.Item.FindControl("ltlCreationDate");
            var ltlWritingCount     = (Literal)e.Item.FindControl("ltlWritingCount");
            var ltlSelect           = (Literal)e.Item.FindControl("ltlSelect");
            var hlChangePassword    = (HyperLink)e.Item.FindControl("hlChangePassword");
            var hlEditLink          = (HyperLink)e.Item.FindControl("hlEditLink");

            ltlUserName.Text         = GetUserNameHtml(userInfo);
            ltlDisplayName.Text      = userInfo.DisplayName;
            ltlEmail.Text            = userInfo.Email;
            ltlMobile.Text           = userInfo.Mobile;
            ltlGroupName.Text        = UserGroupManager.GetGroupName(userInfo.GroupId);
            ltlLastActivityDate.Text = DateUtils.GetDateAndTimeString(userInfo.LastActivityDate);
            ltlLoginCount.Text       = userInfo.CountOfLogin.ToString();
            ltlCreationDate.Text     = DateUtils.GetDateAndTimeString(userInfo.CreateDate);

            hlEditLink.NavigateUrl = PageUserAdd.GetRedirectUrlToEdit(userInfo.UserId, GetRedirectUrl());
            hlChangePassword.Attributes.Add("onclick", ModalUserPassword.GetOpenWindowString(userInfo.UserName));
            ltlSelect.Text = $@"<input type=""checkbox"" name=""UserIDCollection"" value=""{userInfo.UserId}"" />";

            ltlWritingCount.Text = userInfo.CountOfWriting.ToString();
        }
Exemplo n.º 6
0
        public int Insert(UserGroupInfo groupInfo)
        {
            int groupId;

            var sqlString = "INSERT INTO bairong_UserGroup (GroupName, IsDefault, Description, ExtendValues) VALUES (@GroupName, @IsDefault, @Description, @ExtendValues)";

            var insertParms = new IDataParameter[]
            {
                GetParameter(ParmGroupName, EDataType.NVarChar, 50, groupInfo.GroupName),
                GetParameter(ParmIsDefault, EDataType.VarChar, 18, groupInfo.IsDefault.ToString()),
                GetParameter(ParmDescription, EDataType.NVarChar, 255, groupInfo.Description),
                GetParameter(ParmExtendValues, EDataType.NText, groupInfo.Additional.ToString())
            };

            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        groupId = ExecuteNonQueryAndReturnId(trans, sqlString, insertParms);
                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            UserGroupManager.ClearCache();

            return(groupId);
        }
Exemplo n.º 7
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var userName = Request.QueryString["UserName"];

            _userInfo = BaiRongDataProvider.UserDao.GetUserInfoByAccount(userName);

            ltlUserID.Text                = _userInfo.UserId.ToString();
            ltlUserName.Text              = _userInfo.UserName;
            ltlGroup.Text                 = UserGroupManager.GetGroupName(_userInfo.GroupId);
            ltlDisplayName.Text           = _userInfo.DisplayName;
            ltlCreateDate.Text            = DateUtils.GetDateAndTimeString(_userInfo.CreateDate);
            ltlLastActivityDate.Text      = DateUtils.GetDateAndTimeString(_userInfo.LastActivityDate);
            ltlLastResetPasswordDate.Text = DateUtils.GetDateAndTimeString(_userInfo.LastResetPasswordDate);
            ltlEmail.Text                 = _userInfo.Email;
            ltlMobile.Text                = _userInfo.Mobile;
            ltlLoginCount.Text            = _userInfo.CountOfLogin.ToString();
            ltlWritingCount.Text          = _userInfo.CountOfWriting.ToString();
            ltlOrganization.Text          = _userInfo.Organization;
            ltlDepartment.Text            = _userInfo.Department;
            ltlPosition.Text              = _userInfo.Position;
            ltlGender.Text                = _userInfo.Gender;
            ltlBirthday.Text              = _userInfo.Birthday;
            ltlEducation.Text             = _userInfo.Education;
            ltlGraduation.Text            = _userInfo.Graduation;
            ltlAddress.Text               = _userInfo.Address;
            ltlWeiXin.Text                = _userInfo.WeiXin;
            ltlQQ.Text        = _userInfo.Qq;
            ltlWeiBo.Text     = _userInfo.WeiBo;
            ltlInterests.Text = _userInfo.Interests;
            ltlSignature.Text = _userInfo.Signature;
        }
Exemplo n.º 8
0
        public int Insert(UserGroupInfo groupInfo)
        {
            var sqlString =
                $@"
INSERT INTO {TableName} (
    {nameof(UserGroupInfo.GroupName)},
    {nameof(UserGroupInfo.AdminName)}
) VALUES (
    @{nameof(UserGroupInfo.GroupName)},
    @{nameof(UserGroupInfo.AdminName)}
)";

            var parms = new IDataParameter[]
            {
                GetParameter($"@{nameof(UserGroupInfo.GroupName)}", DataType.VarChar, 200, groupInfo.GroupName),
                GetParameter($"@{nameof(UserGroupInfo.AdminName)}", DataType.VarChar, 200, groupInfo.AdminName)
            };

            var groupId = ExecuteNonQueryAndReturnId(TableName, nameof(UserGroupInfo.Id), sqlString, parms);

            UserGroupManager.ClearCache();

            return(groupId);
        }
Exemplo n.º 9
0
        public IHttpActionResult Main()
        {
            try
            {
                var body     = new RequestBody();
                var account  = body.GetPostString("account");
                var password = body.GetPostString("password");

                string userName;
                string errorMessage;
                if (!BaiRongDataProvider.UserDao.ValidateAccount(account, password, out userName, out errorMessage))
                {
                    LogUtils.AddUserLog(userName, EUserActionType.LoginFailed, "用户登录失败");
                    BaiRongDataProvider.UserDao.UpdateLastActivityDateAndCountOfFailedLogin(userName);
                    return(BadRequest(errorMessage));
                }

                BaiRongDataProvider.UserDao.UpdateLastActivityDateAndCountOfLogin(userName);
                var userInfo  = BaiRongDataProvider.UserDao.GetUserInfoByUserName(userName);
                var user      = new User(userInfo);
                var groupInfo = UserGroupManager.GetGroupInfo(user.GroupId);

                body.UserLogin(userName);

                return(Ok(new
                {
                    User = user,
                    Group = groupInfo.Additional
                }));
            }
            catch (Exception ex)
            {
                //return InternalServerError(ex);
                return(InternalServerError(new Exception("程序错误")));
            }
        }
Exemplo n.º 10
0
        public static void createSSAEktronMember(string PIN)
        {
            //try
            //{

            Dictionary<string, string> UserDetails = loginSSA.GetUsersDetails(PIN);

            UserManager Usermanager = new UserManager();
            CustomAttributeList attrList = new CustomAttributeList();
            CustomAttribute timeZone = new CustomAttribute();
            timeZone.Name = "Time Zone";
            timeZone.Value = "Eastern Standard Time";
            attrList.Add(timeZone);

            UserData newUserdata = new UserData()
            {
                Username = PIN,
                Password = EktronMemberDefaultPassword,
                FirstName = UserDetails["FirstName"],
                LastName = UserDetails["LastName"],
                DisplayName = UserDetails["DisplayName"],
                Email = UserDetails["Email"],
                CustomProperties = attrList,
                // IsMemberShip = true
            };

            if (Ektron.Cms.Framework.Context.UserContextService.Current.IsLoggedIn)
            {
                Usermanager.Add(newUserdata);
                // add user to group MSBA Members
                UserGroupManager UserGroupmanager = new UserGroupManager();
                //Add a User  to a UserGroup
                UserGroupmanager.AddUser(1, newUserdata.Id);
            }
            //}
            //catch { }
        }
 public async Task AddToGroup()
 {
     IUserGroupManager userMgr = new UserGroupManager(_creds, _mockRepository.Object);
     await userMgr.AddUserToGroup("1ca9441f-59c2-4f58-8a90-3ebbbbacef36", "3b22748d-443d-4d28-ada1-6b4f4437c4b1");
 }
Exemplo n.º 12
0
 /// <summary>
 /// 移除用户组
 /// </summary>
 /// <param name="import">数据集</param>
 /// <returns>返回操作结果</returns>
 public NormalResult RemoveUserGroup(RemoveGroupImport import)
 {
     try
     {
         import.CheckAllowExecuteOrNot(db);
         UserGroupManager manager = new UserGroupManager(db);
         manager.Remove(import);
         return new NormalResult();
     }
     catch (Exception ex)
     {
         return new NormalResult(ex.Message);
     }
 }
Exemplo n.º 13
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();
        }
Exemplo n.º 14
0
 public UserGroupMemberList(UserGroupManager userGroupManager)
 {
     _userGroupManager = userGroupManager;
 }
Exemplo n.º 15
0
        public IHttpActionResult Main()
        {
            try
            {
                var body = new RequestBody();
                if (!body.IsUserLoggin)
                {
                    return(Unauthorized());
                }

                var publishmentSystemId = body.GetPostInt("publishmentSystemId");
                var nodeId = body.GetPostInt("nodeId");

                var searchType = PageUtils.FilterSqlAndXss(body.GetPostString("searchType"));
                var keyword    = PageUtils.FilterSqlAndXss(body.GetPostString("keyword"));
                var dateFrom   = PageUtils.FilterSqlAndXss(body.GetPostString("dateFrom"));
                var dateTo     = PageUtils.FilterSqlAndXss(body.GetPostString("dateTo"));
                var page       = body.GetPostInt("page");

                var user          = new User(body.UserInfo);
                var groupInfo     = UserGroupManager.GetGroupInfo(user.GroupId);
                var adminUserName = groupInfo.Additional.WritingAdminUserName;

                var nodeIdList = new List <int> {
                    nodeId
                };

                var writingNodeInfoList = PublishmentSystemManager.GetWritingNodeInfoList(adminUserName, publishmentSystemId);
                foreach (var writingNodeInfo in writingNodeInfoList)
                {
                    if (StringUtils.In(writingNodeInfo.ParentsPath, nodeId.ToString()))
                    {
                        nodeIdList.Add(writingNodeInfo.NodeId);
                    }
                }

                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
                var nodeInfo          = NodeManager.GetNodeInfo(publishmentSystemId, nodeId);
                var tableName         = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo);
                var tableStyle        = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo);
                var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemId, nodeId);

                var sqlString = DataProvider.ContentDao.GetWritingSelectCommend(user.UserName, tableName, publishmentSystemId, nodeIdList, searchType, keyword, dateFrom, dateTo);

                var results  = new List <Dictionary <string, object> >();
                var sqlPager = new SqlPager
                {
                    ItemsPerPage  = 20,
                    SelectCommand = sqlString,
                    OrderByString = ETaxisTypeUtils.GetOrderByString(tableStyle, ETaxisType.OrderByAddDateDesc)
                };

                sqlPager.DataBind(page);

                if (sqlPager.TotalCount > 0)
                {
                    foreach (System.Data.DataRowView row in sqlPager.PagedDataSource.DataSource)
                    {
                        var contentInfo = new ContentInfo(row);
                        results.Add(ContentUtility.ContentToDictionary(contentInfo, tableStyle, tableName, relatedIdentities));
                    }
                }

                return(Ok(new
                {
                    Results = results,
                    TotalPage = sqlPager.TotalPages
                }));
            }
            catch (Exception ex)
            {
                //return InternalServerError(ex);
                return(InternalServerError(new Exception("程序错误")));
            }
        }
Exemplo n.º 16
0
 public UserGroupMemberCreate(UserGroupManager userGroupManager, EnumLocalizer enumLocalizer)
 {
     _userGroupManager = userGroupManager;
     _enumLocalizer    = enumLocalizer;
 }
Exemplo n.º 17
0
        internal static string Parse(string stlEntity, PageInfo pageInfo)
        {
            var parsedContent = string.Empty;

            if (pageInfo?.UserInfo == null)
            {
                return(string.Empty);
            }

            try
            {
                var entityName    = StlParserUtility.GetNameFromEntity(stlEntity);
                var attributeName = entityName.Substring(6, entityName.Length - 7);

                if (StringUtils.EqualsIgnoreCase(GroupName, attributeName))
                {
                    parsedContent = UserGroupManager.GetGroupName(pageInfo.UserInfo.GroupId);
                }

                else if (StringUtils.EqualsIgnoreCase(UserId, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.UserId.ToString();
                }
                else if (StringUtils.EqualsIgnoreCase(UserName, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.UserName;
                }
                else if (StringUtils.EqualsIgnoreCase(GroupId, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.GroupId.ToString();
                }
                else if (StringUtils.EqualsIgnoreCase(CreateDate, attributeName))
                {
                    parsedContent = DateUtils.Format(pageInfo.UserInfo.CreateDate, string.Empty);
                }
                else if (StringUtils.EqualsIgnoreCase(LastActivityDate, attributeName))
                {
                    parsedContent = DateUtils.Format(pageInfo.UserInfo.LastActivityDate, string.Empty);
                }
                else if (StringUtils.EqualsIgnoreCase(CountOfLogin, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.CountOfLogin.ToString();
                }
                else if (StringUtils.EqualsIgnoreCase(CountOfWriting, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.CountOfWriting.ToString();
                }
                else if (StringUtils.EqualsIgnoreCase(DisplayName, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.DisplayName;
                }
                else if (StringUtils.EqualsIgnoreCase(Email, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Email;
                }
                else if (StringUtils.EqualsIgnoreCase(Mobile, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Mobile;
                }
                else if (StringUtils.EqualsIgnoreCase(AvatarUrl, attributeName))
                {
                    parsedContent = PageUtility.GetUserAvatarUrl(pageInfo.ApiUrl, pageInfo.UserInfo);
                }
                else if (StringUtils.EqualsIgnoreCase(Organization, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Organization;
                }
                else if (StringUtils.EqualsIgnoreCase(Department, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Department;
                }
                else if (StringUtils.EqualsIgnoreCase(Position, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Position;
                }
                else if (StringUtils.EqualsIgnoreCase(Gender, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Gender;
                }
                else if (StringUtils.EqualsIgnoreCase(Birthday, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Birthday;
                }
                else if (StringUtils.EqualsIgnoreCase(Education, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Education;
                }
                else if (StringUtils.EqualsIgnoreCase(Graduation, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Graduation;
                }
                else if (StringUtils.EqualsIgnoreCase(Address, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Address;
                }
                else if (StringUtils.EqualsIgnoreCase(WeiXin, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.WeiXin;
                }
                else if (StringUtils.EqualsIgnoreCase(Qq, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Qq;
                }
                else if (StringUtils.EqualsIgnoreCase(WeiBo, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.WeiBo;
                }
                else if (StringUtils.EqualsIgnoreCase(Interests, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Interests;
                }
                else if (StringUtils.EqualsIgnoreCase(Signature, attributeName))
                {
                    parsedContent = pageInfo.UserInfo.Signature;
                }
                else
                {
                    parsedContent = pageInfo.UserInfo.Additional.GetExtendedAttribute(attributeName);
                }
            }
            catch
            {
                // ignored
            }

            return(parsedContent);
        }
Exemplo n.º 18
0
        private void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            if (e.Item.DataItem == null)
            {
                return;
            }

            var id                 = SqlUtils.EvalInt(e.Item.DataItem, nameof(UserInfo.Id));
            var userName           = SqlUtils.EvalString(e.Item.DataItem, nameof(UserInfo.UserName));
            var createDate         = SqlUtils.EvalDateTime(e.Item.DataItem, nameof(UserInfo.CreateDate));
            var lastActivityDate   = SqlUtils.EvalDateTime(e.Item.DataItem, nameof(UserInfo.LastActivityDate));
            var countOfLogin       = SqlUtils.EvalInt(e.Item.DataItem, nameof(UserInfo.CountOfLogin));
            var countOfFailedLogin = SqlUtils.EvalInt(e.Item.DataItem, nameof(UserInfo.CountOfFailedLogin));
            var groupId            = SqlUtils.EvalInt(e.Item.DataItem, nameof(UserInfo.GroupId));
            var isChecked          = SqlUtils.EvalBool(e.Item.DataItem, nameof(UserInfo.IsChecked));
            var isLockedOut        = SqlUtils.EvalBool(e.Item.DataItem, nameof(UserInfo.IsLockedOut));
            var displayName        = SqlUtils.EvalString(e.Item.DataItem, nameof(UserInfo.DisplayName));
            var email              = SqlUtils.EvalString(e.Item.DataItem, nameof(UserInfo.Email));
            var mobile             = SqlUtils.EvalString(e.Item.DataItem, nameof(UserInfo.Mobile));

            var ltlUserName      = (Literal)e.Item.FindControl("ltlUserName");
            var ltlEmail         = (Literal)e.Item.FindControl("ltlEmail");
            var ltlMobile        = (Literal)e.Item.FindControl("ltlMobile");
            var ltlGroupName     = (Literal)e.Item.FindControl("ltlGroupName");
            var ltlLoginCount    = (Literal)e.Item.FindControl("ltlLoginCount");
            var ltlCreationDate  = (Literal)e.Item.FindControl("ltlCreationDate");
            var ltlSelect        = (Literal)e.Item.FindControl("ltlSelect");
            var hlChangePassword = (HyperLink)e.Item.FindControl("hlChangePassword");
            var hlEditLink       = (HyperLink)e.Item.FindControl("hlEditLink");

            var showPopWinString = ModalUserView.GetOpenWindowString(userName);
            var state            = isChecked ? string.Empty : @"<span style=""color:red;"">[待审核]</span>";

            if (isLockedOut)
            {
                state += @"<span style=""color:red;"">[已锁定]</span>";
            }
            else if (ConfigManager.SystemConfigInfo.IsUserLockLogin &&
                     ConfigManager.SystemConfigInfo.UserLockLoginCount <= countOfFailedLogin)
            {
                if (_lockType == EUserLockType.Forever)
                {
                    state += @"<span style=""color:red;"">[已锁定]</span>";
                }
                else
                {
                    var ts    = new TimeSpan(DateTime.Now.Ticks - lastActivityDate.Ticks);
                    var hours = Convert.ToInt32(ConfigManager.SystemConfigInfo.UserLockLoginHours - ts.TotalHours);
                    if (hours > 0)
                    {
                        state += $@"<span style=""color:red;"">[已锁定{hours}小时]</span>";
                    }
                }
            }

            ltlUserName.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">{userName}</a> {state}";

            if (!string.IsNullOrEmpty(displayName))
            {
                ltlUserName.Text += $"({displayName})";
            }
            ltlEmail.Text        = email;
            ltlMobile.Text       = mobile;
            ltlGroupName.Text    = UserGroupManager.GetUserGroupInfo(groupId).GroupName;
            ltlLoginCount.Text   = countOfLogin.ToString();
            ltlCreationDate.Text = DateUtils.GetDateAndTimeString(createDate);

            hlEditLink.NavigateUrl = PageUserAdd.GetRedirectUrlToEdit(id, GetRedirectUrl());
            hlChangePassword.Attributes.Add("onclick", ModalUserPassword.GetOpenWindowString(userName));
            ltlSelect.Text = $@"<input type=""checkbox"" name=""UserIDCollection"" value=""{id}"" />";
        }
 public async Task RemoveFromGroup()
 {
     IUserGroupManager userMgr = new UserGroupManager(_creds, _mockRepository.Object);
     await userMgr.RemoveUserFromGroup("a59140cc-be94-4e70-9e3b-cad4fe857937", "6968242c-a055-4145-8534-39180046d980");
 }
 public async Task BadGroupRemoveFromGroup()
 {
     IUserGroupManager userMgr = new UserGroupManager(_creds, _mockRepository.Object);
     await userMgr.RemoveUserFromGroup("1ca9441f-59c2-4f58-8a90-3ebbbbacef36", "3");
 }
Exemplo n.º 21
0
 public void GetUserGroupsByUserId()
 {
     var usrm      = new UserGroupManager(constring);
     var allgroups = usrm.GetGroups(1);
 }
Exemplo n.º 22
0
 public void GetUserGroups()
 {
     IUser usr       = new User();
     var   usrm      = new UserGroupManager(constring);
     var   allgroups = usrm.GetGroups(usr);
 }
Exemplo n.º 23
0
        public void NewGroup()
        {
            var groupM = new UserGroupManager(constring);

            groupM.CreateGroup("Administrator");
        }
Exemplo n.º 24
0
 public UserGroupDetailsEdit(UserGroupManager userGroupManager)
 {
     _userGroupManager = userGroupManager;
 }
 public async Task BadUserRemoveFromGroup()
 {
     IUserGroupManager userMgr = new UserGroupManager(_creds, _mockRepository.Object);
     await userMgr.RemoveUserFromGroup("1", "3b22748d-443d-4d28-ada1-6b4f4437c4b1");
 }
Exemplo n.º 26
0
 public NotifyMeList(UserGroupManager userGroupManger, UserManager userManager)
 {
     _userGroupManager = userGroupManger;
     _userManager      = userManager;
 }
 public async Task GetUserGroups()
 {
     IUserGroupManager usrGroupMgr = new UserGroupManager(_creds, _mockRepository.Object);
     var groups = usrGroupMgr.GetUserMemberships("1ca9441f-59c2-4f58-8a90-3ebbbbacef36");
 }
Exemplo n.º 28
0
 public GroupDetailsEdit(UserGroupManager userGroupManager, GroupManager groupManager, IContextAccessor <UserContext> userContextAccessor)
 {
     _userContextAccessor = userContextAccessor;
     _groupManager        = groupManager;
 }
Exemplo n.º 29
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (AuthRequest.IsQueryExists("Check"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("UserIDCollection"));
                DataProvider.UserDao.Check(userIdList);

                SuccessCheckMessage();
            }
            else if (AuthRequest.IsQueryExists("Delete"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("UserIDCollection"));
                try
                {
                    foreach (var userId in userIdList)
                    {
                        var userInfo = UserManager.GetUserInfoByUserId(userId);
                        DataProvider.UserDao.Delete(userInfo);
                    }

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

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

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

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

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

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

            SpContents.ControlToPaginate = RptContents;

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

                SpContents.SelectCommand = DataProvider.UserDao.GetSelectCommand();
            }
            else
            {
                SpContents.ItemsPerPage = AuthRequest.GetQueryInt("PageNum") == 0 ? Constants.PageSize : AuthRequest.GetQueryInt("PageNum");

                SpContents.SelectCommand = DataProvider.UserDao.GetSelectCommand(AuthRequest.GetQueryInt("groupId"), AuthRequest.GetQueryString("keyword"), AuthRequest.GetQueryInt("creationDate"), AuthRequest.GetQueryInt("lastActivityDate"), AuthRequest.GetQueryInt("loginCount"), AuthRequest.GetQueryString("searchType"));
            }

            RptContents.ItemDataBound += rptContents_ItemDataBound;
            SpContents.OrderByString   = "ORDER BY IsChecked, Id DESC";

            _lockType = EUserLockTypeUtils.GetEnumType(ConfigManager.SystemConfigInfo.UserLockLoginType);

            if (IsPostBack)
            {
                return;
            }

            VerifySystemPermissions(ConfigManager.SettingsPermissions.User);

            DdlGroupId.Items.Add(new ListItem("<全部用户组>", "-1"));
            foreach (var groupInfo in UserGroupManager.GetUserGroupInfoList())
            {
                DdlGroupId.Items.Add(new ListItem(groupInfo.GroupName, groupInfo.Id.ToString()));
            }

            //添加隐藏属性
            DdlSearchType.Items.Add(new ListItem("用户Id", UserAttribute.Id));
            DdlSearchType.Items.Add(new ListItem("用户名", UserAttribute.UserName));
            DdlSearchType.Items.Add(new ListItem("邮箱", UserAttribute.Email));
            DdlSearchType.Items.Add(new ListItem("手机", UserAttribute.Mobile));

            //默认选择用户名
            DdlSearchType.SelectedValue = UserAttribute.UserName;

            if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("groupId")))
            {
                ControlUtils.SelectSingleItem(DdlGroupId, AuthRequest.GetQueryString("groupId"));
            }
            if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("searchType")))
            {
                ControlUtils.SelectSingleItem(DdlSearchType, AuthRequest.GetQueryString("searchType"));
            }
            if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("pageNum")))
            {
                ControlUtils.SelectSingleItem(DdlPageNum, AuthRequest.GetQueryString("pageNum"));
            }
            if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("loginCount")))
            {
                ControlUtils.SelectSingleItem(DdlLoginCount, AuthRequest.GetQueryString("loginCount"));
            }
            if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("keyword")))
            {
                TbKeyword.Text = AuthRequest.GetQueryString("keyword");
            }
            if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("creationDate")))
            {
                ControlUtils.SelectSingleItem(DdlCreationDate, AuthRequest.GetQueryString("creationDate"));
            }
            if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("lastActivityDate")))
            {
                ControlUtils.SelectSingleItem(DdlLastActivityDate, AuthRequest.GetQueryString("lastActivityDate"));
            }

            var backgroundUrl = GetRedirectUrl();

            BtnCheck.Attributes.Add("onclick",
                                    PageUtils.GetRedirectStringWithCheckBoxValueAndAlert($"{backgroundUrl}?Check=True", "UserIDCollection",
                                                                                         "UserIDCollection", "请选择需要审核的会员!", "此操作将审核通过所选会员,确认吗?"));

            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", "请选择需要删除的会员!", "此操作将删除所选会员,确认吗?"));

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

            SpContents.DataBind();
        }
Exemplo n.º 30
0
        public IHttpActionResult Submit([FromBody] UserGroupInfo itemObj)
        {
            try
            {
                var request = new AuthenticatedRequest();
                if (!request.IsAdminLoggin ||
                    !request.AdminPermissionsImpl.HasSystemPermissions(ConfigManager.SettingsPermissions.User))
                {
                    return(Unauthorized());
                }

                if (itemObj.Id == -1)
                {
                    if (UserGroupManager.IsExists(itemObj.GroupName))
                    {
                        return(BadRequest("保存失败,已存在相同名称的用户组!"));
                    }

                    var groupInfo = new UserGroupInfo
                    {
                        GroupName = itemObj.GroupName,
                        AdminName = itemObj.AdminName
                    };

                    DataProvider.UserGroupDao.Insert(groupInfo);

                    request.AddAdminLog("新增用户组", $"用户组:{groupInfo.GroupName}");
                }
                else if (itemObj.Id == 0)
                {
                    ConfigManager.SystemConfigInfo.UserDefaultGroupAdminName = itemObj.AdminName;

                    DataProvider.ConfigDao.Update(ConfigManager.Instance);

                    UserGroupManager.ClearCache();

                    request.AddAdminLog("修改用户组", "用户组:默认用户组");
                }
                else if (itemObj.Id > 0)
                {
                    var groupInfo = UserGroupManager.GetUserGroupInfo(itemObj.Id);

                    if (groupInfo.GroupName != itemObj.GroupName && UserGroupManager.IsExists(itemObj.GroupName))
                    {
                        return(BadRequest("保存失败,已存在相同名称的用户组!"));
                    }

                    groupInfo.GroupName = itemObj.GroupName;
                    groupInfo.AdminName = itemObj.AdminName;

                    DataProvider.UserGroupDao.Update(groupInfo);

                    request.AddAdminLog("修改用户组", $"用户组:{groupInfo.GroupName}");
                }

                return(Ok(new
                {
                    Value = UserGroupManager.GetUserGroupInfoList()
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Exemplo n.º 31
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "")
            {
                IQCareMsgBox.Show("SessionExpired", this);
                Response.Redirect("~/frmlogin.aspx", true);
            }
            //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Visible = false;
            //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = "User Group Administration";

            if (Request.QueryString["name"] != null)
            {
                lblh3.Text = Request.QueryString["name"];
            }
            try
            {
                if (Page.IsPostBack != true)
                {
                    if (Request.QueryString["name"] != null)
                    {
                        AunthenticationFunction();
                    }
                    if (lblh3.Text == "Add")
                    {
                        MsgBuilder theBuilder = new MsgBuilder();
                        theBuilder.DataElements["Name"] = "User Group Roles";
                        IQCareMsgBox.ShowConfirm("UserGroupDetailSaveRecord", theBuilder, btnsave);
                        lblh3.Text = "Add User Group";
                    }
                    else
                    {
                        MsgBuilder theBuilder = new MsgBuilder();
                        theBuilder.DataElements["Name"] = "User Group Roles";
                        IQCareMsgBox.ShowConfirm("UserGroupDetailUpdateRecord", theBuilder, btnsave);
                        lblh3.Text = "Edit User Group";
                    }

                    if (Request.QueryString["name"] != null && Request.QueryString["name"] == "Edit")
                    {
                        GroupId = Convert.ToInt32(Request.QueryString["GroupID"]);
                        IUserRole UserGroupManager;
                        UserGroupManager = (IUserRole)ObjectFactory.CreateInstance("BusinessProcess.Administration.BUserRole, BusinessProcess.Administration");
                        DataSet       theDS       = UserGroupManager.GetUserGroupFeatureList(1, 0);
                        BindFunctions BindManager = new BindFunctions();
                        DataView      DVDD        = new DataView(theDS.Tables[4]);
                        DVDD.RowFilter = "GroupID <> " + GroupId + "";
                        BindManager.BindCombo(ddGroupName, DVDD.ToTable(), "GroupName", "GroupID");
                        ViewState["DataPopulate"] = theDS;
                        //GetGeneralDataforTreeView(theDS.Tables[1]);
                        //GetModuleCustomListTreeView(theDS.Tables[3]);
                        //GetCommonItemsinTreeView(theDS.Tables[0]);
                        //GetSPlPriviledgesinTreeView(theDS.Tables[5]);
                        DataSet theOtherDS = UserGroupManager.GetUserGroupFeatureListByID(GroupId);
                        GetFacilityServiceUserGroupData(theOtherDS);
                        txtusergroupname.Text = Request.QueryString["Grpnm"].ToString();
                    }
                    else if (Request.QueryString["name"] != null && Request.QueryString["name"] == "Add")
                    {
                        IUserRole UserGroupManager;
                        UserGroupManager = (IUserRole)ObjectFactory.CreateInstance("BusinessProcess.Administration.BUserRole, BusinessProcess.Administration");
                        DataSet       theDS       = UserGroupManager.GetUserGroupFeatureList(1, 0);
                        BindFunctions BindManager = new BindFunctions();
                        DataView      DVDD        = new DataView(theDS.Tables[4]);
                        DVDD.RowFilter = "GroupID <> " + GroupId + "";
                        BindManager.BindCombo(ddGroupName, DVDD.ToTable(), "GroupName", "GroupID");
                        ViewState["DataPopulate"] = theDS;
                        //GetGeneralDataforTreeView(theDS.Tables[1]);
                        //GetModuleCustomListTreeView(theDS.Tables[3]);
                        //GetCommonItemsinTreeView(theDS.Tables[0]);
                        //GetSPlPriviledgesinTreeView(theDS.Tables[5]);
                    }
                }
            }
            catch (Exception err)
            {
                MsgBuilder theMsgBuilder = new MsgBuilder();
                theMsgBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theMsgBuilder, this);
                return;
            }
            finally
            {
            }
        }
Exemplo n.º 32
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //(Master.FindControl("lblheader") as Label).Text = "User Group Administration";
        (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Visible = false;
        (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text  = "User Group Administration";

        if (Request.QueryString["name"] != null)
        {
            lblh3.Text = Request.QueryString["name"];
        }
        //grdUserGroupAdminForm.Attributes.Add(  .ClientID + " ',);

        IUserRole UserGroupManager;

        try
        {
            if (Page.IsPostBack != true)
            {
                if (Request.QueryString["name"] != null)
                {
                    AunthenticationFunction();
                }
                Init();

                UserGroupManager = (IUserRole)ObjectFactory.CreateInstance("BusinessProcess.Administration.BUserRole, BusinessProcess.Administration");
                iAllFormCount    = grdUserGroupsForm.Rows.Count;
                iReportsCount    = grdUserGroupsOther.Rows.Count;
                iAdminCount      = grdUserGroupAdminForm.Rows.Count;
                if (iAllFormCount != 0)
                {
                    grdUserGroupsForm.RowDataBound += new GridViewRowEventHandler(grdUserGroupsForm_RowDataBound);
                    grdUserGroupsForm.HeaderRow.Controls[0].Load += new EventHandler(frmAdmin_UserGroup_Load);
                }
                if (iReportsCount != 0)
                {
                    grdUserGroupsOther.RowDataBound += new GridViewRowEventHandler(grdUserGroupsOther_RowDataBound);
                    grdUserGroupsOther.HeaderRow.Controls[0].Load += new EventHandler(frmAdmin_UserGroupOther_Load);
                }
                if (iAdminCount != 0)
                {
                    grdUserGroupAdminForm.HeaderRow.Controls[0].Load += new EventHandler(frmAdmin_AdminForm_Load);
                }
                if (lblh3.Text == "Add")
                {
                    MsgBuilder theBuilder = new MsgBuilder();
                    theBuilder.DataElements["Name"] = "User Group Roles";
                    IQCareMsgBox.ShowConfirm("UserGroupDetailSaveRecord", theBuilder, btnsave);
                    lblh3.Text = "Add User Group";
                }
                else
                {
                    MsgBuilder theBuilder = new MsgBuilder();
                    theBuilder.DataElements["Name"] = "User Group Roles";
                    IQCareMsgBox.ShowConfirm("UserGroupDetailUpdateRecord", theBuilder, btnsave);
                    lblh3.Text = "Edit User Group";
                }

                if (Request.QueryString["name"] != null && Request.QueryString["name"] == "Edit")
                {
                    GroupId = Convert.ToInt32(Request.QueryString["GroupID"]);
                    DataSet theOtherDS = UserGroupManager.GetUserGroupFeatureListByID(GroupId);
                    txtusergroupname.Text = Request.QueryString["Grpnm"].ToString();

                    #region "Fill Functions"

                    int i = 0;
                    if (theOtherDS.Tables[0].Rows.Count > 0)
                    {
                        for (i = 0; i < theOtherDS.Tables[0].Rows.Count; i++)
                        {
                            int j = 0;
                            for (j = 0; j < grdUserGroupsForm.Rows.Count; j++)
                            {
                                if (grdUserGroupsForm.Rows[j].Cells[1].Text == theOtherDS.Tables[0].Rows[i]["featureId"].ToString())
                                {
                                    CheckBox theChkbox = ((CheckBox)grdUserGroupsForm.Rows[j].FindControl("chkFeature"));
                                    theChkbox.Checked = true;
                                    switch (theOtherDS.Tables[0].Rows[i]["functionid"].ToString())
                                    {
                                    case "1":
                                        theChkbox         = ((CheckBox)grdUserGroupsForm.Rows[j].FindControl("chkView"));
                                        theChkbox.Checked = true;
                                        break;

                                    case "2":
                                        theChkbox         = ((CheckBox)grdUserGroupsForm.Rows[j].FindControl("chkUpdate"));
                                        theChkbox.Checked = true;
                                        break;

                                    case "3":
                                        theChkbox         = ((CheckBox)grdUserGroupsForm.Rows[j].FindControl("chkDelete"));
                                        theChkbox.Checked = true;
                                        break;

                                    case "4":
                                        theChkbox         = ((CheckBox)grdUserGroupsForm.Rows[j].FindControl("chkSave"));
                                        theChkbox.Checked = true;
                                        break;

                                    case "5":
                                        theChkbox         = ((CheckBox)grdUserGroupsForm.Rows[j].FindControl("chkPrint"));
                                        theChkbox.Checked = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }

                    if (theOtherDS.Tables[1].Rows.Count > 0)
                    {
                        for (i = 0; i < theOtherDS.Tables[1].Rows.Count; i++)
                        {
                            for (int j = 0; j < grdUserGroupsOther.Rows.Count; j++)
                            {
                                if (grdUserGroupsOther.Rows[j].Cells[1].Text == theOtherDS.Tables[1].Rows[i]["featureId"].ToString())
                                {
                                    CheckBox theChkbox = (CheckBox)grdUserGroupsOther.Rows[j].FindControl("chkFeatureOther");
                                    theChkbox.Checked = true;

                                    switch (theOtherDS.Tables[1].Rows[i]["functionid"].ToString())
                                    {
                                    case "1":
                                        theChkbox         = ((CheckBox)grdUserGroupsOther.Rows[j].FindControl("chkYes"));
                                        theChkbox.Checked = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }


                    if (theOtherDS.Tables[2].Rows.Count > 0)
                    {
                        for (i = 0; i < theOtherDS.Tables[2].Rows.Count; i++)
                        {
                            for (int j = 0; j < grdUserGroupAdminForm.Rows.Count; j++)
                            {
                                if (grdUserGroupAdminForm.Rows[j].Cells[1].Text == theOtherDS.Tables[2].Rows[i]["featureId"].ToString())
                                {
                                    CheckBox theChkbox = (CheckBox)grdUserGroupAdminForm.Rows[j].FindControl("chkForm");
                                    theChkbox.Checked = true;

                                    switch (theOtherDS.Tables[2].Rows[i]["functionid"].ToString())
                                    {
                                    case "1":
                                        theChkbox         = ((CheckBox)grdUserGroupAdminForm.Rows[j].FindControl("chk1Yes"));
                                        theChkbox.Checked = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (theOtherDS.Tables[3].Rows[0]["EnrollmentFlag"].ToString() == "1")
                    {
                        chkspenroll.Checked = true;
                    }
                    if (theOtherDS.Tables[3].Rows[0]["CareEndFlag"].ToString() == "1")
                    {
                        chkCareEndPrivilege.Checked = true;
                    }
                    if (theOtherDS.Tables[3].Rows[0]["IdentifierFlag"].ToString() == "1")
                    {
                        chkpatientIdentifiers.Checked = true;
                    }

                    /////////Not Required - Taken care by the User Authentication///////////
                    ////////////if (Session["AppUserName"].ToString() == "System Admin")
                    ////////////{
                    ////////////    btnsave.Enabled = true;
                    ////////////}
                    ////////////else
                    ////////////{
                    ////////////    btnsave.Enabled = false ;
                    ////////////}
                    ////////////////////////////////////////////////////////////////////////
                    #endregion
                }
            }
        }
        catch (Exception err)
        {
            MsgBuilder theMsgBuilder = new MsgBuilder();
            theMsgBuilder.DataElements["MessageText"] = err.Message.ToString();
            IQCareMsgBox.Show("#C1", theMsgBuilder, this);
            return;
        }
        finally
        {
            UserGroupManager = null;
        }
    }