Esempio n. 1
0
        public ActionResult Detail(int id, int resourceType)
        {
            ResourceBll resourceBll = new ResourceBll();
            SubjectBll  subjectBll  = new SubjectBll();

            if (resourceType == (int)ResourceTypeEnum.文本资源)
            {
                var detail = resourceBll.GetDtoTextResource(id);
                return(Json(new JsonResponse <DtoTextResource>()
                {
                    Data = detail, ErrorCode = (int)ResourceTypeEnum.文本资源
                }, JsonRequestBehavior.AllowGet));
            }
            else if (resourceType == (int)ResourceTypeEnum.多媒体资源)
            {
                var detail = resourceBll.GetMediaResourceGroup(id);
                return(Json(new JsonResponse <DtoMediaResourceToCourse>()
                {
                    Data = detail, ErrorCode = (int)ResourceTypeEnum.多媒体资源
                }, JsonRequestBehavior.AllowGet));
            }
            else if (resourceType == (int)ResourceTypeEnum.题目)
            {
                var detail = subjectBll.GetSubject(id);
                return(Json(new JsonResponse <Yw_Subject>()
                {
                    Data = detail, ErrorCode = (int)ResourceTypeEnum.题目
                }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new JsonResponse <Yw_TextResource>()
            {
                ErrorCode = 0
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public static Action <Yw_Subject> Fetch(
            QuestionInputModel subject,
            SubjectBll bll,
            int currentUser,
            out Yw_Subject entity)
        {
            Check.IfNull(subject, nameof(subject));
            if (currentUser < 10000)
            {
                throw new ArgumentException(
                          "当前登录用户的ID不能小于10000",
                          nameof(currentUser));
            }

            Action <Yw_Subject> saveSubject   = null;
            Yw_Subject          subjectEntity = null;

            if (subject.Id == 0)
            {
                subjectEntity = new Yw_Subject();
                subjectEntity.Ysj_CreateTime = DateTime.Now;
                subjectEntity.Ysj_Creator    = currentUser;
                subjectEntity.Ysj_Status     = (int)SubjectStatusEnum.编辑中;
                saveSubject = bll.InsertSubject;
            }
            else
            {
                subjectEntity = bll.GetSubject(subject.Id);
                saveSubject   = bll.UpdateSubject;
            }
            subjectEntity.Ysj_UpdateTime = DateTime.Now;
            if (!string.IsNullOrWhiteSpace(subject.PlainName))
            {
                string n = subject.PlainName;
                if (n.Length <= 50)
                {
                    subjectEntity.Ysj_Name = n;
                }
                else
                {
                    subjectEntity.Ysj_Name = n.Substring(0, 50);
                }
            }
            subjectEntity.Ysj_Keywords        = subject.Keywords;
            subjectEntity.Ysj_Grade           = subject.Grade;
            subjectEntity.Ysj_Editor          = currentUser;
            subjectEntity.Ysj_Difficulty      = subject.Difficulty;
            subjectEntity.Ysj_SubjectType     = subject.SubjectType;
            subjectEntity.Ysj_MainKnowledgeId = subject.Knowledge;

            entity = subjectEntity;
            return(saveSubject);
        }
Esempio n. 3
0
        public ActionResult Approve(ApproveInputModel approve)
        {
            SubjectBll        bll           = new SubjectBll();
            var               subjectEntity = bll.GetSubject(approve.SubjectId);
            Yw_SubjectProcess nextProcess   = new Yw_SubjectProcess();

            nextProcess.Ysp_Action     = (int)SubjectActionEnum.审批;
            nextProcess.Ysp_CreateTime = DateTime.Now;
            nextProcess.Ysp_Id         = 0;
            nextProcess.Ysp_Operator   = CurrentUserID;
            nextProcess.Ysp_Remark     = "";
            nextProcess.Ysp_Status     = (int)approve.NextStatus;
            nextProcess.Ysp_SubjectId  = approve.SubjectId;
            subjectEntity.Ysj_Status   = nextProcess.Ysp_Status;
            if (approve.Mark != null && approve.Mark.Count > 0)
            {
                string mark = string.Join(",", approve.Mark);
                nextProcess.Ysp_Mark = mark;
            }
            bll.Approve(subjectEntity, nextProcess);
            return(Json(new SuccessJsonResponse()));
        }