Exemplo n.º 1
0
        public string SaveSchool(string jsonString, string action)
        {
            try
            {
                SchoolInfoEntity  entity  = JsonConvert.DeserializeObject <SchoolInfoEntity>(jsonString);
                SchoolInfoManager manager = new SchoolInfoManager();
                if (action == "add")
                {
                    manager.Insert(entity);
                }
                else
                {
                    SchoolInfoEntity oldEntity = manager.GetSchoolInfoByCode(entity.Code);
                    oldEntity.Name        = entity.Name;
                    oldEntity.Address     = entity.Address;
                    oldEntity.Description = entity.Description;

                    oldEntity.UpdateBy = SessionHelper.CurrentUser.Code;

                    manager.Update(oldEntity);
                }
                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
Exemplo n.º 2
0
        public void GetSchools()
        {
            //用于序列化实体类的对象
            JavaScriptSerializer jss = new JavaScriptSerializer();

            //请求中携带的条件
            string order     = HttpContext.Request.Params["order"];
            string sort      = HttpContext.Request.Params["sort"];
            string searchKey = HttpContext.Request.Params["search"];
            int    offset    = Convert.ToInt32(HttpContext.Request.Params["offset"]);
            int    pageSize  = Convert.ToInt32(HttpContext.Request.Params["limit"]);

            int total = 0;
            SchoolInfoManager       manager = new SchoolInfoManager();
            List <SchoolInfoEntity> list    = manager.GetSearch(searchKey, sort, order, offset, pageSize, out total);

            //给分页实体赋值
            PageModels <SchoolInfoEntity> model = new PageModels <SchoolInfoEntity>();

            model.total = total;
            if (total % pageSize == 0)
            {
                model.page = total / pageSize;
            }
            else
            {
                model.page = (total / pageSize) + 1;
            }

            model.rows = list;

            //将查询结果返回
            HttpContext.Response.Write(jss.Serialize(model));
        }
        public void GetSchoolContent()
        {
            List <DigitalContentEntity> list = new List <DigitalContentEntity>();

            //请求中携带的条件
            string type = HttpContext.Request.Params["type"];       //校园介绍:1, 校园规划:2

            SchoolInfoEntity schoolInfoEntity = null;

            if (type == "1")
            {
                schoolInfoEntity = new SchoolInfoManager().GetSchoolInfoByCode("CEA");
            }
            else
            {
                schoolInfoEntity = new SchoolInfoManager().GetSchoolInfoByCode("CEAFuture");
            }

            //将查询结果返回
            HttpContext.Response.Write(jss.Serialize(schoolInfoEntity.Description));
        }
Exemplo n.º 4
0
        public string PutSchoolInfo(SchoolInfoEntity entity)
        {
            try
            {
                if (entity == null)
                {
                    return("error");
                }

                SchoolInfoManager manager = new SchoolInfoManager();

                entity.CreateTime = DateTime.Now;
                entity.CreateTime = DateTime.Now;

                manager.Update(entity);

                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
Exemplo n.º 5
0
        public string DeleteSchoolInfo(int id)
        {
            try
            {
                SchoolInfoManager manager = new SchoolInfoManager();

                SchoolInfoEntity entity = manager.GetSchoolInfoByID(id);
                if (entity != null)
                {
                    entity.Valid      = "F";
                    entity.CreateTime = DateTime.Now;
                    entity.CreateTime = DateTime.Now;

                    manager.Update(entity);
                }

                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
Exemplo n.º 6
0
        public string GetAll(string order, string sort, string searchKey, int offset, int pageSize)
        {
            int total = 0;
            SchoolInfoManager       manager = new SchoolInfoManager();
            List <SchoolInfoEntity> list    = manager.GetSearch(searchKey, sort, order, offset, pageSize, out total);

            //给分页实体赋值
            PageModels <SchoolInfoEntity> model = new PageModels <SchoolInfoEntity>();

            model.total = total;
            if (total % pageSize == 0)
            {
                model.page = total / pageSize;
            }
            else
            {
                model.page = (total / pageSize) + 1;
            }

            model.rows = list;

            //将查询结果返回
            return(new JavaScriptSerializer().Serialize(model));
        }
Exemplo n.º 7
0
        public string GetSchoolInfoByName(string name)
        {
            SchoolInfoManager manager = new SchoolInfoManager();

            return(new JavaScriptSerializer().Serialize(manager.GetSchoolInfoByName(name)));
        }
Exemplo n.º 8
0
        public string GetSchoolInfoByID(int id)
        {
            SchoolInfoManager manager = new SchoolInfoManager();

            return(new JavaScriptSerializer().Serialize(manager.GetSchoolInfoByID(id)));
        }