Exemplo n.º 1
0
 //修改公告信息
 public ActionResult editGongGao(GongGao tqz)
 {
     if (tqz.ID <= 0)
     {
         GongGaoService.AddEntity(tqz);
         return(Json(new { ret = "ok", JsonRequestBehavior.AllowGet }));
     }
     else
     {
         return(Json(new { msg = "添加出错,请联系管理员!~", JsonRequestBehavior.AllowGet }));
     }
 }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            if (Request["reload"] == null)
            {
                //CheckCookieInfo();
            }
            var temp = GongGaoService.LoadEntities(x => x.ID > 0).DefaultIfEmpty();

            ViewData["TopGongG"] = Self(temp, 0);
            ViewData["QQ"]       = Self(temp, 4);
            ViewData["banquan"]  = Self(temp, 6);
            ViewData["Photo"]    = Self(temp, 2);
            ViewData["LogoName"] = Self(temp, 5);
            return(View());
        }
Exemplo n.º 3
0
        //删除公告信息
        public ActionResult DelGongGao()
        {
            var id    = Convert.ToInt64(Request["IDs"]);
            var tdata = GongGaoService.LoadEntities(x => x.ID == id).FirstOrDefault();

            if (tdata != null)
            {
                if (GongGaoService.DeleteEntity(tdata))
                {
                    return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { msg = "没有成功删除信息!" }, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(new { msg = "数据库中没有找到要删除的项目!" }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
 //添加公告信息
 public ActionResult AddGongGao(GongGao tqz)
 {
     if (tqz.ID <= 0)
     {
         var isnull = GongGaoService.LoadEntities(x => x.Items == tqz.Items).FirstOrDefault();
         if (isnull != null)
         {
             return(Json(new { msg = "文本分类必须保证唯一性~", JsonRequestBehavior.AllowGet }));
         }
         GongGaoService.AddEntity(tqz);
         return(Json(new { ret = "ok", JsonRequestBehavior.AllowGet }));
     }
     else
     {
         GongGaoService.EditEntity(tqz);
         return(Json(new { ret = "editok", msg = "修改成功!~", JsonRequestBehavior.AllowGet }));
     }
 }
Exemplo n.º 5
0
        //获取公告信息
        public ActionResult GetGongGao()
        {
            int pageIdex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 35;

            int totalcount = int.MaxValue;
            var mydata     = GongGaoService.LoadPageEntities(pageIdex, pageSize, out totalcount, x => x.Items != 7, x => x.ID, true);
            var temp       = from a in mydata
                             select new
            {
                ID    = a.ID,
                Items = a.Items,
                text  = a.text,
                bak   = a.bak
            };

            return(Json(new { rows = temp, total = totalcount }, JsonRequestBehavior.AllowGet));
        }