コード例 #1
0
        public FolderPopupViewModel GetSingleFolder(int id, int LoggedInUserId, int LoggedInOrganizationId)
        {
            var folder = Get(x => x.MasterDocumentFolderID == id && x.OrganizationId == LoggedInOrganizationId);
            FolderPopupViewModel folderviewmodel = new FolderPopupViewModel();

            folderviewmodel.MasterDocumentFolderID = folder.MasterDocumentFolderID;
            folderviewmodel.FolderName             = folder.FolderName;
            foreach (var role in folder.DocumentFolderRoles)
            {
                folderviewmodel.Roles.Add(role.RoleID ?? 0);
            }
            foreach (var user in folder.DocumentFolderUsers)
            {
                folderviewmodel.Users.Add(user.UserID ?? 0);
            }
            return(folderviewmodel);
        }
コード例 #2
0
        public int SaveFolderFormData(FolderPopupViewModel model, int LoggedInUserId, int LoggedInOrganizationId)
        {
            MasterDocumentFolder folder = Mapper.Map <FolderPopupViewModel, MasterDocumentFolder>(model);

            if (folder.MasterDocumentFolderID == 0)
            {
                folder.OrganizationId = LoggedInOrganizationId;
                base.Insert(folder);
                this._unitOfWork.Save();
            }
            else
            {
                var foldertoUpdate = GetSingle(folder.MasterDocumentFolderID, LoggedInUserId, LoggedInOrganizationId);
                foldertoUpdate.FolderName = folder.FolderName;
                Update(foldertoUpdate);
                base.RepositoryContext.SP_DeleteALLDocumentFolderRole(folder.MasterDocumentFolderID, LoggedInOrganizationId);
                base.RepositoryContext.SP_DeleteALLDocumentFolderUser(folder.MasterDocumentFolderID, LoggedInOrganizationId);
            }
            if (model.UserList != null && model.UserList.Any())
            {
                foreach (var data in model.UserList)
                {
                    DocumentFolderUser user = Mapper.Map <DocumentFolderUserViewModel, DocumentFolderUser>(data);
                    user.DocumentFolderID = folder.MasterDocumentFolderID;
                    user.OrganizationId   = LoggedInOrganizationId;
                    this._IDocumentFolderUserRepository.Add(user, LoggedInUserId, LoggedInOrganizationId);
                }
            }
            if (model.RoleList != null && model.RoleList.Any())
            {
                foreach (var data in model.RoleList)
                {
                    DocumentFolderRole role = Mapper.Map <DocumentFolderRoleViewModel, DocumentFolderRole>(data);
                    role.DocumentFolderID = folder.MasterDocumentFolderID;
                    role.OrganizationId   = LoggedInOrganizationId;
                    this._IDocumentFolderRoleRepository.Add(role, LoggedInUserId, LoggedInOrganizationId);
                }
            }
            this._unitOfWork.Save();
            return(folder.MasterDocumentFolderID);
        }
コード例 #3
0
 public int SaveFolderFormData(FolderPopupViewModel model)
 {
     return(this._IMasterDocumentFolderRepository.SaveFolderFormData(model, base.UserId, base.OrganizationId));
 }