Пример #1
0
        private string SaveWechatImage(string MediaID, string MineType, ResearchInfo infoResearch)
        {
            string RelativePath = ImageSavePathRelative + infoResearch.ResearchPlanInfo.DateBegin.ToString("yyyyMM") + "/";
            string SaveMapPath  = Server.MapPath(RelativePath);

            if (!Directory.Exists(SaveMapPath))
            {
                Directory.CreateDirectory(SaveMapPath);
            }
            string Ext = ".jpg";

            if (MineType.ToLower().Contains("audio"))
            {
                Ext = ".amr";
            }
            string SaveName = MediaID + Ext;

            WeiXin.APIClient.WechatService.WechatFile.GetMultimedia(WeiXin.APIClient.WechatService.GetAccessTonken(),
                                                                    MediaID, SaveMapPath, SaveName);
            if (MineType.ToLower().Contains("audio"))
            {
                Tool.MediaHelper.AmrToMp3Async(SaveMapPath, MediaID);
                SaveName = MediaID + ".mp3";
            }
            return(RelativePath + SaveName);
        }
Пример #2
0
        public ActionResult Create(TimeLineInfo info)
        {
            if (string.IsNullOrEmpty(info.Detail))
            {
                return(Json(new APIJson(-1, "总得写点东西吧")));
            }
            ResearchInfo infoResearch = ResearchBLL.GetList(a => a.ID == info.ResearchID).FirstOrDefault();

            if (null == infoResearch || infoResearch.UserID != CurrentUser.ID)
            {
                return(Json(new APIJson(-1, "提交失败,数据有误")));
            }
            info.CreateDate = DateTime.Now;
            string checkboxUser = Function.GetRequestString("checkboxUser");

            info.UserInfo = new List <UserInfo>();
            foreach (var item in checkboxUser.Split(','))
            {
                int ID = Function.ConverToInt(item);
                if (ID <= 0)
                {
                    continue;
                }
                UserInfo u = UserBLL.GetList(a => a.ID == ID).FirstOrDefault();
                if (null != u && !info.UserInfo.Any(a => a.ID == ID))
                {
                    info.UserInfo.Add(u);
                }
            }
            if (TimeLineBLL.Create(info).ID > 0)
            {
                return(Json(new APIJson(0, "提交成功,分享到微信中时,你现在可以打开右上角菜单进行分享了", new { info.ID })));
            }
            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 RequestResult InsertResearchSubsidy(
            ResearchInfo ResearchInfo,
            List <Files> Files
            )
        {
            try
            {
                /// Data Validations
                DataValidation.IsEmptyOrDefault2(ResearchInfo);
                DataValidation.IsEmptyOrDefault2(ResearchInfo.CheckedData);
                DataValidation.IsEmptyOrDefault2(ResearchInfo.ManagersInfo);
                DataValidation.IsEmptyOrDefault2(ResearchInfo.MeetingInfo);
                DataValidation.IsEmptyOrDefaultList2(Files);

                //if (DataValidation.IsEmptyOrDefault(ResearchInfo) ||
                //    DataValidation.IsEmptyOrDefault(ResearchInfo.CheckedData) ||
                //    DataValidation.IsEmptyOrDefault(ResearchInfo.ManagersInfo) ||
                //    DataValidation.IsEmptyOrDefault(ResearchInfo.MeetingInfo) ||
                //    DataValidation.IsEmptyOrDefaultList(Files))
                //    throw new FaultException<ValidationFault>(new ValidationFault());


                /// Call Database
                using (CooperativeDAL dal = new CooperativeDAL(new ADO()))
                {
                    return(dal.InsertResearchSubsidyDAL(
                               ResearchInfo,
                               Files
                               ));
                }
            }
            catch (FaultException <ValidationFault> flex)
            {
                //ValidationFault fault = new ValidationFault
                //{
                //    Result = true,
                //    Message = "Parameter not correct",
                //    Description = "Invalid Parameters is Required but have null or empty or 0 value"
                //};

                //var flex = new FaultException<ValidationFault>(fault, new FaultReason("Invalid Parameters is Required but have null or empty or 0 value"));

                _log.Error(flex);

                throw flex;
            }
            catch (Exception ex)
            {
                ValidationFault fault = new ValidationFault
                {
                    Result      = false,
                    Message     = ex.Message,
                    Description = "Service have an internal error please contact service administartor [email protected]"
                };

                _log.Error(ex);

                throw new FaultException <ValidationFault>(fault);
            }
        }
Пример #5
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));
        }
Пример #6
0
        /// <summary>
        /// 检查听评对象用记是否存在,不存在则创建
        /// </summary>
        private bool CreatePConfirmlectureUserID(ResearchInfo infoResearch)
        {
            UserInfo infoUser = null;

            if (infoResearch.lectureUserID > 0)
            {
                infoUser = UserBLL.GetList(a =>
                                           a.ID == infoResearch.lectureUserID &&
                                           a.DepartmentID == infoResearch.ResearchPlanInfo.DepartmentID).FirstOrDefault();
                if (null != infoUser)
                {
                    return(true);
                }
            }

            infoUser = new UserInfo();
            infoUser.DepartmentID     = infoResearch.ResearchPlanInfo.DepartmentID;
            infoUser.Name             = Function.GetRequestString("TxtLectureUserID");
            infoUser.Code             = infoUser.Name;
            infoUser.PassWord         = Guid.NewGuid().ToString().Replace("-", "");
            infoUser.Email            = infoUser.Tel = string.Empty;
            infoUser.CreateDate       = infoUser.LastDate = DateTime.Now;
            infoUser.Enable           = false;
            infoUser.LocationX        = infoUser.LocationY = 0;
            infoUser.WechatOpenID     = infoUser.WechatNameNick = infoUser.WechatHeadImg = infoUser.Sex = string.Empty;
            infoUser.IDCard           = string.Empty;
            infoUser.TypeID           = -1;
            infoUser.DefaultSubjectID = infoResearch.SubjectID;
            if (string.IsNullOrEmpty(infoUser.Name))
            {
                return(false);
            }

            //再根据名称找一,如果就不要加啦
            var ExistItem = UserBLL.GetList(a => a.Name.StartsWith(infoUser.Name + "|外区")).FirstOrDefault();

            if (null != ExistItem)
            {
                infoResearch.lectureUserID = ExistItem.ID;
                return(true);
            }


            //做insert前最后修正
            infoUser.Name = infoUser.Code = infoUser.Name
                                            + "|"
                                            + SysEnum.GetName(typeof(SysEnum.ResearchArea), infoResearch.ResearchPlanInfo.AreaID)
                                            + Guid.NewGuid().ToString().Replace("-", "");
            infoUser.SubjectInfo.Add(infoResearch.SubjectInfo);
            return(UserBLL.Create(infoUser).ID > 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));
        }
Пример #8
0
        public ActionResult Create(ResearchInfo info)
        {
            var infoExist = ResearchBLL.GetList(a =>
                                                a.ResearchPlanID == info.ResearchPlanID &&
                                                a.UserID == CurrentUser.ID &&
                                                a.ClassName == info.ClassName &&
                                                a.GradeName == info.GradeName &&
                                                a.LessionNumber == info.LessionNumber
                                                ).FirstOrDefault();

            if (null != infoExist)
            {
                return(Json(new APIJson(2, "您还在听评当前课程,将直接进入", new { infoExist.ID })));
            }
            info.UserID = CurrentUser.ID;
            //info.ResearchPlanID
            //info.SubjectID
            if (string.IsNullOrEmpty(info.Topic))
            {
                return(Json(new APIJson(-1, "请填写课题")));
            }
            if (string.IsNullOrEmpty(info.ClassName))
            {
                return(Json(new APIJson(-1, "请填写年级")));
            }
            if (string.IsNullOrEmpty(info.GradeName))
            {
                return(Json(new APIJson(-1, "请填写班级")));
            }
            if (info.SubjectID <= 0)
            {
                return(Json(new APIJson(-1, "请选择学科")));
            }
            if (info.lectureUserID <= 0)
            {
                return(Json(new APIJson(-1, "教师不存在,请输入教师姓名关键字,并点击提示结果")));
            }
            info.SubjectiveOpinion = string.Empty;
            info.NoteMemo          = string.Empty;
            info.Status            = (int)SysEnum.ResearchStatus.未评;
            info.ScoreTotal        = 0;
            info.ScoreLever        = (int)SysEnum.ResearchScoreLever.合格;
            info.CreateDate        = DateTime.Now;
            ResearchBLL.Create(info);
            if (info.ID > 0)
            {
                return(Json(new APIJson(0, "新听评课事项创建成功", new { info.ID })));
            }
            return(Json(new APIJson(-1, "创建失败,请重试")));
        }
        public ActionResult Index(ResearchInfo info)
        {
            var list = ResearchChatBLL.GetList(a =>
                                               a.ResearchPlanID == info.ResearchPlanID &&
                                               a.GradeName == info.GradeName &&
                                               a.ClassName == info.ClassName &&
                                               a.LessionNumber == info.LessionNumber)
                       .OrderBy(a => a.ID).ToList()
                       .Select(c => new {
                c.UserInfo.Name,
                CreateDate = c.CreateDate.ToString("HH:mm ss"),
                c.UserInfo.WechatHeadImg,
                c.Detail,
                IsSelf = (c.CreateUserID == CurrentUser.ID)
            }).ToList();

            return(Json(new APIJson(0, "success", list)));
        }
Пример #10
0
        public static bool HandleDragging_Prefix(object __instance, bool mouseOver, bool ____available)
        {
            ResearchProjectDef Research = (ResearchProjectDef)ResearchInfo.GetValue(__instance);
            Rect rect = (Rect)RectInfo.GetValue(__instance);

            Research.DrawExtras(rect, mouseOver || HighlightedProxy(__instance));
            if (mouseOver && Event.current.type == EventType.MouseDown && Event.current.button == 0)
            {
                bool completed = Research.IsFinished;
                if (Event.current.button == 0)
                {
                    Research.SelectMenu(completed);
                }
                if (DebugSettings.godMode && Prefs.DevMode && Event.current.button == 1 && !completed)
                {
                    Find.ResearchManager.FinishProject(Research);
                    Research.WipeAssignments();
                }
            }
            return(false);
        }
Пример #11
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));
        }
Пример #12
0
        public static bool ResearchNode_Draw_Prefix(object __instance, Rect visibleRect, bool forceDetailedMode = false)
        {
            //Reflected objects
            Rect rect = (Rect)RectInfo.GetValue(__instance);
            ResearchProjectDef Research = (ResearchProjectDef)ResearchInfo.GetValue(__instance);
            bool available = (bool)AvailableInfo.GetValue(__instance);
            bool completed = Research.IsFinished; //simplified

            //

            if (!(bool)IsVisibleInfo.Invoke(__instance, new object[] { visibleRect }))
            {
                HighlightedProxy(__instance, false);
                return(false);
            }
            bool detailedMode = forceDetailedMode || (float)ZoomLevelInfo.GetValue(InstanceInfo.GetValue(__instance)) < DetailedModeZoomLevelCutoff;
            bool mouseOver    = Mouse.IsOver(rect);
            bool highlighted  = HighlightedProxy(__instance);

            if (Event.current.type == EventType.Repaint)
            {
                //researches that are completed or could be started immediately, and that have the required building(s) available
                GUI.color = mouseOver ? BrightColor : (Color)ColorInfo.GetValue(__instance);
                if (mouseOver || highlighted)
                {
                    GUI.DrawTexture(rect, ResearchTree_Assets.ButtonActive);
                }
                else
                {
                    GUI.DrawTexture(rect, ResearchTree_Assets.Button);
                }

                //grey out center to create a progress bar effect, completely greying out research not started.
                if (available)
                {
                    var progressBarRect = rect.ContractedBy(3f);
                    GUI.color             = ResearchTree_Assets.ColorAvailable[Research.techLevel];
                    progressBarRect.xMin += Research.ProgressPercent * progressBarRect.width;
                    GUI.DrawTexture(progressBarRect, BaseContent.WhiteTex);
                }
                HighlightedProxy(__instance, interest == Research);

                //draw the research label
                if (!completed && !available)
                {
                    GUI.color = Color.grey;
                }
                else
                {
                    GUI.color = Color.white;
                }

                if (detailedMode)
                {
                    Text.Anchor   = TextAnchor.UpperLeft;
                    Text.WordWrap = false;
                    Text.Font     = (bool)largeLabelInfo.GetValue(__instance) ? GameFont.Tiny : GameFont.Small;
                    Widgets.Label((Rect)LabelRectInfo.GetValue(__instance), Research.LabelCap);
                }
                else
                {
                    Text.Anchor   = TextAnchor.MiddleCenter;
                    Text.WordWrap = false;
                    Text.Font     = GameFont.Medium;
                    Widgets.Label(rect, Research.LabelCap);
                }

                //draw research cost and icon
                if (detailedMode)
                {
                    Text.Anchor = TextAnchor.UpperRight;
                    Text.Font   = Research.CostApparent > 1000000 ? GameFont.Tiny : GameFont.Small;
                    Widgets.Label((Rect)CostLabelRectInfo.GetValue(__instance), Research.CostApparent.ToStringByStyle(ToStringStyle.Integer));
                    GUI.DrawTexture((Rect)CostIconRectInfo.GetValue(__instance), !completed && !available ? ResearchTree_Assets.Lock : ResearchTree_Assets.ResearchIcon,
                                    ScaleMode.ScaleToFit);
                }

                Text.WordWrap = true;

                //attach description and further info to a tooltip
                string root = HarmonyPatches.ResearchPal ? "ResearchPal" : "Fluffy.ResearchTree";
                TooltipHandler.TipRegion(rect, new Func <string>(() => (string)GetResearchTooltipStringInfo.Invoke(__instance, new object[] { })), Research.GetHashCode());
                if (!BuildingPresentProxy(Research))
                {
                    string languageKey = root + ".MissingFacilities";
                    TooltipHandler.TipRegion(rect, languageKey.Translate(string.Join(", ", MissingFacilities(Research).Select(td => td.LabelCap).ToArray())));
                }
                else if (!TechprintAvailable(Research))
                {
                    string languageKey = root + ".MissingTechprints";
                    TooltipHandler.TipRegion(rect, languageKey.Translate(Research.TechprintsApplied, Research.techprintCount));
                }

                //draw unlock icons
                if (detailedMode)
                {
                    Rect IconsRect = (Rect)IconsRectInfo.GetValue(__instance);
                    var  unlocks   = GetUnlockDefsAndDescs(Research);
                    for (var i = 0; i < unlocks.Count; i++)
                    {
                        var iconRect = new Rect(
                            IconsRect.xMax - (i + 1) * (IconSize.x + 4f),
                            IconsRect.yMin + (IconsRect.height - IconSize.y) / 2f,
                            IconSize.x,
                            IconSize.y);

                        if (iconRect.xMin - IconSize.x < IconsRect.xMin &&
                            i + 1 < unlocks.Count)
                        {
                            //stop the loop if we're about to overflow and have 2 or more unlocks yet to print.
                            iconRect.x = IconsRect.x + 4f;
                            GUI.DrawTexture(iconRect, ResearchTree_Assets.MoreIcon, ScaleMode.ScaleToFit);
                            var tip = string.Join("\n", unlocks.GetRange(i, unlocks.Count - i).Select(p => p.Second).ToArray());
                            TooltipHandler.TipRegion(iconRect, tip);
                            //new TipSignal(tip, Settings.TipID, TooltipPriority.Pawn) );
                            break;
                        }

                        //draw icon
                        unlocks[i].First.DrawColouredIcon(iconRect);

                        //tooltip
                        TooltipHandler.TipRegion(iconRect, unlocks[i].Second);
                    }
                }

                if (mouseOver)
                {
                    if (interest != null && interest != Research)
                    {
                        DeInterest();
                    }

                    //highlight prerequisites if research available
                    if (available)
                    {
                        HighlightedProxy(__instance, true);
                        foreach (var prerequisite in (IEnumerable <object>)GetMissingRequiredRecursiveInfo.Invoke(__instance, new object[] { }))
                        {
                            HighlightedProxy(Convert.ChangeType(prerequisite, ResearchNodeType()), true);
                        }
                    }
                    //highlight children if completed
                    else if (completed)
                    {
                        foreach (var child in (IEnumerable <object>)ChildrenInfo.GetValue(__instance))
                        {
                            HighlightedProxy(Convert.ChangeType(child, ResearchNodeType()), true);
                        }
                    }
                }
            }

            //CUSTOM: a bunch of things on top
            Research.DrawExtras(rect, mouseOver || highlighted);

            if (Widgets.ButtonInvisible(rect))
            {
                //CUSTOM: replaced queue operations for assignment menu
                if (Event.current.button == 0)
                {
                    Research.SelectMenu(completed);
                }
                if (DebugSettings.godMode && Prefs.DevMode && Event.current.button == 1 && !Research.IsFinished)
                {
                    Find.ResearchManager.FinishProject(Research);
                    Research.WipeAssignments();
                }
            }

            return(false);
        }
Пример #13
0
        public ActionResult Edit(ResearchInfo info)
        {
            bool IsConfirm = Function.GetRequestString("HidenIsConfirm") == "true";

            string       EditProp  = Function.GetRequestString("EditProp");///仅更新哪些字段  TemplateItem:评价项|SubjectiveOpinion主观评价|null 所有
            ResearchInfo infoExist = ResearchBLL.GetList(a => a.ID == info.ID).FirstOrDefault();

            if (null == infoExist || infoExist.UserID != CurrentUser.ID)
            {
                return(Json(new APIJson(-1, "数据非法。这不是你的评课数据")));
            }
            if (EditProp == "TemplateItem" || string.IsNullOrEmpty(EditProp))
            {
                foreach (var item in infoExist.ResearchPlanInfo.EvalTemplateInfo.TemplateItemInfo)
                {
                    ResearchItemInfo infoItemExist = infoExist.ResearchItemInfo.FirstOrDefault(a => a.TemplateItemID == item.ID);
                    if (null == infoItemExist)
                    {
                        infoItemExist                = new ResearchItemInfo();
                        infoItemExist.ResearchID     = infoExist.ID;
                        infoItemExist.TemplateItemID = item.ID;
                        infoExist.ResearchItemInfo.Add(infoItemExist);
                    }
                    infoItemExist.ScoreValue = Function.GetRequestInt("TxtEvalTemplate" + item.ID, -1);
                    if (infoItemExist.ScoreValue < 0)
                    {
                        return(Json(new APIJson(-1, string.Format("请完善评价项 {0}", item.Name))));
                    }
                    if (infoExist.ResearchPlanInfo.EvalTemplateInfo.TypeFlag == (int)SysEnum.TemplateTypeFlag.分值模板)
                    {
                        if (infoItemExist.ScoreValue > item.MaxScore)
                        {
                            return(Json(new APIJson(-1, string.Format("评价项 {0}最高给分不能超过{1} ", item.Name, item.MaxScore))));
                        }
                    }
                }
                infoExist.ScoreTotal = infoExist.ResearchItemInfo.Sum(a => a.ScoreValue);
                infoExist.ScoreLever = 0;
            }
            if (EditProp == "SubjectiveOpinion" || string.IsNullOrEmpty(EditProp))
            {
                infoExist.SubjectiveOpinion = info.SubjectiveOpinion;
                infoExist.NoteMemo          = info.NoteMemo;
                if (null == infoExist.SubjectiveOpinion)
                {
                    infoExist.SubjectiveOpinion = string.Empty;
                }
                if (null == infoExist.NoteMemo)
                {
                    infoExist.NoteMemo = string.Empty;
                }
            }


            if (IsConfirm)
            {
                infoExist.Status = (int)SysEnum.ResearchStatus.已确认;
                if (infoExist.ResearchPlanInfo.TypeEnum == (int)SysEnum.ResearchPlanType.个人听课)
                {
                    infoExist.ResearchPlanInfo.Status = (int)SysEnum.ResearchPlanStatus.已结束;
                }
            }
            else if (infoExist.Status != (int)SysEnum.ResearchStatus.已确认)
            {
                infoExist.Status = (int)SysEnum.ResearchStatus.待确认;
            }
            if (ResearchBLL.Edit(infoExist))
            {
                string SuccessMsg = "评价保存成功";
                if (infoExist.Status != (int)SysEnum.ResearchStatus.已确认)
                {
                    // SuccessMsg += "。你还需对你的评价项进行确认提交";
                }
                else
                {
                    SuccessMsg += "。你已进行确认完成了此项评课活动";
                }
                return(Json(new APIJson(0, SuccessMsg)));
            }
            else
            {
                return(Json(new APIJson(-1, "提交失败了,请重试")));
            }
        }
Пример #14
0
        public ActionResult Create(ResearchPlanInfo info)
        {
            #region 计划对象ResearchPlanInfo
            info.Name = string.Format("{0}听评{1}", CurrentUser.Name, SysEnum.GetName(typeof(SysEnum.ResearchArea), info.AreaID));
            if (string.IsNullOrEmpty(info.Memo))
            {
                info.Memo = string.Empty;
            }
            if (info.DateBegin.Date < DateTime.Now.Date)
            {
                return(Json(new APIJson("日期有误")));
            }
            if (info.TemplateID <= 0)
            {
                return(Json(new APIJson("请选择评价模板")));
            }
            info.CategoryID   = PlanCategoryPersonalID;
            info.Address      = string.Empty;
            info.DateEnd      = info.DateBegin;
            info.TypeEnum     = (int)SysEnum.ResearchPlanType.个人听课;
            info.CreateUserID = CurrentUser.ID;
            info.CreateDate   = DateTime.Now;
            info.Status       = (int)SysEnum.ResearchPlanStatus.进行中;

            info.SummaryDetail   = string.Empty;
            info.SummaryUserName = string.Empty;
            #endregion

            #region 听评课对象ResearchInfo
            var infoResearch = new ResearchInfo();
            infoResearch.UserID            = CurrentUser.ID;
            infoResearch.SubjectID         = Function.GetRequestInt("SubjectID");
            infoResearch.lectureUserID     = Function.GetRequestInt("lectureUserID", 0);
            infoResearch.Topic             = Function.GetRequestString("Topic");
            infoResearch.LessionNumber     = Function.GetRequestInt("LessionNumber");
            infoResearch.ClassName         = Function.GetRequestString("ClassName");
            infoResearch.GradeName         = Function.GetRequestString("GradeName");
            infoResearch.SubjectiveOpinion = string.Empty;
            infoResearch.NoteMemo          = string.Empty;
            infoResearch.Status            = (int)SysEnum.ResearchStatus.未评;
            infoResearch.ScoreTotal        = 0;
            infoResearch.ScoreLever        = (int)SysEnum.ResearchScoreLever.合格;
            infoResearch.CreateDate        = DateTime.Now;
            var infoExist = ResearchBLL.GetList(a =>
                                                DbFunctions.DiffDays(a.CreateDate, infoResearch.CreateDate) == 0 &&
                                                a.ResearchPlanID == infoResearch.ResearchPlanID &&
                                                a.UserID == CurrentUser.ID &&
                                                a.ClassName == infoResearch.ClassName &&
                                                a.GradeName == infoResearch.GradeName &&
                                                a.LessionNumber == infoResearch.LessionNumber
                                                ).FirstOrDefault();
            if (null != infoExist)
            {
                return(Json(new APIJson(2, "您还在听评当前课程,将直接进入", new { PlanID = infoExist.ResearchPlanID, ResearchID = infoExist.ID })));
            }
            //infoResearch.ResearchPlanID
            //infoResearch.SubjectID
            if (string.IsNullOrEmpty(infoResearch.Topic))
            {
                return(Json(new APIJson(-1, "请填写课题")));
            }
            if (string.IsNullOrEmpty(infoResearch.ClassName))
            {
                return(Json(new APIJson(-1, "请填写年级")));
            }
            if (string.IsNullOrEmpty(infoResearch.GradeName))
            {
                return(Json(new APIJson(-1, "请填写班级")));
            }
            if (infoResearch.SubjectID <= 0)
            {
                return(Json(new APIJson(-1, "请选择学科")));
            }
            SubjectInfo infoSubject = SubjectBLL.GetList(a => a.ID == infoResearch.SubjectID).FirstOrDefault();
            if (null == infoSubject)
            {
                return(Json(new APIJson(-1, "请选择学科")));
            }
            infoResearch.SubjectInfo       = infoSubject;
            infoResearch.SubjectiveOpinion = string.Empty;
            infoResearch.NoteMemo          = string.Empty;
            infoResearch.Status            = (int)SysEnum.ResearchStatus.未评;
            infoResearch.ScoreTotal        = 0;
            infoResearch.ScoreLever        = (int)SysEnum.ResearchScoreLever.合格;

            infoResearch.ResearchPlanInfo = info;
            info.ResearchInfo.Add(infoResearch);
            #endregion


            if (!CreatePConfirmDepartmentID(info))
            {
                return(Json(new APIJson(-1, "请认真输放学校信息,对于系统未录入的学校,请务必认真输入全名")));
            }
            if (!CreatePConfirmlectureUserID(infoResearch))
            {
                return(Json(new APIJson(-1, "请认真输放听课对象,对于系统未录入的老师,请务必认真填写其姓名")));
            }
            if (ResearchPlanBLL.Create(info).ID > 0)
            {
                return(Json(new APIJson(0, "提交成功", new { PlanID = info.ID, ResearchID = infoResearch.ID })));
            }
            return(Json(new APIJson(-1, "提交失败,请重试")));
        }