Exemple #1
0
        public async Task <int> CreateTeam(string teamName, string teamSummary, string avatarToken,
                                           string currentUserMail)
        {
            var currentUserRepoModel = this._userRepository.GetUser(currentUserMail);

            if (currentUserRepoModel == null)
            {
                Enforce.Throw(new LogicErrorException("当前用户已被删除"));
            }

            string teamAvatar = string.Empty;

            if (!string.IsNullOrEmpty(avatarToken))
            {
                teamAvatar = await _attachmentUploadRepository.GetAttachmentFileID(avatarToken, currentUserRepoModel.info.mail);
            }

            T_TEAM Team = new T_TEAM();

            Team.T_TEAM_CODE      = "";
            Team.T_TEAM_NAME      = teamName;
            Team.T_TEAM_SUMMARY   = teamSummary;
            Team.T_TEAM_AVATAR    = teamAvatar;
            Team.T_STATUS         = TeamStatus.Enable;
            Team.CREATE_USER_MAIL = currentUserRepoModel.info.mail;
            Team.CREATE_TIME      = DateTime.Now;
            return(this._teamBll.CreateTeam(Team, currentUserRepoModel.info.userID, currentUserRepoModel.info.mail, currentUserRepoModel.info.userName));
        }
        public async Task <ProjectInfoModel> CreateProject(string projectName, string projectSummary, string avatarToken, string currentUserMail)
        {
            var currentUserRepoModel = this._userRepository.GetUser(currentUserMail);

            if (currentUserRepoModel == null)
            {
                Enforce.Throw(new LogicErrorException("当前用户已被删除"));
            }

            string projectAvatar = string.Empty;

            if (!string.IsNullOrEmpty(avatarToken))
            {
                projectAvatar = await _attachmentUploadRepository.GetAttachmentFileID(avatarToken, currentUserRepoModel.info.mail);
            }
            ProjectInfoModel infoModel = new ProjectInfoModel();

            infoModel.projectName    = projectName;
            infoModel.projectSummary = projectSummary;
            infoModel.projectAvatar  = projectAvatar;
            infoModel.createUserMail = currentUserRepoModel.info.mail;
            infoModel.createTime     = DateTime.Now;

            var project = Mapper.Map <ProjectInfoModel, T_PROJECT>(infoModel);

            if (this._projectBll.CreateProject(project, currentUserRepoModel.info.userID, currentUserRepoModel.info.userName))
            {
                infoModel = Mapper.Map <T_PROJECT, ProjectInfoModel>(project);
            }
            return(infoModel);
        }
Exemple #3
0
        public async Task <bool> ModifyMyUserInfo(string currentUserMail, string userName, string avatarToken, string mobile)
        {
            var currentUser = this.getUserInfoModelByMail(currentUserMail, 1);

            if (currentUser == null)
            {
                Enforce.Throw(new LogicErrorException("当前用户不存在"));
            }
            currentUser.userName     = userName;
            currentUser.userTrueName = userName;
            string userAvatar = string.Empty;

            if (!string.IsNullOrEmpty(avatarToken))
            {
                userAvatar = await _attachmentUploadRepository.GetAttachmentFileID(avatarToken, currentUserMail);

                currentUser.userAvatar = userAvatar;
            }
            currentUser.mobile = mobile;



            return(this._userBll.Update(Mapper.Map <UserInfoModel, T_USER>(currentUser)));
        }