Пример #1
0
        public async Task <ActionResult> AddUserToPage(string data, string fieldPrefix, string newUser)
        {
            // validate
            if (string.IsNullOrWhiteSpace(newUser))
            {
                throw new Error(this.__ResStr("noParm", "No user name specified."));
            }
            int userId = await Resource.ResourceAccess.GetUserIdAsync(newUser);

            if (userId == 0)
            {
                throw new Error(this.__ResStr("noUser", "User {0} doesn't exist", newUser));
            }

            // check duplicate
            List <AllowedUsersEditComponent.GridAllowedUser> list = Utility.JsonDeserialize <List <AllowedUsersEditComponent.GridAllowedUser> >(data);

            if ((from l in list where l.UserId == userId select l).FirstOrDefault() != null)
            {
                throw new Error(this.__ResStr("dupUser", "User {0} has already been added", newUser));
            }

            // render
            string userName = await Resource.ResourceAccess.GetUserNameAsync(userId);

            AllowedUsersEditComponent.GridAllowedUser userEntry = new AllowedUsersEditComponent.GridAllowedUser(userId, userName);
            return(await GridRecordViewAsync(await AllowedUsersEditComponent.GridRecordAsync(fieldPrefix, userEntry)));
        }
Пример #2
0
        public async Task <ActionResult> AllowedUsersEdit_SortFilter(GridPartialViewData gridPVData, Guid editGuid)
        {
            GridDefinition   gridModel = AllowedUsersEditComponent.GetGridModel(false);
            ModuleDefinition module    = await ModuleDefinition.LoadAsync(editGuid);

            gridModel.ResourceRedirect = module;
            return(await GridPartialViewAsync <ModuleDefinition.GridAllowedUser>(gridModel, gridPVData));
        }
Пример #3
0
 public async Task <ActionResult> AllowedUsersEdit_SortFilter(GridPartialViewData gridPVData)
 {
     return(await GridPartialViewAsync <AllowedUsersEditComponent.GridAllowedUser>(AllowedUsersEditComponent.GetGridModel(false), gridPVData));
 }
Пример #4
0
 public async Task <ActionResult> AllowedUsersBrowse_GridData(GridPartialViewData gridPVData)
 {
     return(await GridPartialViewAsync(AllowedUsersEditComponent.GetGridAllUsersModel(), gridPVData));
 }