Beispiel #1
0
 public static void UpdateQuizAttachState(this QZ_CourseQuizzes entity, bool isAttched)
 {
     entity.IsAttached = isAttched;
     entity.StatusId   = (byte)(isAttched ? QuizEnums.eQuizStatuses.PUBLISHED : QuizEnums.eQuizStatuses.DRAFT);
     entity.UpdateDate = DateTime.Now;
     entity.UpdatedBy  = DtoExtensions.CurrentUserId;
 }
Beispiel #2
0
 public static void UpdateQuizStatus(this QZ_CourseQuizzes entity, QuizEnums.eQuizStatuses status)
 {
     entity.StatusId   = (byte)status;
     entity.IsAttached = status == QuizEnums.eQuizStatuses.PUBLISHED;
     entity.UpdateDate = DateTime.Now;
     entity.UpdatedBy  = DtoExtensions.CurrentUserId;
 }
Beispiel #3
0
 public static QuizBaseToken Entity2QuizBaseToken(this QZ_CourseQuizzes entity)
 {
     return(new QuizBaseToken
     {
         QuizId = entity.QuizId,
         Status = Utils.ParseEnum <QuizEnums.eQuizStatuses>(entity.StatusId),
         ScoreRule = Utils.ParseEnum <QuizEnums.eScoreRules>(entity.ScoreRuleId)
     });
 }
Beispiel #4
0
 public static void UpdateQuizEntity(this QZ_CourseQuizzes entity, QuizDTO token)
 {
     entity.Title             = token.Title;
     entity.Description       = token.Description;
     entity.Instructions      = token.Instructions;
     entity.RandomOrder       = token.RandomOrder;
     entity.PassPercent       = token.PassPercent;
     entity.ScoreRuleId       = (byte)token.ScoreRule;
     entity.AvailableAfter    = token.AvailableAfter;
     entity.Attempts          = token.Attempts;
     entity.TimeLimit         = token.TimeLimit;
     entity.IsMandatory       = token.IsMandatory;
     entity.IsBackAllowed     = token.IsBackAllowed;
     entity.AttachCertificate = token.AttachCertificate;
     entity.UpdateDate        = DateTime.Now;
     entity.UpdatedBy         = DtoExtensions.CurrentUserId;
 }
Beispiel #5
0
 public static UserCourseQuizToken Entity2UserCourseQuizToken(this QZ_CourseQuizzes entity)
 {
     return(new UserCourseQuizToken
     {
         QuizId = entity.QuizId
         , Sid = entity.Sid
         , Status = Utils.ParseEnum <QuizEnums.eQuizStatuses>(entity.StatusId)
         , Title = entity.Title
         , Description = entity.Description
         , Instructions = entity.Instructions
         , IsMandatory = entity.IsMandatory
         , Attempts = entity.Attempts
         , TimeLimit = entity.TimeLimit
         , AvailableAfter = entity.AvailableAfter
         , PassPercent = entity.PassPercent
         , IsValid = true
     });
 }
Beispiel #6
0
        public static QuizBaseDTO Entity2QuizBaseDto(this QZ_CourseQuizzes entity, int courseId)
        {
            if (entity == null)
            {
                return new  QuizBaseDTO
                       {
                           QuizId   = Guid.NewGuid(),
                           Sid      = -1,
                           CourseId = courseId,
                           IsValid  = true,
                           Title    = "New quiz"
                       }
            }
            ;

            return(new QuizBaseDTO
            {
                QuizId = entity.QuizId
                , Sid = entity.Sid
                , Title = entity.Title
                , CourseId = entity.CourseId
                , Status = Utils.ParseEnum <QuizEnums.eQuizStatuses>(entity.StatusId)
            });
        }
Beispiel #7
0
 public static void UpdateQuizCertAttachState(this QZ_CourseQuizzes entity, bool isAttched)
 {
     entity.AttachCertificate = isAttched;
     entity.UpdateDate        = DateTime.Now;
     entity.UpdatedBy         = DtoExtensions.CurrentUserId;
 }
Beispiel #8
0
 public static void UpdateCourseQuizAvailability(this QZ_CourseQuizzes entity, short num)
 {
     entity.AvailableAfter = num;
     entity.UpdateDate     = DateTime.Now;
     entity.UpdatedBy      = DtoExtensions.CurrentUserId;
 }