示例#1
0
        /// <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
        /// <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));
            }
        }
示例#3
0
        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));
            }
        }
示例#4
0
        /// <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));
            }
        }
示例#5
0
        /// <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));
            }
        }
示例#6
0
        /// <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));
            }
        }
示例#7
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();
            //}
        }