//回收站 public ActionResult Recycle(string path) { //HttpCookie cookie = StorageHelper.Cookie.GetCookie("UserInfo"); Utilities.ConvertJson c = new Utilities.ConvertJson(); JavaScriptSerializer jss = new JavaScriptSerializer(); List <string> list = jss.Deserialize <List <string> >(path); try { foreach (var item in list) { Jw_recycle jr = new Jw_recycle(); jr.Jw_recycleid = Guid.NewGuid().ToString("N"); jr.Jw_userid = StorageHelper.Cookie.GetCookieValue("User", "uguid");//通过cookie获取 jr.Jw_sourcePath = item; string p = AppDomain.CurrentDomain.BaseDirectory + item; if (System.IO.File.Exists(p)) { FileInfo fi = new FileInfo(p); jr.Jw_realName = fi.Name; jr.Jw_type = fi.Extension.Substring(1); jr.Jw_size = global::Commonn.FileOperate.GetFileSize(fi.Length); jr.Jw_virtualName = DateTime.Now.ToString("yyyyMMddhhmmssfffff") + fi.Extension; } if (Directory.Exists(p)) { DirectoryInfo di = new DirectoryInfo(p); jr.Jw_realName = di.Name; jr.Jw_type = "1"; jr.Jw_size = "--"; jr.Jw_virtualName = DateTime.Now.ToString("yyyyMMddhhmmssfffff"); } jr.Jw_delTime = DateTime.Now; jr.Jw_delflag = 0; Jw_share_file jsf = new Jw_share_file(); if (sharebll.AddMycycle(jr, new Jw_share_file { Jw_filepath = item, Jw_filestatus = 1 }) > 0) { FileOpe fo = new FileOpe(); string recycleFilePath = AppDomain.CurrentDomain.BaseDirectory + "/Recycle/" + StorageHelper.Cookie.GetCookieValue("User", "uguid"); if (!Directory.Exists(recycleFilePath)) { Directory.CreateDirectory(recycleFilePath); } fo.MoveFile(AppDomain.CurrentDomain.BaseDirectory + item, AppDomain.CurrentDomain.BaseDirectory + "/Recycle/" + StorageHelper.Cookie.GetCookieValue("User", "uguid") + "/" + jr.Jw_virtualName); } } return(Content(c.ToJson("200", "", "{}"))); } catch (Exception ex) { new DBHelper().Log(ex.ToString()); return(Content(c.ToJson("0", "", "{}"))); } }
public ActionResult AddShare(string usersid, string filepath) { string schoolid = StorageHelper.Cookie.GetCookieValue("User", "sguid");//通过cookie获取 JavaScriptSerializer jss = new JavaScriptSerializer(); List <string> uslist = jss.Deserialize <List <string> >(usersid); List <string> fplist = jss.Deserialize <List <string> >(filepath); string us = ""; foreach (var item in uslist) { us += item + ","; } Jw_share js = new Jw_share(); js.Jw_ShareId = Guid.NewGuid().ToString(); js.Jw_schoolid = schoolid; js.Jw_UserId = StorageHelper.Cookie.GetCookieValue("User", "uguid"); js.Jw_UsersId = us.Substring(0, us.Length - 1); js.Jw_CreateTime = DateTime.Now; js.Jw_DelFlag = 0; js.Jw_ShareType = 1; List <Jw_share_file> jsfList = new List <Jw_share_file>(); foreach (var item in fplist) { Jw_share_file jsf = new Jw_share_file(); jsf.Jw_shareid = js.Jw_ShareId; jsf.Jw_filepath = item; jsf.Jw_filestatus = 0; jsfList.Add(jsf); } Utilities.ConvertJson c = new Utilities.ConvertJson(); if (sharebll.AddShare(js, jsfList) > 0) { string a = c.ToJson("200", "", "{}"); return(Content(a)); } return(Content(c.ToJson("0", "", "{}"))); }
public int AddShareFile(Jw_share_file jsf) { string sql = _cb.InsertModel <Jw_share_file>(jsf); return(db.ExecuteNonQuery(sql)); }
public bool UpdateShareFilePath(Jw_share_file jsf, string str) { return(up.UpdateShareFilePath(jsf, str)); }
public bool UpdateShareFileStatus(Jw_share_file jsf) { return(up.UpdateShareFileStatus(jsf)); }
public int AddMycycle(Jw_recycle jr, Jw_share_file jsf) { UpdateShareFileStatus(jsf); return(ins.AddRecycle(jr)); }