public ContentResult ToDels(int[] ids)
        {
            bool rtn = SYSOpenPic.ToDels(ids, Server.MapPath("~"));

            if (rtn)
            {
                return(Content("ok"));
            }
            else
            {
                return(Content("操作失败,网络异常"));
            }
        }
        public ContentResult ToDel(int id)
        {
            SYSOpenPic oldimgs = SYSOpenPic.GetEntityByID(id);

            if (SYSOpenPic.DeleteByID(id) > 0)
            {
                try
                {
                    string delFile = Server.MapPath("~") + oldimgs.ImgUrl;
                    System.IO.File.Delete(delFile);
                }
                catch (Exception ex) { }
                return(Content("ok"));
            }
            return(Content("删除出错"));
        }
        public ActionResult Process(string goodspk, string id, string name, string type, string lastModifiedDate, int size)
        {
            int goodsID = 0;

            int.TryParse(goodspk, out goodsID);
            string filePathName = string.Empty;
            string localPath    = Path.Combine(HttpRuntime.AppDomainAppPath, "Upload");

            if (Request.Files.Count == 0)
            {
                return(Json(new { jsonrpc = 2.0, error = new { code = 102, message = "保存失败" }, id = "id" }));
            }
            try
            {
                string path = Request.MapPath("~/");
                if (!Directory.Exists(Server.MapPath("~/images/SYSOpenPic/")))
                {
                    Directory.CreateDirectory(Server.MapPath("~/images/SYSOpenPic/"));
                }
                var    file     = Request.Files[0];
                string ext      = Path.GetExtension(file.FileName); //获得文件扩展名
                string savename = "G_" + goodspk + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ext;
                filePathName = "/images/SYSOpenPic/" + savename;    //自行处理保存

                //记录到数据库
                SYSOpenPic article = new SYSOpenPic();
                article.Dat    = DateTime.Now;
                article.ImgUrl = filePathName;
                article.Title  = goodsID.ToString();
                article.ID     = article.InsertAndReturnIdentity();


                file.SaveAs(path + filePathName);
            }
            catch (Exception)
            {
                return(Json(new { jsonrpc = 2.0, error = new { code = 103, message = "保存失败" }, id = "id" }));
            }
            return(Json(new
            {
                jsonrpc = "2.0",
                id = "id",
                filePath = filePathName//返回路径以备后用
            }));
        }
        public ContentResult imgsDel(string imgpk)
        {
            int imgID = 0;

            int.TryParse(imgpk, out imgID);
            string     result = "";
            SYSOpenPic imgs   = SYSOpenPic.GetEntityByID(imgID);

            if (SYSOpenPic.DeleteByID(imgID) > 0)
            {
                result = "OK";

                string delFile = Server.MapPath("~") + imgs.ImgUrl;
                System.IO.File.Delete(delFile);
            }
            else
            {
                result = "删除失败!";
            }
            return(Content(result));
        }