예제 #1
0
        public Yw_SubjectProcess GetNextProcess(
            int subjectId,
            int currentUser,
            SubjectStatusEnum nextStatus,
            SubjectActionEnum action)
        {
            if (currentUser < 10000)
            {
                throw new ArgumentException(nameof(currentUser));
            }
            Yw_SubjectProcess nextProcess = new Yw_SubjectProcess();

            nextProcess.Ysp_Action     = (int)action;
            nextProcess.Ysp_CreateTime = DateTime.Now;
            nextProcess.Ysp_Id         = 0;
            nextProcess.Ysp_Mark       = "";
            nextProcess.Ysp_Operator   = currentUser;
            nextProcess.Ysp_Remark     = "";
            nextProcess.Ysp_Status     = (int)nextStatus;
            nextProcess.Ysp_SubjectId  = subjectId;
            if (subjectId >= 10000)
            {
                Yw_SubjectProcess currentProcess = SubjectProcessService.GetCurrentProcess(
                    subjectId);
                if (currentProcess != null)
                {
                    nextProcess.Ysp_Mark   = currentProcess.Ysp_Mark;
                    nextProcess.Ysp_Remark = currentProcess.Ysp_Remark;
                }
            }
            return(nextProcess);
        }
예제 #2
0
        public DtoSubject GetSubjectDetails2(int id)
        {
            DtoSubject result = null;

            var subject = SubjectService.Get(id);

            if (subject != null)
            {
                var knowledges = SubjectKnowledgeService.GetKnowledgesWithNamesBySubject(id);
                //次级知识点
                var secondKnowledgeIds = knowledges.Where(k => !k.Ysw_IsMain)
                                         .Select(k => k.Ysw_KnowledgeId)
                                         .ToList();
                var secondKnowledgeNames = knowledges.Where(k => !k.Ysw_IsMain)
                                           .Select(k => k.Ykl_Name)
                                           .ToList();
                var    mainKnowledge     = knowledges.FirstOrDefault(k => k.Ysw_IsMain);
                int    mainKnowledgeId   = mainKnowledge == null ? 0 : mainKnowledge.Ysw_KnowledgeId;
                string mainKnowledgeName = mainKnowledge == null ? string.Empty : mainKnowledge.Ykl_Name;

                var content = Service.Get(id);

                string        markField = SubjectProcessService.GetCurrentProcess(id)?.Ysp_Mark;
                List <string> mark      = null;
                if (!string.IsNullOrWhiteSpace(markField))
                {
                    mark = markField.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                           .ToList();
                }

                result                   = new DtoSubject();
                result.Id                = subject.Ysj_Id;
                result.Difficulty        = subject.Ysj_Difficulty;
                result.Grade             = subject.Ysj_Grade;
                result.Keywords          = subject.Ysj_Keywords;
                result.Knowledges        = secondKnowledgeIds;
                result.MainKnowledge     = mainKnowledgeId;
                result.MainKnowledgeName = mainKnowledgeName;
                result.KnowledgeNames    = secondKnowledgeNames;
                result.Name              = subject.Ysj_Name;
                result.Content           = content;
                result.Status            = subject.Ysj_Status;
                result.Mark              = mark;
            }

            return(result);
        }