// GET: VideoCassetteLists/Delete/5 //public ActionResult Delete(int? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // VideoCassetteList videoCassetteList = db.VideoCassetteList.Find(id); // if (videoCassetteList == null) // { // return HttpNotFound(); // } // return View(videoCassetteList); //} //// POST: VideoCassetteLists/Delete/5 //[HttpPost, ActionName("Delete")] //[ValidateAntiForgeryToken] //public ActionResult DeleteConfirmed(int id) //{ // VideoCassetteList videoCassetteList = db.VideoCassetteList.Find(id); // db.VideoCassetteList.Remove(videoCassetteList); // db.SaveChanges(); // return RedirectToAction("Index"); //} public ActionResult Delete(long id) { VideoCassetteList videoCassetteList = db.VideoCassetteList.Find(id); string p1 = Server.MapPath("~/声像资料/" + videoCassetteList.ProjectIDS + "/声像照片/" + videoCassetteList.filingDesc); //文件存储路径 string p2 = Server.MapPath("~/声像资料/" + videoCassetteList.ProjectIDS + "/声像视频/" + videoCassetteList.filingDesc); //文件存储路径 try { if (!Directory.Exists(p1)) { Directory.CreateDirectory(p1); } DirectoryInfo dir1 = new DirectoryInfo(p1);//删除该目录 dir1.Delete(true); if (!Directory.Exists(p2)) { Directory.CreateDirectory(p2); } DirectoryInfo dir2 = new DirectoryInfo(p2);//删除该目录 dir2.Delete(true); db.VideoCassetteList.Remove(videoCassetteList); db.SaveChanges(); return(RedirectToAction("Index", new { videoProjectSeqNo = videoCassetteList.ProjectIDS })); } catch (Exception e) { return(Content("<script >alert('删除文件夹失败,请核查!');window.history.back();</script >")); } }
public ActionResult Edit([Bind(Include = "ID,ProjectIDS,videoMinutesCount,opticalDiskNo,diskMinutesCount,startShootingTime,endShootingTime,shootingPerson,shootingDate,filingTime,filingDesc,filingPeople,checker,checkTime,bianzhiUnit,bianzhiDateStart,bianzhiTime,bianzhiDateEnd,videoContent")] VideoCassetteList videoCassetteList) { if (ModelState.IsValid) { db.Entry(videoCassetteList).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(videoCassetteList)); }
// GET: VideoCassetteLists/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VideoCassetteList videoCassetteList = db.VideoCassetteList.Find(id); if (videoCassetteList == null) { return(HttpNotFound()); } return(View(videoCassetteList)); }
//// GET: VideoArchives/Delete/5 //public ActionResult Delete(int? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // VideoArchives videoArchives = db.VideoArchives.Find(id); // if (videoArchives == null) // { // return HttpNotFound(); // } // return View(videoArchives); //} //// POST: VideoArchives/Delete/5 //[HttpPost, ActionName("Delete")] //[ValidateAntiForgeryToken] //public ActionResult DeleteConfirmed(int id) //{ // VideoArchives videoArchives = db.VideoArchives.Find(id); // db.VideoArchives.Remove(videoArchives); // db.SaveChanges(); // return RedirectToAction("Index"); //} public ActionResult Delete(long id) { try { VideoArchives videoArchives = db.VideoArchives.Find(id); var status = videoArchives.videoStatus; var videoCassetteList = db.VideoCassetteList.Where(a => a.ProjectIDS.Trim() == videoArchives.videoProjectSeqNo.ToString().Trim()); foreach (var tem in videoCassetteList) { VideoCassetteList del = tem; db.VideoCassetteList.Remove(del); } db.VideoArchives.Remove(videoArchives); string strFileSavePath = Server.MapPath("~/声像资料/" + videoArchives.videoProjectSeqNo);//文件存储路径 if (Directory.Exists(strFileSavePath)) { DirectoryInfo dir = new DirectoryInfo(strFileSavePath);//删除该目录 dir.Delete(true); } db.SaveChanges(); if (status == "2") { return(RedirectToAction("Index_shenhe")); } if (status == "3") { return(RedirectToAction("Index_dairuku")); } if (status == "4") { return(RedirectToAction("Index_ruku")); } if (status == "5") { return(RedirectToAction("Index_bohui")); } if (status == "6") { return(RedirectToAction("Index_zanruku")); } return(RedirectToAction("Index")); } catch (Exception e) { return(Content("<script >alert('删除失败,请核查!');window.history.back();</script >")); } }
public ActionResult Index(int?videoProjectSeqNo, String action) { if (videoProjectSeqNo == null) { return(Content("<script >alert('该工程缺失工程序号!');window.history.back();</script >")); } var videoArchive = db.VideoArchives.Where(x => x.videoProjectSeqNo == videoProjectSeqNo).FirstOrDefault(); if (action == "返回") { return(RedirectToAction("Index_shenhe", "VideoArchives")); } else if (action == "上传完成") { videoArchive.videoStatus = "3"; db.Entry(videoArchive).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index_dairuku", "VideoArchives")); } else if (action == "驳回") { videoArchive.videoStatus = "5"; db.Entry(videoArchive).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index_bohui", "VideoArchives")); } else if (action == "暂入库") { videoArchive.videoStatus = "6"; db.Entry(videoArchive).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index_zanruku", "VideoArchives")); } ViewBag.projectName = videoArchive.projectName; ViewBag.videoProjectSeqNo = videoProjectSeqNo; string filingDesc = Request.Form["filingDesc"]; var filingDesc1 = db.VideoCassetteList.Where(x => x.ProjectIDS == videoProjectSeqNo.ToString()).Where(x => x.filingDesc == filingDesc); if (filingDesc1.Count() > 0) { return(Content("<script >alert('该类别文件记录已存在!');window.history.back();</script >")); } if (Request.Form["videoMinutesCount"] != null) //如果没用该类别文件记录则新建一记录 { VideoCassetteList videocassetteList = new VideoCassetteList(); int max_id = db.VideoCassetteList.Max(x => x.ID); videocassetteList.ID = max_id + 1; videocassetteList.filingDesc = Request.Form["filingDesc"]; //当前视频记录类型:工程前期、基础工程... videocassetteList.ProjectIDS = videoProjectSeqNo.ToString(); //所属工程ID videocassetteList.shootingDate = DateTime.Parse(Request.Form["shootingDate"]); //拍摄日期 videocassetteList.videoMinutesCount = Request.Form["videoMinutesCount"]; //视频总长度 videocassetteList.videoContent = Request.Form["videoContent"]; //视频详细内容 videocassetteList.checker = "待上传"; // db.VideoCassetteList.Add(videocassetteList); db.SaveChanges(); } var videoCassetteList = db.VideoCassetteList.Where(x => x.ProjectIDS == videoProjectSeqNo.ToString()); return(View(videoCassetteList.ToList())); }