예제 #1
0
        public BlackListResult EditBlackListRecord(string detail, Guid uid, DateTime endtime, BlackListRecordStatus status)
        {
            var record = database.BlackListRecords.SingleOrDefault(b => b.UID == uid);

            if (uid == null)
            {
                return(BlackListResult.Error(BlackListResult.EditBlackListRecordErrorEnum.EmptyId));
            }
            if (database.BlackListRecords.Where(b => b.UID == uid).Count() == 0)
            {
                return(BlackListResult.Error(BlackListResult.EditBlackListRecordErrorEnum.NoExistingRecord));
            }
            try
            {
                record.Detail  = detail;
                record.EndTime = endtime;
                record.Status  = status;
                Save();
            }
            catch (Exception e)
            {
                return(BlackListResult.Error("出现错误,错误信息:{0}", e.Message));
            }
            return(BlackListResult.Success());
        }
예제 #2
0
        //[AppAuthorize(AppRoleEnum.OrgnizationMember)]//必须被授权为该项目管理员 => 拿到机构管理员的令牌
        public BlackListResult AddBlackListRecord(string Detail, Volunteer volunteer, AppUser adder, DateTime endtime, Organization orgnization = null, Project project = null, BlackListRecordStatus status = BlackListRecordStatus.Enabled)
        {
            if (endtime < System.DateTime.Now)
            {
                return(BlackListResult.Error(BlackListResult.AddBlackListRecordErrorEnum.WrongTime));
            }
            BlackListRecord result = new BlackListRecord
            {
                Detail       = Detail,
                Volunteer    = volunteer,
                Adder        = adder,
                Status       = status,
                Organization = orgnization,
                EndTime      = endtime,
                AddTime      = System.DateTime.Now
            };

            try
            {
                AddBlackListRecord(result);
            }
            catch (Exception e)
            {
                return(BlackListResult.Error("出现错误,错误信息:{0}", e.Message));
            }
            return(BlackListResult.Success());
        }