public ActionResult Edit([Bind(Include = "ID,sheetNo,contractNo,developmentOrgnization,projectName,location,retentionPeriodNo,securityID,buildingArea,planningStartDate,planningEndDate,constructArea,totalCost,projectResponsible,telephoneNo,mobilephoneNo,contractTel,contractMobileNo,address,email,videoResponsible,weituoContactNo,costFee,partB,fillDate,introduction,isCharge,archiveBoxMaterailFee,scanningCopy,projectID,year")] VideoContractSheet videoContractSheet, string instructor) { if (ModelState.IsValid) { videoContractSheet.instructor = instructor; db.Entry(videoContractSheet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(videoContractSheet)); }
//// GET: VideoContractSheets/Delete/5 //public ActionResult Delete(int? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // VideoContractSheet videoContractSheet = db.VideoContractSheet.Find(id); // if (videoContractSheet == null) // { // return HttpNotFound(); // } // return View(videoContractSheet); //} //// POST: VideoContractSheets/Delete/5 //[HttpPost, ActionName("Delete")] //[ValidateAntiForgeryToken] //public ActionResult DeleteConfirmed(int id) //{ // VideoContractSheet videoContractSheet = db.VideoContractSheet.Find(id); // db.VideoContractSheet.Remove(videoContractSheet); // db.SaveChanges(); // return RedirectToAction("Index"); //} public ActionResult Delete(long id) { try { VideoContractSheet videoContractSheet = db.VideoContractSheet.Find(id); db.VideoContractSheet.Remove(videoContractSheet); db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception e) { return(Content("<script >alert('删除失败,请核查!');window.history.back();</script >")); } }
// GET: VideoContractSheets/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VideoContractSheet videoContractSheet = db.VideoContractSheet.Find(id); if (videoContractSheet == null) { return(HttpNotFound()); } return(View(videoContractSheet)); }
// GET: VideoArchives/Edit/5 public ActionResult Shenhe(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VideoArchives videoArchives = db.VideoArchives.Find(id); //工作联系单信息 VideoContractSheet videoContractSheet = db.VideoContractSheet.Find(videoArchives.SheetID); ViewBag.sheetNo = videoContractSheet.sheetNo; ViewBag.fillDate = videoContractSheet.fillDate; ViewBag.developmentOrgnization = videoContractSheet.developmentOrgnization; ViewBag.location = videoContractSheet.location; ViewBag.buildingArea = videoContractSheet.buildingArea; ViewBag.projectResponsible = videoContractSheet.projectResponsible; ViewBag.fzryij = "经审核,该工程声像竣工档案接收情况属实,声像科拟签发《建设工程声像竣工档案验收意见书》,请批示!"; if (videoArchives == null) { return(HttpNotFound()); } return(View(videoArchives)); }
public ActionResult Create([Bind(Include = "ID,sheetNo,contractNo,developmentOrgnization,projectName,location,retentionPeriodNo,securityID,buildingArea,planningStartDate,planningEndDate,constructArea,totalCost,projectResponsible,telephoneNo,mobilephoneNo,contractTel,contractMobileNo,address,email,videoResponsible,weituoContactNo,costFee,partB,fillDate,introduction,isCharge,archiveBoxMaterailFee,scanningCopy,year")] VideoContractSheet videoContractSheet, string instructor) { videoContractSheet.costFee = 0; videoContractSheet.partB = ""; videoContractSheet.isCharge = false; videoContractSheet.archiveBoxMaterailFee = 0; videoContractSheet.scanningCopy = false; videoContractSheet.instructor = instructor; //var checkisReceive = from a in db.VideoContractSheet // where a.sheetNo == videoContractSheet.sheetNo // select a; //if (checkisReceive.Count() > 0)//该联系单单号已经存在 //{ // return Content("<script >alert('该联系单单号已存在,请重新填写!!');window.history.back();</script >"); //} string yearno = videoContractSheet.year;//获取前台传过来的year var sheet = db.VideoContractSheet.Where(x => x.year == yearno); if (sheet.Count() > 0)//假如有该年份的联系单了,工程号自动累加+1 { videoContractSheet.projectID = sheet.Max(x => x.projectID) + 1; } else//假如没有该年份的联系单了,工程号初始化比如:2017001 { videoContractSheet.projectID = long.Parse(yearno.ToString() + "001"); } if (ModelState.IsValid) { db.VideoContractSheet.Add(videoContractSheet); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(videoContractSheet)); }
// GET: VideoContractSheets/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VideoContractSheet videoContractSheet = db.VideoContractSheet.Find(id); //档案密级 ViewBag.securityID = new SelectList(db_urban.SecurityClassification, "securityID", "securityName"); if (videoContractSheet.securityID != null) { ViewBag.securityID = new SelectList(db_urban.SecurityClassification, "securityID", "securityName", videoContractSheet.securityID); } //保管年限 ViewBag.retentionPeriodNo = new SelectList(db_urban.RetentionPeriod, "retentionPeriodNo", "retentionPeriodName"); if (videoContractSheet.retentionPeriodNo != null) { ViewBag.retentionPeriodNo = new SelectList(db_urban.RetentionPeriod, "retentionPeriodNo", "retentionPeriodName", videoContractSheet.retentionPeriodNo); } //声像科指导人 List <SelectListItem> zhidaoren = new List <SelectListItem> { new SelectListItem { Text = "", Value = "" }, new SelectListItem { Text = "李德林", Value = "李德林" }, new SelectListItem { Text = "孙良浩", Value = "孙良浩" }, new SelectListItem { Text = "刘吉滨", Value = "刘吉滨" }, new SelectListItem { Text = "郑俊泽", Value = "郑俊泽" }, new SelectListItem { Text = "于小桐", Value = "于小桐" }, new SelectListItem { Text = "马卫陆", Value = "马卫陆" }, new SelectListItem { Text = "吴威", Value = "吴威" } }; ViewBag.instructor1 = new SelectList(zhidaoren, "Value", "Text"); ViewBag.instructor = videoContractSheet.instructor; //声像科责任人 List <SelectListItem> zerenren = new List <SelectListItem> { new SelectListItem { Text = " ", Value = " " }, new SelectListItem { Text = "李德林", Value = "李德林" }, new SelectListItem { Text = "马卫陆", Value = "马卫陆" } }; ViewBag.videoResponsible = new SelectList(zerenren, "Value", "Text"); if (videoContractSheet.videoResponsible != null) { ViewBag.videoResponsible = new SelectList(zerenren, "Value", "Text", videoContractSheet.videoResponsible.Trim()); } ViewBag.tianbiaoDate = videoContractSheet.fillDate.Value.ToString("yyyy-MM-dd"); if (videoContractSheet.fillDate != null) { ViewBag.fillDate = videoContractSheet.fillDate.Value.ToString("yyyy-MM-dd"); } if (videoContractSheet.planningStartDate != null) { ViewBag.planningStartDate = videoContractSheet.planningStartDate.Value.ToString("yyyy-MM-dd"); } if (videoContractSheet.planningEndDate != null) { ViewBag.planningEndDate = videoContractSheet.planningEndDate.Value.ToString("yyyy-MM-dd"); } //工程地点分区 List <SelectListItem> list1 = new List <SelectListItem> { new SelectListItem { Text = "", Value = "" }, new SelectListItem { Text = "市南区", Value = "市南区" }, new SelectListItem { Text = "市北区", Value = "市北区" }, new SelectListItem { Text = "李沧区", Value = "李沧区" } }; ViewBag.constructArea1 = new SelectList(list1, "Value", "Text"); ViewBag.constructArea = videoContractSheet.constructArea; //if (videoContractSheet == null) //{ // return HttpNotFound(); //} return(View(videoContractSheet)); }
// GET: VideoContractSheets/Create public ActionResult Create(int?contractNo) { VideoContractSheet VideoSheet = new VideoContractSheet(); //工程地点分区 List <SelectListItem> list1 = new List <SelectListItem> { new SelectListItem { Text = "", Value = "" }, new SelectListItem { Text = "市南区", Value = "市南区" }, new SelectListItem { Text = "市北区", Value = "市北区" }, new SelectListItem { Text = "李沧区", Value = "李沧区" } }; ViewBag.constructArea1 = new SelectList(list1, "Value", "Text"); string plantStime = Convert.ToDateTime(DateTime.Today.Date).ToString("yyyy-MM-dd"); string plantEtime = Convert.ToDateTime(DateTime.Today.Date).ToString("yyyy-MM-dd"); ViewBag.planningStartDate = Convert.ToDateTime(plantStime); ViewBag.planningEndDate = Convert.ToDateTime(plantEtime); if (contractNo != null) { ViewBag.contractNo = contractNo; //判断该联系单是否已经被签订 var checkisReceive = from a in db.VideoContractSheet where a.contractNo == contractNo.ToString() select a; if (checkisReceive.Count() > 0)//该联系单已经签订 { int id = checkisReceive.FirstOrDefault().ID; return(Content("<script >alert('该联系单已经签订!');window.location.href='/VideoContractSheets/Edit?id=" + id + "';</script >")); } else//从移交责任书的界面签订工作联系单 { //将移交责任书的相应值传递到联系单中 var sheet = from a in db.VideoContractInfo where a.contractNo == contractNo.ToString() select a; VideoSheet.developmentOrgnization = sheet.First().transferUnit; VideoSheet.projectName = sheet.First().projectName; VideoSheet.location = sheet.First().location; if (sheet.First().buildingArea != null && sheet.First().buildingArea != "") { VideoSheet.buildingArea = decimal.Parse(sheet.First().buildingArea.Trim()); } VideoSheet.projectResponsible = sheet.First().partBLegalRepresent; VideoSheet.telephoneNo = sheet.First().partBcontactTel; ViewBag.constructArea1 = new SelectList(list1, "Value", "Text", sheet.First().constructArea.Trim()); ViewBag.constructArea = sheet.First().constructArea; ViewBag.planningStartDate = sheet.First().planningStartDate.Value.ToString("yyyy-MM-dd"); ViewBag.planningEndDate = sheet.First().planningEndDate.Value.ToString("yyyy-MM-dd"); } } //档案密级 ViewBag.securityID = new SelectList(db_urban.SecurityClassification, "securityID", "securityName"); //保管年限 ViewBag.retentionPeriodNo = new SelectList(db_urban.RetentionPeriod, "retentionPeriodNo", "retentionPeriodName"); //声像科指导人 List <SelectListItem> zhidaoren = new List <SelectListItem> { new SelectListItem { Text = "", Value = "" }, new SelectListItem { Text = "李德林", Value = "李德林" }, new SelectListItem { Text = "孙良浩", Value = "孙良浩" }, new SelectListItem { Text = "刘吉滨", Value = "刘吉滨" }, new SelectListItem { Text = "郑俊泽", Value = "郑俊泽" }, new SelectListItem { Text = "于小桐", Value = "于小桐" }, new SelectListItem { Text = "马卫陆", Value = "马卫陆" }, new SelectListItem { Text = "吴威", Value = "吴威" } }; ViewBag.instructor1 = new SelectList(zhidaoren, "Value", "Text"); //声像科责任人 List <SelectListItem> zerenren = new List <SelectListItem> { new SelectListItem { Text = "", Value = "" }, new SelectListItem { Text = "李德林", Value = "李德林" }, new SelectListItem { Text = "马卫陆", Value = "马卫陆" } }; ViewBag.videoResponsible = new SelectList(zerenren, "Value", "Text"); int max_id = db.VideoContractSheet.Max(d => d.ID); ViewBag.ID = max_id + 1; ViewBag.year = DateTime.Now.Year.ToString(); ViewBag.tianbiaoDate = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString(); return(View(VideoSheet)); }