private void setDBCompression(string ID, int userSN, string fileName, string upLoadType) { Rio_Compression CF = new Rio_Compression(); CF.Name = fileName; CF.Path = "/Upload/" + ID + "/" + upLoadType + "/"; CF.Extension = fileName.Split('.')[fileName.Split('.').Length - 1]; CF.CreateSN = userSN; CF.CreateID = ID; CF.CreateName = ID; CF.CreateDate = DateTime.Now; CF.IsEnable = true; CF.IsDelete = false; CompressionModel.Insert(CF); }
private void deleteCompression(string[] SNArray) { foreach (var data in SNArray) { int SN = 0; int.TryParse(data.ToString(), out SN); //刪除實體檔案 Rio_Compression CF = db.Rio_Compression.Find(SN); if (System.IO.File.Exists(Server.MapPath(CF.Path + "\\" + CF.Name))) { System.IO.File.Delete(Server.MapPath(CF.Path + "\\" + CF.Name)); } //資料庫更新刪除標記 CF.IsDelete = true; db.SaveChanges(); } }
private void changeEnableCompression(string[] SNArray) { foreach (var data in SNArray) { int SN = 0; int.TryParse(data.ToString(), out SN); Rio_Compression CF = db.Rio_Compression.Find(SN); if (CF.IsEnable == true) { CF.IsEnable = false; } else { CF.IsEnable = true; } CompressionModel.Update(CF); } }