コード例 #1
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 保存用户最后的操作
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse SavsUserFinallyOperationRecord(SyncRequest request)
        {
            clr_pageInit submitData = JsonHelper.DecodeJson <clr_pageInit>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                clr_pageInit page = db.clr_pageInit.FirstOrDefault(p => p.UserID == submitData.UserID && p.AspxName == "Common");
                if (page != null)
                {
                    page.BookType  = submitData.BookType;
                    page.Stage     = submitData.Stage;
                    page.GradeID   = submitData.GradeID;
                    page.SubjectID = submitData.SubjectID;
                    page.EditionID = submitData.EditionID;
                    page.BookID    = submitData.BookID;
                    page.UnitID    = submitData.UnitID;
                    page.PageNum   = submitData.PageNum;
                    db.SaveChanges();
                }
                else
                {
                    submitData.PageInitID = Guid.NewGuid().ToString();
                    submitData.CreateTime = DateTime.Now;
                    submitData.AspxName   = "Common";
                    db.clr_pageInit.Add(submitData);
                    db.SaveChanges();
                }
                return(SyncResponse.GetResponse(request, true));
            }
        }
コード例 #2
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 检查备课中的资源
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse CheckPreLessonResource(SyncRequest request)
        {
            Resource submitData = JsonHelper.DecodeJson <Resource>(request.Data);
            UserInfo userDate   = JsonHelper.DecodeJson <UserInfo>(request.Data);

            string[] resourceArr = submitData.ResourceID.Split(',');

            bool result = false;

            foreach (var item in resourceArr)
            {
                using (var db = new fz_wisdomcampusEntities())
                {
                    IList <clr_preLesson> preLessonlist = db.clr_preLesson.Where(p => p.PreLessonContent.Contains(item) && p.UserID == userDate.UserID).ToList();
                    if (preLessonlist != null && preLessonlist.Count != 0)
                    {
                        result = true;
                    }
                    IList <clr_teachmap> maplist = db.clr_teachmap.Where(m => m.Map.Contains(item) && m.UserID == userDate.UserID).ToList();
                    if (maplist != null && maplist.Count != 0)
                    {
                        result = true;
                    }
                }
            }
            return(SyncResponse.GetResponse(request, result));
        }
コード例 #3
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        private SyncResponse DeletePreLessonResource(SyncRequest request)
        {
            PreLessonContent preLessonContent = new PreLessonContent();
            clr_preLesson    submitData       = JsonHelper.DecodeJson <clr_preLesson>(request.Data);
            PreLessonBtn     submitDataBtn    = JsonHelper.DecodeJson <PreLessonBtn>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                List <clr_preLesson> prelessonList = db.clr_preLesson.Where(p => p.UserID == submitData.UserID).ToList();
                foreach (var prelesson in prelessonList)
                {
                    preLessonContent = JsonHelper.DecodeJson <PreLessonContent>(prelesson.PreLessonContent);
                    for (int i = preLessonContent.btns.Count - 1; i >= 0; i--)
                    {
                        if (submitDataBtn.sourceUrl.IndexOf(preLessonContent.btns[i].sourceUrl) != -1)
                        {
                            preLessonContent.btns.Remove(preLessonContent.btns[i]);
                        }
                    }
                    string jsonContent = JsonHelper.DeepEncodeJson(preLessonContent);
                    prelesson.PreLessonContent = jsonContent;
                    prelesson.CreateDate       = DateTime.Now;
                    db.SaveChanges();
                }
                return(SyncResponse.GetResponse(request, true));
            }
        }
コード例 #4
0
 /// <summary>
 /// 老师获取(课堂练习)自然拼读
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Exercises Get(string id)
 {
     using (var db = new fz_wisdomcampusEntities())
     {
         return(db.clr_exercises.Where(w => w.UserID == id).Select(s => new Exercises
         {
             Resources = s.Resources
         }).FirstOrDefault());
     }
 }
コード例 #5
0
ファイル: BasicDataImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 根据用户ID获取教材数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse GetUserStandBook(SyncRequest request)
        {
            UserStandBook submitData = JsonHelper.DecodeJson <UserStandBook>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                List <clr_electronic_book> booklist = db.clr_electronic_book.Where(b => b.UserID == submitData.UserID).ToList();
                return(SyncResponse.GetResponse(request, booklist));
            }
        }
コード例 #6
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        private SyncResponse SelExercises(SyncRequest request)
        {
            clr_exercises submitData = JsonHelper.DecodeJson <clr_exercises>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                List <clr_exercises> list = db.clr_exercises.Where(e => e.UserID == submitData.UserID).ToList();
                return(SyncResponse.GetResponse(request, list));
            }
        }
コード例 #7
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 查询SelectBook页面操作数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse SelectInitData(SyncRequest request)
        {
            clr_pageInit submitData = JsonHelper.DecodeJson <clr_pageInit>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                List <clr_pageInit> list = db.clr_pageInit.Where(p => p.UserID == submitData.UserID && p.AspxName == submitData.AspxName).ToList();
                return(SyncResponse.GetResponse(request, list));
            }
        }
コード例 #8
0
ファイル: BasicDataImplement.cs プロジェクト: maziweis/webcls
        private SyncResponse GetBookListForTop(SyncRequest request)
        {
            UserStandBook submitData = JsonHelper.DecodeJson <UserStandBook>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                List <clr_electronic_book> booklist = db.clr_electronic_book.Where(b => b.UserID == submitData.UserID).OrderByDescending(o => o.CreateDate).OrderByDescending(o => o.EndUseDate).Take(3).ToList();
                return(SyncResponse.GetResponse(request, booklist));
            }
        }
コード例 #9
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        private SyncResponse GetUserFinallyOperationRecord(SyncRequest request)
        {
            PageInit submitData = JsonHelper.DecodeJson <PageInit>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                clr_pageInit page = db.clr_pageInit.FirstOrDefault(p => p.UserID == submitData.UserID && p.AspxName == "Common");
                return(SyncResponse.GetResponse(request, page));
            }
        }
コード例 #10
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        private SyncResponse InsertExercises(SyncRequest request)
        {
            clr_exercises submitData = JsonHelper.DecodeJson <clr_exercises>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                db.clr_exercises.Add(submitData);
                db.SaveChanges();
                return(SyncResponse.GetResponse(request, true));
            }
        }
コード例 #11
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 保存Teaching页面操作数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse SaveTeachingData(SyncRequest request)
        {
            clr_pageInit submitData = JsonHelper.DecodeJson <clr_pageInit>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                db.clr_pageInit.Add(submitData);
                db.SaveChanges();
                return(SyncResponse.GetResponse(request, true));
            }
        }
コード例 #12
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        private SyncResponse UpdateStanBookUsingTime(SyncRequest request)
        {
            clr_electronic_book submitData = JsonHelper.DecodeJson <clr_electronic_book>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                clr_electronic_book book = db.clr_electronic_book.FirstOrDefault(b => b.UserID == submitData.UserID && b.BookID == submitData.BookID);
                book.EndUseDate = DateTime.Now;
                db.SaveChanges();
                return(SyncResponse.GetResponse(request, true));
            }
        }
コード例 #13
0
ファイル: BasicDataImplement.cs プロジェクト: maziweis/webcls
        private SyncResponse DeleteUserPreLessonData(SyncRequest request)
        {
            UserInfo submitData = JsonHelper.DecodeJson <UserInfo>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                var list = db.clr_preLesson.Where(p => p.UserID == submitData.UserID).ToList();
                foreach (var item in list)
                {
                    db.clr_preLesson.Remove(item);
                }
                db.SaveChanges();
            }
            return(SyncResponse.GetResponse(request, true));
        }
コード例 #14
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 查询页面备课数据从智慧教室后台
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse SelBookPageData(SyncRequest request)
        {
            BookInfo submitData = JsonHelper.DecodeJson <BookInfo>(request.Data);

            //List<int> pages = new List<int>(submitData.Pages);
            using (var db = new fz_wisdomcampusEntities())
            {
                List <clr_preLesson> list = db.clr_preLesson.Where(
                    p => p.UserID == submitData.UserID &&
                    p.BookID == submitData.BookID &&
                    submitData.Pages.Contains((int)p.Page)
                    ).ToList();
                return(SyncResponse.GetResponse(request, list));
            }
        }
コード例 #15
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        private SyncResponse DeletePreLesson(SyncRequest request)
        {
            PreLessonContent preLessonContent = new PreLessonContent();
            clr_preLesson    submitData       = JsonHelper.DecodeJson <clr_preLesson>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                List <clr_preLesson> prelessonList = db.clr_preLesson.Where(p => p.UserID == submitData.UserID).ToList();
                foreach (var prelesson in prelessonList)
                {
                    db.clr_preLesson.Remove(prelesson);
                    db.SaveChanges();
                }
                return(SyncResponse.GetResponse(request, true));
            }
        }
コード例 #16
0
        public PageInit GET(string UserID, int SubjectID, int GradeID)
        {
            PageInit            m    = new PageInit();
            clr_electronic_book eb   = null;
            List <r_resource>   lRes = null;

            using (var db = new fz_wisdomcampusEntities())
            {
                eb = db.clr_electronic_book.Where(w => w.UserID == UserID && w.SubjectID == SubjectID && w.GradeID == GradeID).FirstOrDefault();
            }
            //using (var db1 = new fz_resourceEntities())
            //{
            //    lRes = db1.r_resource.Where(w => w.ResourceCreaterID == UserID && w.SubjectID == SubjectID && w.GradeID == eb.GradeID).ToList();
            //}

            //foreach (var ds in eb)
            //{
            //    m.Add(new PageInit
            //    {
            //        BookID = ds.BookID,
            //        BookName = ds.BookID == null ? "" : Bll.DictTextbookBll.GetName((int)ds.BookID),
            //        UnitInfo = Bll.DictTextbookCatalogBll.GetTextbookCatalogByBookid((int)ds.BookID).Select(s => new UnitInfo
            //        {
            //            UnitID = s.Id,
            //            UnitName = s.Name
            //        }).ToList(),
            //        UserID = ds.UserID
            //    });
            //}
            m.UserID   = UserID;
            m.BookID   = eb.BookID;
            m.BookName = eb.BookID == null ? "" : Bll.DictTextbookBll.GetName((int)eb.BookID);
            //m.UnitInfo = lRes.Select(s => new UnitInfo
            //{
            //    UnitID = s.Catalog,
            //    UnitName = s.KeyWords
            //}).ToList();
            m.UnitInfo = Bll.DictTextbookCatalogBll.GetTextbookCatalogByBookid((int)eb.BookID).Select(s => new UnitInfo
            {
                UnitID   = s.Id,
                UnitName = s.Name
            }).ToList();
            return(m);
        }
コード例 #17
0
        /// <summary>
        /// 学生获取(课堂练习)自然拼读
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List <Exercises> Get(string UserID, int SubjectID)
        {
            string tid   = "";
            int?   grade = null;

            using (var db1 = new FzDatabase.Basic.fz_basicEntities())
            {
                var stu = db1.sy_student.Where(w => w.UserId == UserID).FirstOrDefault();
                grade = stu.sy_grade.SGradeId;
                tid   = db1.sy_teacher_and_class_and_subject.Where(w => w.ClassId == stu.Class && w.Subject == SubjectID).Select(s => s.sy_teacher.UserId).FirstOrDefault();
            }
            using (var db = new fz_wisdomcampusEntities())
            {
                return(db.clr_exercises.Where(w => w.UserID == tid.Trim()).Select(s => new Exercises
                {
                    Resources = s.Resources
                }).ToList());
            }
        }
コード例 #18
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 保存用户教学地图数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse SaveUserTeachMap(SyncRequest request)
        {
            BookMap  submitData = JsonHelper.DecodeJson <BookMap>(request.Data);
            UserInfo userData   = JsonHelper.DecodeJson <UserInfo>(request.Data);

            if (userData.Type == 4)//管理员
            {
                HttpClient myHttpClient = new HttpClient();
                myHttpClient.BaseAddress = new Uri(webapi_url); //webapi_url
                string json    = JsonHelper.DeepEncodeJson(submitData);
                var    content = new StringContent(json, Encoding.UTF8);
                content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                HttpResponseMessage response = myHttpClient.PostAsync("GetTextBookMap", content).Result;
                return(SyncResponse.GetResponse(request, response.IsSuccessStatusCode));
            }
            else
            {
                using (var db = new fz_wisdomcampusEntities())
                {
                    var map = db.clr_teachmap.FirstOrDefault(m => m.UserID == userData.UserID && m.BookID == submitData.bookId && m.UnitID == submitData.unitId);
                    if (map != null)
                    {
                        map.Map        = submitData.MapContent;
                        map.CreateTime = DateTime.Now;
                        db.SaveChanges();
                    }
                    else
                    {
                        clr_teachmap model = new clr_teachmap();
                        model.ID         = Guid.NewGuid();
                        model.UserID     = userData.UserID;
                        model.BookID     = submitData.bookId;
                        model.UnitID     = submitData.unitId;
                        model.Map        = submitData.MapContent;
                        model.CreateTime = DateTime.Now;
                        db.clr_teachmap.Add(model);
                        db.SaveChanges();
                    }
                }
                return(SyncResponse.GetResponse(request, true));
            }
        }
コード例 #19
0
        /// <summary>
        /// 老师端获取目录信息
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="SubjectID"></param>
        /// <param name="GradeID"></param>
        /// <returns></returns>
        public PageInit GET(string UserID, int SubjectID, int GradeID)
        {
            PageInit            m    = new PageInit();
            clr_electronic_book eb   = null;
            List <r_resource>   lRes = null;

            using (var db = new fz_wisdomcampusEntities())
            {
                eb = db.clr_electronic_book.Where(w => w.UserID == UserID && w.SubjectID == SubjectID && w.GradeID == GradeID).FirstOrDefault();
            }
            using (var db1 = new fz_resourceEntities())
            {
                lRes = db1.r_resource.Where(w => w.ResourceCreaterID == UserID && w.SubjectID == SubjectID && w.GradeID == eb.GradeID).ToList();
            }

            m.UserID   = UserID;
            m.BookID   = eb.BookID;
            m.BookName = GetBookName(eb.BookID);
            List <UnitInfo> nonDuplicateList1 = lRes.Select(s => new UnitInfo
            {
                UnitID   = s.Catalog,
                UnitName = GetUnitNameTech(s.Catalog)
            }).Distinct().ToList();
            List <UnitInfo> nonDuplicateList2 = nonDuplicateList1.Where((x, i) => nonDuplicateList1.FindIndex(z => z.UnitID == x.UnitID) == i).ToList();//Lambda表达式去重

            m.UnitInfo = nonDuplicateList2;
            //m.UnitInfo = Bll.DictTextbookCatalogBll.GetTextbookCatalogByBookid((int)eb.BookID).Select(s => new UnitInfo
            //{
            //    UnitID = s.Id,
            //    UnitName = s.Name
            //}).ToList();
            //string UnitID = null;
            //foreach (UnitInfo un in m.UnitInfo)
            //{
            //    if (un.UnitID == UnitID)
            //    {

            //    }
            //    UnitID=
            //}
            return(m);
        }
コード例 #20
0
        /// <summary>
        /// 学生端获取目录信息
        /// </summary>
        /// <param name="UserID">131b1f49-7064-4fba-a380-9c169701a818</param>
        /// <param name="SubjectID"></param>
        /// <returns></returns>
        public PageInit GET(string UserID, int SubjectID, int GradeID)
        {
            string            tid   = "";
            int?              grade = null;
            List <r_resource> lRes  = null;

            using (var db1 = new FzDatabase.Basic.fz_basicEntities())
            {
                var stu = db1.sy_student.Where(w => w.UserId == UserID.Trim()).FirstOrDefault();
                grade = stu.sy_grade.SGradeId + 1;
                tid   = db1.sy_teacher_and_class_and_subject.Where(w => w.ClassId == stu.Class && w.Subject == SubjectID).Select(s => s.sy_teacher.UserId).FirstOrDefault();
            }

            using (var db2 = new fz_resourceEntities())
            {
                lRes = db2.r_resource.Where(w => w.ResourceCreaterID == tid && w.SubjectID == SubjectID && w.GradeID == GradeID).ToList();
            }
            PageInit            m  = new PageInit();
            clr_electronic_book eb = null;

            using (var db = new fz_wisdomcampusEntities())
            {
                eb = db.clr_electronic_book.Where(w => w.UserID == tid && w.GradeID == GradeID && w.SubjectID == SubjectID).FirstOrDefault();
            }
            m.UserID   = tid;
            m.BookID   = eb.BookID;
            m.BookName = eb.BookID == null ? "" : Bll.DictTextbookBll.GetName((int)eb.BookID);
            List <UnitInfo> nonDuplicateList1 = lRes.Select(s => new UnitInfo
            {
                UnitID   = s.Catalog,
                UnitName = GetUnitNameStu(s.Catalog)
            }).Distinct().ToList();
            List <UnitInfo> nonDuplicateList2 = nonDuplicateList1.Where((x, i) => nonDuplicateList1.FindIndex(z => z.UnitID == x.UnitID) == i).ToList();//Lambda表达式去重

            m.UnitInfo = nonDuplicateList2;
            //m.UnitInfo = Bll.DictTextbookCatalogBll.GetTextbookCatalogByBookid((int)eb.BookID).Select(s => new UnitInfo
            //{
            //    UnitID = s.Id,
            //    UnitName = s.Name
            //}).ToList();
            return(m);
        }
コード例 #21
0
        /// <summary>
        /// 老师获取单元目录
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="SubjectID"></param>
        /// <returns></returns>
        public PageInit GET(string UserID, int SubjectID, int GradeID)
        {
            string              tid = UserID;
            PageInit            m   = new PageInit();
            clr_electronic_book eb  = null;

            using (var db = new fz_wisdomcampusEntities())
            {
                eb = db.clr_electronic_book.Where(w => w.UserID == tid && w.GradeID == GradeID).FirstOrDefault();
            }
            m.UserID   = tid;
            m.BookID   = eb.BookID;
            m.BookName = eb.BookID == null ? "" : Bll.DictTextbookBll.GetName((int)eb.BookID);
            m.UnitInfo = Bll.DictTextbookCatalogBll.GetTextbookCatalogByBookid((int)eb.BookID).Select(s => new UnitInfo
            {
                UnitID   = s.Id,
                UnitName = s.Name
            }).ToList();
            return(m);
        }
コード例 #22
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 更新Teaching页面操作数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse UpdateTeachingData(SyncRequest request)
        {
            clr_pageInit submitData = JsonHelper.DecodeJson <clr_pageInit>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                clr_pageInit item = db.clr_pageInit.Where(
                    p => p.UserID == submitData.UserID &&
                    p.ClassID == submitData.ClassID &&
                    p.BookID == submitData.BookID &&
                    p.AspxName == submitData.AspxName
                    ).OrderByDescending(o => o.CreateTime).FirstOrDefault();
                item.UnitID     = submitData.UnitID;
                item.PageNum    = submitData.PageNum;
                item.CreateTime = submitData.CreateTime;
                item.UnitName   = submitData.UnitName;
                db.SaveChanges();
                return(SyncResponse.GetResponse(request, true));
            }
        }
コード例 #23
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 保存用户备课数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse SaveUserPresson(SyncRequest request)
        {
            List <clr_preLesson> submitData = JsonHelper.DecodeJson <List <clr_preLesson> >(request.Data);
            List <UserInfo>      userData   = JsonHelper.DecodeJson <List <UserInfo> >(request.Data);

            if (userData[0].Type == 4)//管理员
            {
                HttpClient myHttpClient = new HttpClient();
                myHttpClient.BaseAddress = new Uri(webapi_url);

                string json    = JsonHelper.DeepEncodeJson(submitData);
                var    content = new StringContent(json, Encoding.UTF8);
                content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                HttpResponseMessage response = myHttpClient.PostAsync("TextbookResource", content).Result;
                return(SyncResponse.GetResponse(request, response.IsSuccessStatusCode));
            }
            else
            {
                foreach (var item in submitData)
                {
                    using (var db = new fz_wisdomcampusEntities())
                    {
                        var prelesson = db.clr_preLesson.FirstOrDefault(p => p.BookID == item.BookID && p.Page == item.Page && p.UserID == item.UserID);
                        if (prelesson != null)
                        {
                            prelesson.PreLessonContent = item.PreLessonContent;
                            prelesson.CreateDate       = DateTime.Now;
                            db.SaveChanges();
                        }
                        else
                        {
                            item.PreLessonID = Guid.NewGuid().ToString();
                            item.CreateDate  = DateTime.Now;
                            db.clr_preLesson.Add(item);
                            db.SaveChanges();
                        }
                    }
                }
                return(SyncResponse.GetResponse(request, true));
            }
        }
コード例 #24
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 获取用户教学地图数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse GetUserTeachMapJsonByWhere(SyncRequest request)
        {
            clr_teachmap submitData = JsonHelper.DecodeJson <clr_teachmap>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                var map = db.clr_teachmap.FirstOrDefault(m => m.UserID == submitData.UserID && m.BookID == submitData.BookID && m.UnitID == submitData.UnitID);
                if (map == null)
                {
                    HttpClient myHttpClient = new HttpClient();
                    myHttpClient.BaseAddress = new Uri(webapi_url); //webapi_url
                    HttpResponseMessage response = myHttpClient.GetAsync("GetTextBookMap?BookID=" + submitData.BookID + "&unitId=" + submitData.UnitID).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        string json = response.Content.ReadAsStringAsync().Result;
                        if (json.IndexOf("\"[") != -1)
                        {
                            json = json.Substring(1, json.Length - 2);
                        }
                        if (json.Length > 2 && json != "null")
                        {
                            json = json.Replace("/", "").Replace("\\", "");
                            return(SyncResponse.GetResponse(request, json));
                        }
                        else
                        {
                            return(SyncResponse.GetResponse(request, ""));
                        }
                    }
                    else
                    {
                        return(SyncResponse.GetResponse(request, null));
                    }
                }
                else
                {
                    return(SyncResponse.GetResponse(request, map.Map));
                }
            }
        }
コード例 #25
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        private SyncResponse UpdateExercises(SyncRequest request)
        {
            clr_exercises submitData = JsonHelper.DecodeJson <clr_exercises>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                List <clr_exercises> list = db.clr_exercises.Where(e => e.UserID == submitData.UserID).ToList();
                if (list != null)
                {
                    foreach (var item in list)
                    {
                        item.Resources = submitData.Resources;
                    }
                    db.SaveChanges();
                    return(SyncResponse.GetResponse(request, true));
                }
                else
                {
                    return(SyncResponse.GetResponse(request, false));
                }
            }
        }
コード例 #26
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 更新SelectBook页面操作数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse UpdateInitData(SyncRequest request)
        {
            clr_pageInit submitData = JsonHelper.DecodeJson <clr_pageInit>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                List <clr_pageInit> list = db.clr_pageInit.Where(p => p.UserID == submitData.UserID && p.AspxName == submitData.AspxName).ToList();
                foreach (var item in list)
                {
                    item.GradeID    = submitData.GradeID;
                    item.ClassID    = submitData.ClassID;
                    item.SubjectID  = submitData.SubjectID;
                    item.EditionID  = submitData.EditionID;
                    item.BookType   = submitData.BookType;
                    item.Stage      = submitData.Stage;
                    item.BookID     = submitData.BookID;
                    item.CreateTime = submitData.CreateTime;
                }
                db.SaveChanges();
                return(SyncResponse.GetResponse(request, true));
            }
        }
コード例 #27
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 获取用户备课数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse GetUserPressonJsonByWhere(SyncRequest request)
        {
            clr_preLesson submitData = JsonHelper.DecodeJson <clr_preLesson>(request.Data);

            using (var db = new fz_wisdomcampusEntities())
            {
                clr_preLesson prelesson = db.clr_preLesson.FirstOrDefault(p => p.UserID == submitData.UserID && p.BookID == submitData.BookID && p.Page == submitData.Page);
                if (prelesson == null)
                {
                    HttpClient myHttpClient = new HttpClient();
                    myHttpClient.BaseAddress = new Uri(webapi_url);
                    HttpResponseMessage response = myHttpClient.GetAsync("TextbookResource?bookId=" + submitData.BookID + "&pages=" + submitData.Page).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        string json = response.Content.ReadAsStringAsync().Result;
                        if (json.Length > 2)
                        {
                            return(SyncResponse.GetResponse(request, json));
                        }
                        else
                        {
                            return(SyncResponse.GetResponse(request, null));
                        }
                    }
                    else
                    {
                        return(SyncResponse.GetResponse(request, null));
                    }
                }
                else
                {
                    return(SyncResponse.GetResponse(request, prelesson.PreLessonContent));
                }
            }
        }
コード例 #28
0
        /// <summary>
        /// 获取当前单元ID
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="BookID"></param>
        /// <returns></returns>
        public UnitInfo Get(string UserID, int BookID, int ClassID)
        {
            clr_pageInit unit = new clr_pageInit();

            using (var db = new fz_wisdomcampusEntities())
            {
                unit = db.clr_pageInit.Where(w => w.UserID == UserID.Trim() && w.ClassID == ClassID && w.BookID == BookID && w.AspxName == "Teaching").FirstOrDefault();
            }
            UnitInfo UnitInfo = new UnitInfo();

            UnitInfo.UnitID   = unit.UnitID;
            UnitInfo.UnitName = Bll.DictTextbookCatalogBll.GetName((int)unit.UnitID);

            return(UnitInfo);
            //}
            //using (var db1 = new FzDatabase.ModMetaBreach.MODMetaDatabaseBranchEntities())
            //{
            //   return db1.tb_StandardCatalog.Where(w => w.ID == unit.UnitID).Select(s => new UnitInfo
            //    {
            //        UnitID = unit.UnitID,
            //        UnitName = s.FolderName
            //    }).FirstOrDefault();
            //}
        }
コード例 #29
0
ファイル: TeachImplement.cs プロジェクト: maziweis/webcls
        /// <summary>
        /// 用户添加教材
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private SyncResponse AddUserStandBook(SyncRequest request)
        {
            try
            {
                UserStandBookModul submitData = JsonHelper.DecodeJson <UserStandBookModul>(request.Data);
                using (var db = new fz_wisdomcampusEntities())
                {
                    List <StandBook>           AddList    = new List <StandBook>();
                    List <clr_electronic_book> RemoveList = new List <clr_electronic_book>();;
                    var list = db.clr_electronic_book.Where(b => b.UserID == submitData.UserID).ToList();

                    ////////////////添加的教材为空的时候,清空用户教材//////////////////////
                    if (submitData.StandBookList.Count() == 0)
                    {
                        foreach (var item in list)
                        {
                            db.clr_electronic_book.Remove(item);
                        }
                        db.SaveChanges();
                    }
                    else
                    {
                        ///////////////匹配获取需要添加的教材//////////////////
                        foreach (var book in submitData.StandBookList)
                        {
                            clr_electronic_book model = list.FirstOrDefault(b => b.BookID == book.ID);
                            if (model == null)
                            {
                                AddList.Add(book);
                            }
                        }
                        ///////////////匹配获取需要删除的教材//////////////////
                        foreach (var book in list)
                        {
                            StandBook model = submitData.StandBookList.FirstOrDefault(b => b.ID == book.BookID);
                            if (model == null)
                            {
                                RemoveList.Add(book);
                            }
                        }
                        ///////////////删除教材/////////////////
                        foreach (var item in RemoveList)
                        {
                            clr_electronic_book model = list.FirstOrDefault(b => b.BookID == item.BookID);
                            db.clr_electronic_book.Remove(model);
                            db.SaveChanges();
                        }
                        ///////////////添加教材/////////////////
                        foreach (var book in AddList)
                        {
                            clr_electronic_book model = new clr_electronic_book();
                            model.BookID     = book.ID;
                            model.SubjectID  = book.Subject;
                            model.EditionID  = book.Edition;
                            model.GradeID    = book.Grade;
                            model.BookType   = book.BookType;
                            model.Stage      = book.Stage;
                            model.UserID     = submitData.UserID;
                            model.CreateDate = DateTime.Now;
                            db.clr_electronic_book.Add(model);
                        }
                        db.SaveChanges();
                    }
                }
                return(SyncResponse.GetResponse(request, true));
            }
            catch (Exception ex)
            {
                return(SyncResponse.GetErrorResponse(ex.Message));
            }
        }