Example #1
0
        public Dictionary <string, object> Fenye(int pageIndex)
        {
            int                rows = 0;
            List <Guanli>      list = FenYe <int>(e => e.Id, e => e.Id > 0, ref rows, pageIndex, 3);
            List <GuanliModel> dt   = new List <GuanliModel>();

            foreach (Guanli item in list)
            {
                GuanliModel um = new GuanliModel()
                {
                    Id        = item.Id,
                    gname     = item.gname,
                    Explain   = item.Explain,
                    Available = item.Available
                };
                dt.Add(um);
            }
            //获取总行数
            List <Guanli> list3 = db.Guanlis.OrderBy(e => e.Id).Where(e => e.Id > 0).ToList();

            rows = list3.Count();
            //获取总页数
            double page  = rows / 3.00;
            int    pages = int.Parse(Math.Ceiling(page).ToString());
            Dictionary <string, object> di = new Dictionary <string, object>();

            di["dt"]    = dt;
            di["rows"]  = rows;
            di["pages"] = pages;
            return(di);
        }
Example #2
0
 public ActionResult Create(GuanliModel g)
 {
     if (gb.Add(g) > 0)
     {
         return(Content("<script>alert('新增成功');window.location='Index'</script>"));
     }
     else
     {
         ViewBag.dt = g;
     }
     return(View());
 }
Example #3
0
        public int Update(GuanliModel st)
        {
            Guanli est = new Guanli()
            {
                Id        = st.Id,
                gname     = st.gname,
                Explain   = st.Explain,
                Available = st.Available
            };

            return(Update(est));
        }
Example #4
0
        public int Add(GuanliModel st)
        {
            //把DTO转为EO
            Guanli est = new Guanli()
            {
                Id        = st.Id,
                gname     = st.gname,
                Explain   = st.Explain,
                Available = st.Available
            };

            return(Add(est));
        }
Example #5
0
        public ActionResult Delete(int id)
        {
            GuanliModel s = new GuanliModel
            {
                Id = id
            };

            if (gb.Del(s) > 0)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Example #6
0
        public List <Model.GuanliModel> Select()
        {
            List <Guanli>      list  = SelectAll();
            List <GuanliModel> list2 = new List <GuanliModel>();

            foreach (Guanli item in list)
            {
                GuanliModel sm = new GuanliModel()
                {
                    Id        = item.Id,
                    gname     = item.gname
                    , Explain = item.Explain,
                    Available = item.Available
                };
                list2.Add(sm);
            }
            return(list2);
        }
Example #7
0
        public List <GuanliModel> SelectBy(GuanliModel st)
        {
            List <Guanli>      list  = SelectBy(e => e.Id.Equals(st.Id));
            List <GuanliModel> list2 = new List <GuanliModel>();

            foreach (var item in list)
            {
                GuanliModel sd = new GuanliModel()
                {
                    Id        = item.Id,
                    gname     = item.gname,
                    Explain   = item.Explain,
                    Available = item.Available
                };
                list2.Add(sd);
            }
            return(list2);
        }
Example #8
0
        public ActionResult Create(usersModel u)
        {
            GuanliModel gu = new GuanliModel();

            usersModel pt = new usersModel()
            {
                u_name      = u.u_name,
                u_password  = u.u_password,
                u_true_name = u.u_true_name,
                Gid         = u.Id
            };

            if (us.Add(pt) > 0)
            {
                return(Content("<script>alert('新增成功');window.location='Index'</script>"));
            }
            else
            {
                ViewBag.dt = u;
            }
            return(View());
        }
Example #9
0
 public int Update(GuanliModel st)
 {
     return(ist.Update(st));
 }
Example #10
0
 public int Del(GuanliModel st)
 {
     return(ist.Del(st));
 }
Example #11
0
 public int Add(GuanliModel st)
 {
     return(ist.Add(st));
 }
Example #12
0
 public List <GuanliModel> SelectBy(GuanliModel st)
 {
     return(ist.SelectBy(st));
 }