コード例 #1
0
        public ActionResult Delete(int ID)
        {
            ResearchNoteAttachmentInfo info = ResearchNoteAttachmentBLL.GetList(a => a.ID == ID).FirstOrDefault();

            if (null == info)
            {
                return(Json(new APIJson("数据不存在")));
            }
            var infoResearch   = info.ResearchNoteInfo.ResearchInfo;
            int ResearchNoteID = info.ResearchNoteID;

            if (infoResearch.Status == (int)SysEnum.ResearchStatus.已确认)
            {
                return(Json(new APIJson(-1, "当前状态不能上传")));
            }
            string MineType = info.MineType;

            try
            {
                System.IO.File.Delete(Server.MapPath(info.PathRelative + info.Name));
            }
            catch (Exception) {}
            if (ResearchNoteAttachmentBLL.Delete(info))
            {
                var infoResearchNoteDb = ResearchNoteBLL.GetList(a => a.ID == ResearchNoteID).FirstOrDefault();
                var result             = new {
                    listImage = ResearchNoteAttachmentBLL.GetImageJSON(infoResearchNoteDb, "image"),
                    listAudio = ResearchNoteAttachmentBLL.GetImageJSON(infoResearchNoteDb, "audio")
                };
                return(Json(new APIJson(0, "删除成功", result)));
            }
            return(Json(new APIJson("删除失败,请重试")));
        }
コード例 #2
0
        public ActionResult Create(ResearchNoteAttachmentInfo info)
        {
            ResearchNoteInfo infoResearchNote = ResearchNoteBLL.GetList(a => a.ID == info.ResearchNoteID).FirstOrDefault();

            if (null == infoResearchNote)
            {
                return(Json(new APIJson(-1, "数据有误,找不到课堂记录对象")));
            }
            if (infoResearchNote.ResearchInfo.Status == (int)SysEnum.ResearchStatus.已确认)
            {
                return(Json(new APIJson(-1, "当前状态不能上传")));
            }
            if (string.IsNullOrEmpty(info.MineType))
            {
                info.MineType = "image";
            }
            string SavePathRelative = SaveWechatImage(info.Name, info.MineType, infoResearchNote.ResearchInfo);

            info.Name         = SavePathRelative.Substring(SavePathRelative.LastIndexOf("/") + 1);
            info.PathRelative = SavePathRelative.Substring(0, SavePathRelative.LastIndexOf("/") + 1);
            info.CreateDate   = DateTime.Now;

            if (ResearchNoteAttachmentBLL.Create(info).ID > 0)
            {
                return(Json(new APIJson(0, "提交成功", ResearchNoteAttachmentBLL.GetImageJSON(infoResearchNote, info.MineType))));
            }
            return(Json(new APIJson(-1, "提交失败,请重试")));
        }
コード例 #3
0
        public ActionResult Detail(int ID)
        {
            ResearchInfo info = ResearchBLL.GetList(a => a.ID == ID).FirstOrDefault();

            if (null == info || info.ResearchPlanInfo.TypeEnum != (int)SysEnum.ResearchPlanType.组织调研)
            {
                return(RedirectToAction("Msg", "CommPage", new { Title = "好像没有这样一个听课反馈窝" }));
            }
            string GoBack = Function.GetRequestString("GoBack");

            if (string.IsNullOrEmpty(GoBack))
            {
                GoBack = Url.Action("index", new { PlanID = info.ResearchPlanID });
            }
            infoHead.LeftURL = null == Url ? "" : GoBack;

            ViewBag.listResearchNote = info.ResearchNoteInfo.ToList()
                                       .Select(a => new
            {
                a.ID,
                a.Detail,
                a.CreateDate,
                ImageJSON = ResearchNoteAttachmentBLL.GetImageJSON(a, "image"),
                AudioJSON = ResearchNoteAttachmentBLL.GetImageJSON(a, "audio")
            });
            return(View(info));
        }
コード例 #4
0
        public ActionResult Detail(int PlanID)
        {
            infoHead.LeftURL = Url.Action("index");

            var infoPlan = ResearchPlanBLL.GetList(a => a.ID == PlanID).FirstOrDefault();

            if (null == infoPlan || infoPlan.TypeEnum != (int)SysEnum.ResearchPlanType.个人听课)
            {
                return(RedirectToAction("Msg", "CommPage", new { Title = "好像没有这样一个听课反馈窝" }));
            }
            ResearchInfo info = infoPlan.ResearchInfo.FirstOrDefault();

            if (null == info)
            {
                return(RedirectToAction("Msg", "CommPage", new { Title = "好像没有这样一个听课反馈窝" }));
            }

            ViewBag.listResearchNote = info.ResearchNoteInfo.ToList()
                                       .Select(a => new {
                a.ID,
                a.Detail,
                a.CreateDate,
                ImageJSON = ResearchNoteAttachmentBLL.GetImageJSON(a, "image"),
                AudioJSON = ResearchNoteAttachmentBLL.GetImageJSON(a, "audio")
            });
            ViewBag.listImagesResearchPlanJSON = new ResearchPlanAttachmentController().GetImageJSON(info.ResearchPlanInfo);
            return(View(info));
        }
コード例 #5
0
        public ActionResult index(int ResearchID)
        {
            ResearchInfo info             = ResearchBLL.GetList(p => p.ID == ResearchID).FirstOrDefault();
            var          listResearchNote = info.ResearchNoteInfo.OrderByDescending(a => a.ID).ToList()
                                            .Select(a => new {
                a.ID,
                a.Detail,
                CreateDate = a.CreateDate.ToString("yyyy-MM-dd HH:mm"),
                ImageJSON  = ResearchNoteAttachmentBLL.GetImageJSON(a, "image"),
                AudioJSON  = ResearchNoteAttachmentBLL.GetImageJSON(a, "audio")
            });

            return(Json(new APIJson(0, "", listResearchNote), JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
        public ActionResult Edit(int ID)
        {
            infoHead.LeftURL = Url.Action("Detail", new { ID = ID });

            ResearchInfo info = ResearchBLL.GetList(a => a.ID == ID).FirstOrDefault();

            if (null == info || info.ResearchPlanInfo.TypeEnum != (int)SysEnum.ResearchPlanType.组织调研)
            {
                return(RedirectToAction("Msg", "CommPage", new { Title = "好像没有这样一个听课反馈窝" }));
            }
            ViewBag.listResearchNote = info.ResearchNoteInfo.ToList()
                                       .Select(a => new
            {
                a.ID,
                a.Detail,
                a.CreateDate,
                ImageJSON = ResearchNoteAttachmentBLL.GetImageJSON(a, "image"),
                AudioJSON = ResearchNoteAttachmentBLL.GetImageJSON(a, "audio")
            });
            return(View(info));
        }