Beispiel #1
0
        public ActionResult GetProdectByNormId(int id, PageingModel <ProductModel> pageingModel)
        {
            BowntdbEntities         entity = new BowntdbEntities();
            IQueryable <tb_Prodect> productList;

            if (id == 0)
            {
                productList = entity.tb_Prodect.Where(a => a.LanguageId == Language.Id);
            }
            else
            {
                productList = entity.tb_Prodect.Where(a => a.LanguageId == Language.Id && a.NormsId == id);
            }

            //分页
            int total = productList.Count();
            var data  = productList.OrderBy(m => m.Id)
                        .Skip((pageingModel.PageIndex - 1) * pageingModel.PageSize)
                        .Take(pageingModel.PageSize)
                        .ToList().Select(a => new ProductModel(a));

            //初始化分页对象
            pageingModel.Data      = data.ToList();
            pageingModel.Total     = total;
            pageingModel.TotalPage = (int)Math.Ceiling(total / (pageingModel.PageSize * 1.0));
            pageingModel.TotalPage = pageingModel.TotalPage == 0 ? 1 : pageingModel.TotalPage;
            return(Json(pageingModel, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult ProductDetial(int id)
        {
            BowntdbEntities entity  = new BowntdbEntities();
            var             product = entity.tb_Prodect.FirstOrDefault(a => a.Id == id);

            return(View(product));
        }
Beispiel #3
0
        public ActionResult PreViewPanel(int id)
        {
            BowntdbEntities entity  = new BowntdbEntities();
            var             picture = entity.tb_Picture.Find(id);
            string          url     = picture.Conver;

            return(View((object)url));
        }
Beispiel #4
0
        public ActionResult GetPdf(int id)
        {
            BowntdbEntities entity = new BowntdbEntities();
            var             pdf    = entity.tb_DownLoad.FirstOrDefault(a => a.Id == id);

            try
            {
                if (Request["isLoad"].Equals("true", StringComparison.CurrentCultureIgnoreCase))
                {
                    return(File(Server.MapPath(pdf.FilePath), "application/pdf"));
                }
                else
                {
                    return(File(Server.MapPath(pdf.FilePath), "application/pdf", pdf.Name + ".pdf"));
                }
            }
            catch (Exception ex)
            {
                return(Content("未找到文件"));
            }
        }
Beispiel #5
0
        public ActionResult PreView(int id, string type)
        {
            BowntdbEntities entity = new BowntdbEntities();
            string          url    = string.Empty;

            if (type == "tb_Picture")
            {
                var picture = entity.tb_Picture.Find(id);
                url = picture.Path;
            }
            else
            {
                var file = entity.tb_File.Find(id);
                url = file.Path;
            }

            if (Path.GetExtension(url).Equals(".pdf", StringComparison.CurrentCultureIgnoreCase))
            {
                return(File(Server.MapPath(url), "application/pdf"));
            }

            return(View((object)url));
        }
        public ActionResult Edit(string oldPassword, string newPassword, string rePassword)
        {
            if (!newPassword.Equals(rePassword))
            {
                ViewBag.Msg = "两次密码输入不一致";
                return(View());
            }

            BowntdbEntities dao  = new BowntdbEntities();
            var             user = dao.tb_SysUser.FirstOrDefault(a => a.Password == oldPassword);

            if (user == null)
            {
                ViewBag.Msg = "密码错误";
                return(View());
            }
            else
            {
                user.Password = newPassword;
                dao.SaveChanges();
                ViewBag.Msg = "密码修改成功";
            }
            return(View());
        }
 public FileManagerController()
 {
     entities = new BowntdbEntities();
 }
 public LanguageBll()
 {
     dao = new BowntdbEntities();
 }