示例#1
0
        public Array GetImageJSON(ResearchPlanInfo infoPlan)
        {
            var result = infoPlan.ResearchPlanAttachmentInfo.Select(a => new { a.ID, FullPath = a.PathRelative + a.Name }).ToList();

            return(result.ToArray());
            //return Newtonsoft.Json.JsonConvert.SerializeObject());
        }
示例#2
0
        public JsonResult CreatePersonal(ResearchPlanAttachmentInfo info)
        {
            ResearchPlanInfo infoPlan = ResearchPlanBLL.GetList(a => a.ID == info.ResearchPlanID).FirstOrDefault();
            var ifnoResearch          = infoPlan.ResearchInfo.FirstOrDefault();

            if (infoPlan.DateBegin.Date < DateTime.Now.Date)
            {
                return(Json(new APIJson(-1, "活动已过期")));
            }
            if (infoPlan.TypeEnum != (int)SysEnum.ResearchPlanType.个人听课)
            {
                return(Json(new APIJson(-1, "数据有误,不是个人听评课数据")));
            }
            //info.ResearchPlanID
            string SavePathRelative = SaveWechatImage(info.Name, infoPlan);

            info.Name           = SavePathRelative.Substring(SavePathRelative.LastIndexOf("/") + 1);
            info.PathRelative   = SavePathRelative.Substring(0, SavePathRelative.LastIndexOf("/") + 1);
            info.CreateDate     = DateTime.Now;
            info.MineType       = "images/jpg";
            info.CreateUserID   = ifnoResearch.lectureUserID;
            info.CreateUserName = CurrentUser.Name;
            info.TypeEnum       = (int)SysEnum.ResearchPlanAttachmentType.教案;
            //info.Name = "课表" + Guid.NewGuid().ToString();
            info.Memo     = string.Empty;
            info.ShowName = "课表" + infoPlan.ResearchPlanAttachmentInfo.Count() + 1;


            if (ResearchPlanAttachmentBLL.Create(info).ID > 0)
            {
                //var datajson=infoPlan.ResearchPlanAttachmentInfo.Select(a => new { a.Name, FullPath = a.Name + a.PathRelative });
                return(Json(new APIJson(0, "提交成功", GetImageJSON(infoPlan))));
            }
            return(Json(new APIJson(-1, "提交失败,请重试")));
        }
示例#3
0
        /// <summary>
        /// 通知学校有组织调研
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>

        public ActionResult PushMsg(int ID)
        {
            ResearchPlanInfo infoPlan = ResearchPlanBLL.GetList(a => a.ID == ID).FirstOrDefault();

            ViewBag.listRule = RuleBLL.GetList(a => a.Enable);
            return(View(infoPlan));
        }
示例#4
0
        public ActionResult Report1(int PlanID)
        {
            infoHead.LeftURL = Url.Action("index", "Research", new { ID = PlanID, PlanID = PlanID });


            ResearchPlanInfo info = ResearchPlanBLL.GetList(a => a.ID == PlanID).FirstOrDefault();
            List <int>       listDepartmentTypeID = info.DepartmentInfo.DepartmentTypeInfo.Select(a => a.ID).ToList();
            var listSubject = SubjectBLL.GetList(a => listDepartmentTypeID.Contains(a.DepartmentTypeID)).ToList();
            var listValuableSubjectResearch = info.ResearchInfo.Where(a => a.UserInfo.SubjectInfo.Select(u => u.ID).Contains(a.SubjectID));

            var result = listSubject.Select(subject => new
            {
                ID           = subject.ID,
                Name         = subject.Name,
                CountTeacher = listValuableSubjectResearch.Where(r => r.SubjectID == subject.ID).GroupBy(r => r.lectureUserID).Count(),
                CountItems   = listValuableSubjectResearch.Where(r => r.SubjectID == subject.ID).Count()
            }).OrderByDescending(a => a.CountItems).ToList();

            result.Add(new
            {
                ID           = 0,
                Name         = "小计",
                CountTeacher = result.Sum(r => r.CountTeacher),
                CountItems   = result.Sum(r => r.CountItems)
            });
            ViewBag.listResult = result;

            return(View(info));
        }
        public ActionResult Join(int ID)
        {
            ViewBag.ProfilesBLL = ProfilesBLL;

            ResearchPlanInfo infoPlan = ResearchPlanBLL.GetList(p => p.ID == ID).FirstOrDefault();

            if (infoPlan.DateBegin < DateTime.Now.Date)
            {
                return(RedirectToAction("Msg", "CommPage", new { Title = "计划已过期" }));
            }
            if (null != UserBLL.GetCurrent())
            {
                return(RedirectToAction("index", "Research", new { ID = ID, PlanID = ID }));
            }
            if (null == infoWechatUserReturn)
            {
                return(RedirectToAction("Msg", "CommPage", new { Title = "系统无法获取到您的个人信息" }));
            }
            var infoUser = UserBLL.GetList(a => a.WechatOpenID == infoWechatUserReturn.openid).FirstOrDefault();

            if (null != infoUser && infoPlan.ResearchPlanUserInfo.Any(a => a.UserID == infoUser.ID))
            {
                return(RedirectToAction("Detail", "ResearchPlan", new { ID = infoPlan.ID }));
            }

            ViewBag.infoPlan             = infoPlan;
            ViewBag.infoWechatUserReturn = infoWechatUserReturn;
            return(View(infoUser));
        }
示例#6
0
        public ActionResult Detail(int id)
        {
            infoHead.LeftURL = Url.Action("index");
            ResearchPlanInfo info = ResearchPlanBLL.GetList(p => p.ID == id).FirstOrDefault();

            return(View(info));
        }
示例#7
0
        public ActionResult Create()
        {
            GetSelectList();

            ResearchPlanInfo infoPlan = new ResearchPlanInfo();

            infoPlan.DateBegin = infoPlan.DateEnd = DateTime.Now;

            return(View(infoPlan));
        }
示例#8
0
        public ActionResult index(int PlanID)
        {
            ResearchPlanInfo info = ResearchPlanBLL.GetList(p => p.ID == PlanID).FirstOrDefault();

            if (info.DateBegin < DateTime.Now.Date)
            {
                return(RedirectToAction("Msg", "CommPage", new { Title = "计划已过期" }));
            }
            ViewBag.ImageJSON = GetImageJSON(info);// info.ResearchPlanAttachmentInfo.Select(a => new { a.ID, FullPath = a.Name + a.PathRelative });
            return(View(info));
        }
示例#9
0
        public ActionResult EditPlan(int PlanID)
        {
            infoHead.LeftURL = Url.Action("index");

            GetSelectList();

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

            infoPlan.DateBegin = infoPlan.DateEnd = DateTime.Now;

            return(View(infoPlan));
        }
示例#10
0
        public ActionResult Edit(int id)
        {
            infoHead.LeftURL = Url.Action("Detail", new { id = id });
            GetSelectList();
            ResearchPlanInfo info = ResearchPlanBLL.GetList(p => p.ID == id).FirstOrDefault();

            ViewBag.listPlanCategory = PlanCategoryBLL.GetList(a => a.Enable || a.ID == info.CategoryID).OrderByDescending(a => a.ID)
                                       .ToList().Select(a => new SelectListItem()
            {
                Text = a.Name, Value = a.ID.ToString()
            });
            return(View(info));
        }
示例#11
0
        private string SaveWechatImage(string MediaID, ResearchPlanInfo infoPlan)
        {
            string RelativePath = ImageSavePathRelative + infoPlan.DateBegin.ToString("yyyyMM") + "/";
            string SaveMapPath  = Server.MapPath(RelativePath);

            if (!Directory.Exists(SaveMapPath))
            {
                Directory.CreateDirectory(SaveMapPath);
            }
            string SaveName = DateTime.Now.ToFileTime().ToString() + ".jpg";

            WeiXin.APIClient.WechatService.WechatFile.GetMultimedia(WeiXin.APIClient.WechatService.GetAccessTonken(),
                                                                    MediaID, SaveMapPath, SaveName);
            return(RelativePath + SaveName);
        }
示例#12
0
        public ActionResult Confirm(int PlanID)
        {
            ResearchPlanInfo info = ResearchPlanBLL.GetList(p => p.ID == PlanID).FirstOrDefault();

            if (info.DateBegin < DateTime.Now.Date)
            {
                return(RedirectToAction("Msg", "CommPage", new { Title = "计划已过期" }));
            }
            var infoUser = info.ResearchPlanUserInfo.First(a => a.UserID == CurrentUser.ID);

            if (null == infoUser)
            {
                return(RedirectToAction("Msg", "CommPage", new { Title = "当前计划并没有邀请到您哦", Detail = "管理员可能已将您去除邀请" }));
            }

            return(View(infoUser));
        }
示例#13
0
        /// <summary>
        /// 检查听评对象用记是否存在,不存在则创建
        /// </summary>
        private bool CreatePConfirmDepartmentID(ResearchPlanInfo infoPlan)
        {
            DepartmentInfo infoDepartment = null;

            if (infoPlan.DepartmentID > 0)
            {
                infoDepartment = DepartmentBLL.GetList(a => a.ID == infoPlan.DepartmentID).FirstOrDefault();
                if (null != infoDepartment)
                {
                    infoPlan.DepartmentID   = infoDepartment.ID;
                    infoPlan.DepartmentInfo = infoDepartment;
                    return(true);
                }
            }
            infoDepartment          = new DepartmentInfo();
            infoDepartment.Name     = Function.GetRequestString("TxtDepartment");
            infoDepartment.ParentID = 0;
            infoDepartment.Enable   = false;
            infoDepartment.OrderID  = 0;
            infoDepartment.TypeEmun = infoPlan.AreaID;
            infoDepartment.Address  = string.Empty;
            if (string.IsNullOrEmpty(infoDepartment.Name))
            {
                return(false);
            }

            //再根据名称找一,如果就不要加啦
            var ExistItem = DepartmentBLL.GetList(a => a.Name == infoDepartment.Name && a.TypeEmun == infoPlan.AreaID).FirstOrDefault();

            if (null != ExistItem)
            {
                infoPlan.DepartmentID   = ExistItem.ID;
                infoPlan.DepartmentInfo = ExistItem;
                return(true);
            }

            if (DepartmentBLL.Create(infoDepartment).ID > 0)
            {
                infoPlan.DepartmentID   = infoDepartment.ID;
                infoPlan.DepartmentInfo = infoDepartment;
            }
            return(infoDepartment.ID > 0);
        }
示例#14
0
        public ActionResult Report3(int PlanID, int SubjectID)
        {
            //infoHead.LeftURL = Url.Action("ReportA", new { PlanID = PlanID });
            infoHead.LeftURL = Url.Action("index", "Research", new { ID = PlanID, PlanID = PlanID });

            ResearchPlanInfo info = ResearchPlanBLL.GetList(a => a.ID == PlanID).FirstOrDefault();
            var infoSubject       = SubjectBLL.GetList(a => a.ID == SubjectID).FirstOrDefault();

            ViewBag.infoSubject = infoSubject;
            foreach (var item in info.EvalTemplateInfo.TemplateSubjectSummaryInfo)
            {
                var infoItemSummary = info.ResearchPlanSubjectSummaryInfo.Where(s => s.SubjectID == SubjectID)
                                      .SelectMany(s => s.ResearchPlanSubjectSummaryItemInfo).FirstOrDefault(i => i.TemplateSummaryID == item.ID);
                if (null != infoItemSummary)
                {
                    ViewData["Detail" + item.ID] = infoItemSummary.Detail;
                }
            }
            return(View(info));
        }
示例#15
0
        public ActionResult PushMsg(int ID, string TimeStramp)
        {
            string RulesID = Function.GetRequestString("RulesID");

            WeiXin.APIClient.WechatService.TemplateMsg templateMsgHelper = new WeiXin.APIClient.WechatService.TemplateMsg();
            ResearchPlanInfo infoPlan    = ResearchPlanBLL.GetList(a => a.ID == ID).FirstOrDefault();
            List <string>    listRuleStr = RulesID.Split(',').ToList();

            if (null == listRuleStr || listRuleStr.Count() == 0)
            {
                return(Json(new APIJson(-1, "没有接收人员")));
            }
            List <int> listRuleID = new List <int>();

            foreach (var item in listRuleStr)
            {
                int RuleID = Convert.ToInt32(item);
                if (RuleID <= 0)
                {
                    continue;
                }

                listRuleID.Add(RuleID);
            }
            var listUserTarget = UserBLL.GetList(a => a.DepartmentID == infoPlan.DepartmentID && a.RuleInfo.Select(r => r.ID).Any(r => listRuleID.Contains(r)));
            int SuccessFlag    = 0;

            foreach (var itemUser in listUserTarget)
            {
                if (string.IsNullOrEmpty(itemUser.WechatOpenID))
                {
                    continue;
                }
                bool SendResult = templateMsgHelper.ResponseTemplateMsg(infoPlan, itemUser.WechatOpenID);
                if (SendResult)
                {
                    SuccessFlag++;
                }
            }
            return(Json(new APIJson(0, SuccessFlag + "人推送成功")));
        }
示例#16
0
        public ActionResult Create(ResearchPlanInfo info)
        {
            if (string.IsNullOrEmpty(info.Name))
            {
                return(Json(new APIJson("请填写名称")));
            }
            if (info.DepartmentID <= 0)
            {
                return(Json(new APIJson("请选择学校")));
            }

            if (info.TemplateID <= 0)
            {
                return(Json(new APIJson("请选择模板")));
            }

            if (string.IsNullOrEmpty(info.Memo))
            {
                info.Memo = string.Empty;
            }
            if (info.DateBegin.Date < DateTime.Now.Date)
            {
                return(Json(new APIJson("计划调研日期有误")));
            }

            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.SummaryUserName = string.Empty;
            info.SummaryDetail   = string.Empty;

            if (ResearchPlanBLL.Create(info).ID > 0)
            {
                return(Json(new APIJson(0, "提交成功", new { info.ID })));
            }
            return(Json(new APIJson(-1, "提交失败,请重试")));
        }
示例#17
0
        public ActionResult Edit(ResearchPlanInfo info)
        {
            ResearchPlanInfo infoExist = ResearchPlanBLL.GetList(p => p.ID == info.ID).FirstOrDefault();

            if (string.IsNullOrEmpty(info.Name))
            {
                return(Json(new APIJson("请填写名称")));
            }
            if (info.DepartmentID <= 0)
            {
                return(Json(new APIJson("请选择学校")));
            }
            if (string.IsNullOrEmpty(info.Memo))
            {
                info.Memo = string.Empty;
            }
            if (info.DateBegin.Date < DateTime.Now.Date && info.DateBegin != infoExist.DateBegin)
            {
                return(Json(new APIJson("计划调研日期有误")));
            }

            infoExist.CategoryID   = info.CategoryID;
            infoExist.Name         = info.Name;
            infoExist.DepartmentID = info.DepartmentID;
            infoExist.TemplateID   = info.TemplateID;
            infoExist.DateBegin    = info.DateBegin;
            infoExist.Memo         = info.Memo;
            //infoExist.typ


            if (ResearchPlanBLL.Edit(infoExist))
            {
                return(Json(new APIJson(0, "提交成功")));
            }
            return(Json(new APIJson(-1, "提交失败,请重试")));
        }
示例#18
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, "提交失败,请重试")));
        }
示例#19
0
        public ActionResult EditPlan(ResearchPlanInfo info)
        {
            ResearchPlanInfo infoExist = ResearchPlanBLL.GetList(a => a.ID == info.ID).FirstOrDefault();

            #region 计划对象ResearchPlanInfo
            if (string.IsNullOrEmpty(info.Memo))
            {
                info.Memo = string.Empty;
            }
            if (info.DateBegin.Date < DateTime.Now.Date)
            {
                return(Json(new APIJson("日期有误")));
            }
            infoExist.Memo      = info.Memo;
            infoExist.DateBegin = infoExist.DateEnd = info.DateBegin;

            #endregion

            #region 听评课对象ResearchInfo
            var infoResearch = infoExist.ResearchInfo.FirstOrDefault();
            //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;

            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.不合格;

            #endregion


            if (!CreatePConfirmlectureUserID(infoResearch))
            {
                return(Json(new APIJson(-1, "请认真输入听课对象,对于系统未录入的老师,请务必认真填写其姓名")));
            }
            if (ResearchPlanBLL.Edit(infoExist))
            {
                return(Json(new APIJson(0, "提交成功", new { info.ID })));
            }
            return(Json(new APIJson(-1, "提交失败,请重试")));
        }
        public ActionResult Join(UserInfo info)
        {
            string log = string.Empty;

            try
            {
                int PlanID = Function.GetRequestInt("PlanID");
                log += "\n PlanID=" + PlanID;
                string infoWechatUserReturnOpenID = Function.GetRequestString("infoWechatUserReturnOpenID");
                log += "\n infoWechatUserReturnOpenID=" + infoWechatUserReturnOpenID;
                ResearchPlanInfo infoPlan = ResearchPlanBLL.GetList(p => p.ID == PlanID).FirstOrDefault();
                log += "\n infoPlan=" + infoPlan;
                UserInfo infoUser = null;
                if (info.ID > 0)
                {
                    log     += "\n info.ID > 0=";
                    infoUser = UserBLL.GetList(a => a.ID == info.ID).FirstOrDefault();
                }
                if (null == infoUser)
                {
                    log     += "\n info.ID < 0=";
                    infoUser = UserBLL.GetList(a => a.WechatOpenID == infoWechatUserReturnOpenID).FirstOrDefault();
                }
                log += "\n infoUser="******"\n infoUser is null";
                    WechatUserReturnInfo infoWechatUserReturn = WeiXin.APIClient.WechatService.WechatUser.GetWechatUserReturnInfo(infoWechatUserReturnOpenID);
                    if (null == infoWechatUserReturn)
                    {
                        return(Json(new APIJson(-1, "无法获取用户信息")));
                    }
                    log     += "\n infoWechatUserReturn=" + infoWechatUserReturn;
                    infoUser = new UserInfo();
                    //infoUser.DepartmentID 从config中读到表单hiden了里
                    //infoUser.Name
                    if (string.IsNullOrEmpty(info.Name) || info.Name.Length > 50)
                    {
                        return(Json(new APIJson(-1, "请输入您的姓名")));
                    }
                    if (UserBLL.GetList(a => true).Any(a => a.Name == infoUser.Name))
                    {
                        return(Json(new APIJson(-1, "系统里居然有人跟你同名了,你换一个或加个数字后缀吧")));
                    }
                    var infoUserExistName = UserBLL.GetList(a => a.Name == info.Name).FirstOrDefault();
                    if (null != infoUserExistName)
                    {
                        return(Json(new APIJson(-1, "系统已存在当前用户名,请更换")));
                    }
                    infoUser.DepartmentID = info.DepartmentID;
                    infoUser.Name         = info.Name;
                    infoUser.Code         = infoUser.Name;
                    infoUser.PassWord     = string.Empty;
                    //infoUser.Email
                    if (null == infoUser.Email)
                    {
                        infoUser.Email = string.Empty;
                    }
                    infoUser.Email            = info.Email;
                    infoUser.Tel              = string.Empty;
                    infoUser.CreateDate       = DateTime.Now;
                    infoUser.LastDate         = DateTime.Now;
                    infoUser.Enable           = true;
                    infoUser.LocationX        = infoUser.LocationY = 0;
                    infoUser.WechatOpenID     = infoWechatUserReturn.openid;
                    infoUser.WechatNameNick   = infoWechatUserReturn.nickname;
                    infoUser.WechatHeadImg    = infoWechatUserReturn.headimgurl;
                    infoUser.Sex              = infoWechatUserReturn.sex.ToString();
                    infoUser.IDCard           = string.Empty;
                    infoUser.TypeID           = -1;
                    infoUser.DefaultSubjectID = 0;

                    log += "\n 准备完后infoUser="******"\n 创建完了";
                }

                ResearchPlanUserInfo infoPlanUser = new ResearchPlanUserInfo();
                infoPlanUser.ResearchPlanID = info.ID;
                infoPlanUser.UserID         = infoUser.ID;
                infoPlanUser.DateCreate     = DateTime.Now;
                infoPlanUser.DateConfirm    = DicInfo.DateZone;
                infoPlanUser.IsConfirmed    = true;
                infoPlanUser.Memo           = "二维码邀请";
                infoPlanUser.SumRemark      = string.Empty;
                infoPlan.ResearchPlanUserInfo.Add(infoPlanUser);
                var result = ResearchPlanBLL.Edit(infoPlan);
                if (result)
                {
                    return(Json(new APIJson(0, "恭喜您,成功加入本次听评课计划")));
                }
                else
                {
                    return(Json(new APIJson(-1, "加入失败了,请重试")));
                }
            }
            catch (Exception ex)
            {
                var ex2 = (System.Data.Entity.Infrastructure.DbUpdateException)ex;

                var ErrorMsg = log
                               + "Ex========" + ex.Message
                               + "\n ex2.InnerException.ObjectToJSON();" + ex2.InnerException.ObjectToJSON();
                return(Json(new APIJson(-1, ErrorMsg)));

                throw;
            }
        }
示例#21
0
        public ActionResult index(int PlanID)
        {
            infoHead.LeftURL = null == Url ? "" : Url.Action("index", "ResearchPlan", new { GoAction = "index", GoController = "Research" });


            ResearchPlanInfo info = ResearchPlanBLL.GetList(p => p.ID == PlanID).FirstOrDefault();

            ViewBag.listSubject = info.DepartmentInfo.DepartmentTypeInfo.SelectMany(a => a.SubjectInfo)
                                  .Select(p => new SelectListItem()
            {
                Text = p.Name, Value = p.ID.ToString()
            }).ToList();

            ViewBag.listLessionNumber = Common.GetListOrderID();
            ViewBag.listGrade         = Common.EnumToSelectListItem(typeof(SysEnum.LessionGrade));
            List <SelectListItem> listClass = new List <SelectListItem>();

            for (int i = 1; i < 50; i++)
            {
                listClass.Add(new SelectListItem()
                {
                    Text = i + "班", Value = i + "班"
                });
            }
            ViewBag.listClass = listClass;

            ViewBag.infoPlan = info;

            var listResearch = info.ResearchInfo.Where(a => true);

            if (!PowerActionBLL.PowerCheck(PowerInfo.P_评课管理.PP组织调研.PPP听评课管理.查看所有学科))
            {
                listResearch = listResearch.Where(a => a.UserID == CurrentUser.ID || CurrentUser.SubjectInfo.Select(s => s.ID).Contains(a.SubjectID));
            }
            if (PowerActionBLL.PowerCheck(PowerInfo.P_评课管理.PP组织调研.PPP听评课管理.仅查看个人被评) && CurrentUser.Name != "admin")
            {
                listResearch = listResearch.Where(a => a.lectureUserID == CurrentUser.ID);
            }
            if (PowerActionBLL.PowerCheck(PowerInfo.P_评课管理.PP组织调研.PPP听评课管理.仅查看个人) && CurrentUser.Name != "admin")
            {
                listResearch = listResearch.Where(a => a.UserID == CurrentUser.ID);
            }

            string GradeS    = Function.GetRequestString("GradeS");
            string NameS     = Function.GetRequestString("NameS");
            int    SubjectID = Function.GetRequestInt("SubjectID");

            if (SubjectID > 0)
            {
                listResearch         = listResearch.Where(a => a.SubjectID == SubjectID);
                ViewBag.DdlSubjectID = SubjectID;
            }
            if (!string.IsNullOrEmpty(GradeS))
            {
                listResearch      = listResearch.Where(a => a.GradeName == GradeS);
                ViewBag.DdlGradeS = GradeS;
            }
            if (!string.IsNullOrEmpty(NameS))
            {
                var listlectureUser = UserBLL.GetList(a => a.DepartmentID == info.DepartmentID && a.Name.Contains(NameS));
                listResearch     = listResearch.Where(a => listlectureUser.Select(u => u.ID).Contains(a.lectureUserID));
                ViewBag.TxtNameS = NameS;
            }
            listResearch         = listResearch.OrderByDescending(a => a.ID);
            ViewBag.listResearch = listResearch;


            return(View());
        }