public ActionResult DeleteForm(string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { List <string> lstid = StringHelper.GetStrArray(keyValue, ',', false); for (int i = 0; i < lstid.Count; i++) { WebPictureEntity pictureEntity = pictureApp.GetForm(lstid[i]); if (pictureEntity.F_FilePath.Length > 0) { //删除原图 string fullFileName = Server.MapPath(pictureEntity.F_FilePath); Thread t1 = new Thread(new ParameterizedThreadStart(DeleteFile)); t1.Start(fullFileName); //删除缩略图 string thumbnailPath = Server.MapPath(pictureEntity.F_ThumbnailPath); Thread t2 = new Thread(new ParameterizedThreadStart(DeleteFile)); t2.Start(thumbnailPath); } pictureApp.DeleteForm(lstid[i]); } return(Success("删除成功")); } return(Success("请选择删除项")); }
public void SubmitForm(WebPictureEntity entity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { entity.Modify(keyValue); service.Update(entity); } else { entity.Create(); service.Insert(entity); } }
public ActionResult DisabledConents(string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { List <string> lstid = StringHelper.GetStrArray(keyValue, ',', false); for (int i = 0; i < lstid.Count; i++) { WebPictureEntity pictureEntity = new WebPictureEntity(); pictureEntity.F_Id = lstid[i]; pictureEntity.F_EnabledMark = false; pictureApp.UpdateForm(pictureEntity); } return(Success("禁用成功")); } return(Success("请选择禁用项")); }
public ActionResult SubmitForm(WebPictureEntity pictureEntity, string keyValue) { if (!string.IsNullOrEmpty(pictureEntity.F_FilePath)) { var path = Server.MapPath(pictureEntity.F_FilePath); if (FileHelper.IsExistFile(path)) { pictureEntity.F_FileType = FileHelper.GetExtension(path); } } if (pictureEntity.F_Synchro == true) { //执行同步操作 } pictureApp.SubmitForm(pictureEntity, keyValue); return(Success("操作成功。")); }
public ActionResult UploadConents(string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { List <string> lstid = StringHelper.GetStrArray(keyValue, ',', false); for (int i = 0; i < lstid.Count; i++) { //进行同步操作 //更改同步标识 WebPictureEntity pictureEntity = new WebPictureEntity(); pictureEntity.F_Id = lstid[i]; pictureEntity.F_Synchro = true; pictureApp.UpdateForm(pictureEntity); } return(Success("同步成功")); } return(Success("请选择同步项")); }
public void UpdateForm(WebPictureEntity entity) { service.Update(entity); }
public void Delete(WebPictureEntity entity) { service.Delete(entity); }
/// <summary> /// 图片归档 /// </summary> /// <param name="dash">所在盘符</param> /// <param name="category">类别</param> /// <param name="dat">所选图片集json</param> /// <param name="cvalue">类别名称</param> /// <param name="synchro">是否同步</param> /// <returns></returns> public ActionResult FnFile(string dash, string category, string dat, string cvalue, string synchro) { List <ToJsonFile> paramdat = NFine.Code.Json.ToObject <List <ToJsonFile> >(dat); //接收参数 string originalPath = Path.Combine(dash, Configs.GetValue("ImgFolder")); //获取源文件坐在盘符 string cacheKey = dash; //缓存键值 ICache cache = CacheFactory.Cache(); //实例化缓存,默认自带缓存 //第一步:判断是否有类别文件夹,没有则创建 string categoryFolder = "/Temp/" + cvalue + "/"; string thumbnailFolder = "/Temp/" + cvalue + "_s/"; FileHelper.CreateDirectory(Server.MapPath(categoryFolder)); FileHelper.CreateDirectory(Server.MapPath(thumbnailFolder)); if (paramdat.Count > 0) { for (int i = 0; i < paramdat.Count; i++) { var filename = paramdat[i].filename; //文件名称 var filetype = paramdat[i].filetype; //文件扩展名 var filesize = paramdat[i].filesize; //文件大小 var filenick = paramdat[i].filenick; //文件昵称 //第二步:将文件剪切至类别文件夹 if (!FileHelper.IsExistFile(Server.MapPath(categoryFolder + filename))) { FileHelper.MoveFile("/Temp/" + filename, categoryFolder + filename); //移动文件,将文件从临时文件夹转移至归档文件 //第三步:生成缩略图 NFine.Code.Common.MakeThumbnail(Server.MapPath(categoryFolder + filename), Server.MapPath(thumbnailFolder + filename), 600, 350, "W", "jpg"); } if (string.IsNullOrEmpty(filenick)) { filenick = Path.GetFileNameWithoutExtension(Server.MapPath(categoryFolder + filename));//获取昵称 } //第四步:入数据库形成记录 WebPictureEntity model = new WebPictureEntity(); model.F_FullName = filename; //图片全称 model.F_Nick = filenick; //图片昵称 model.F_FilePath = categoryFolder + filename; //图片路径 model.F_ThumbnailPath = thumbnailFolder + filename; //图片缩略图 model.F_FileType = filetype; //文件类型 model.F_Category = category; //所属类别 model.F_FileSize = filesize; //文件大小 model.F_DeleteMark = false; //未删除 model.F_EnabledMark = true; //可用 if (synchro == "True") { model.F_Synchro = true; } string keyValue = string.Empty; picApp.SubmitForm(model, keyValue);//入库 //第五步:同步至外网,调用webservice服务 if (synchro == "True") { //同步到外网 } //第六步:删除原始文件(备:此源文件不是归档文件) FileHelper.DeleteFile(originalPath + "/" + filename); //删除源文件 cache.RemoveCache(cacheKey); //根据键值移除该类别数据集缓存 } } return(View()); }