// GET: VideoContractInfoes/Delete/5 //public ActionResult Delete(string id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // VideoContractInfo videoContractInfo = db.VideoContractInfo.Find(id); // if (videoContractInfo == null) // { // return HttpNotFound(); // } // return View(videoContractInfo); //} // POST: VideoContractInfoes/Delete/5 public ActionResult DeleteConfirmed(string id) { VideoContractInfo videoContractInfo = db.VideoContractInfo.Find(id); db.VideoContractInfo.Remove(videoContractInfo); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: VideoContractInfoes/Details/5 public ActionResult Details(string id, string action) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VideoContractInfo videoContractInfo = db.VideoContractInfo.Find(id); if (videoContractInfo == null) { return(HttpNotFound()); } if (action == "返回") { return(RedirectToAction("Index", "VideoContractInfoes")); } return(View(videoContractInfo)); }
// GET: VideoContractInfoes/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VideoContractInfo videoContractInfo = db.VideoContractInfo.Find(id); //DateTime plantStime = DateTime.ParseExact(videoContractInfo.planningStartDate.ToString(), "yyyy-MM-dd", null); //DateTime plantEtime = DateTime.ParseExact(videoContractInfo.planningEndDate.ToString(), "yyyy-MM-dd", null); //DateTime dataSign = DateTime.ParseExact(videoContractInfo.dateSigned.ToString(), "yyyy-MM-dd", null); if (videoContractInfo.dateSigned != null) { ViewBag.dateSigned = videoContractInfo.dateSigned.Value.ToString("yyyy-MM-dd"); } if (videoContractInfo.planningStartDate != null) { ViewBag.planningStartDate = videoContractInfo.planningStartDate.Value.ToString("yyyy-MM-dd"); } if (videoContractInfo.planningEndDate != null) { ViewBag.planningEndDate = videoContractInfo.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", videoContractInfo.constructArea); ViewBag.constructArea = videoContractInfo.constructArea; return(View(videoContractInfo)); }
// GET: VideoContractInfoes/Create public ActionResult Create() { VideoContractInfo contractInfo = new VideoContractInfo(); long max_contractInNo = Int64.Parse(db.VideoContractInfo.Max(d => d.contractNo)); //设置一个默认值,用户也可修改,保证8位且不重复就行 contractInfo.contractNo = (max_contractInNo + 1).ToString(); //contractNo为责任书信息表的主键自动+1 //设置一些默认值 contractInfo.partAaddress = "青岛市市南区黄县路1号"; contractInfo.partALegalRepresent = "业 务 科 82879324"; contractInfo.partAcontactTel = "声 像 科 82882207"; contractInfo.partAweituoAgent = "管理信息科 82860632"; string plantStime = Convert.ToDateTime(DateTime.Today.Date).ToString("yyyy-MM-dd"); string plantEtime = Convert.ToDateTime(DateTime.Today.Date).ToString("yyyy-MM-dd"); string dataSign = Convert.ToDateTime(DateTime.Today.Date).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"); contractInfo.planningEndDate = DateTime.ParseExact(plantEtime.Trim(), "yyyy-MM-dd", null); contractInfo.planningStartDate = Convert.ToDateTime(plantStime); contractInfo.dateSigned = Convert.ToDateTime(dataSign); return(View(contractInfo)); }
public ActionResult Create([Bind(Include = "contractNo,dateSigned,transferUnit,projectName,location,layerCount,buildingArea,planningStartDate,planningEndDate,partAaddress,partALegalRepresent, partAweituoAgent,partAcontactTel,partBadress,partBLegalRepresent,partBweituoAgent,partBcontactTel")] VideoContractInfo contractInfo, string contractNo, string constructArea) { var contract = from a in db.VideoContractInfo where a.contractNo == contractNo select a; if (contract.Count() != 0) { return(Content("<script >alert('该责任书编号已存在,请重新输入!');window.location.href='Create';</script >")); } if (contractInfo.projectName == "" || contractInfo.projectName == null) { return(Content("<script >alert('工程名称不能为空,请核查!');window.history.back();</script >")); } if (contractInfo.planningStartDate == null) { return(Content("<script >alert('计划开工时间不能为空,请核查!');window.history.back();</script >")); } if (contractInfo.planningEndDate == null) { return(Content("<script >alert('计划竣工时间不能为空,请核查!');window.history.back();</script >")); } if (contractInfo.dateSigned == null) { return(Content("<script >alert('签订日期不能为空,请核查!');window.history.back();</script >")); } if (ModelState.IsValid) { contractInfo.constructArea = constructArea; db.VideoContractInfo.Add(contractInfo); db.SaveChanges(); return(Content("<script >alert('保存成功!');window.location.href='Index';</script >")); } return(View(contractInfo)); }
public ActionResult Edit([Bind(Include = "contractNo,dateSigned,transferUnit,projectName,location,layerCount,buildingArea,planningStartDate,planningEndDate,partAaddress,partALegalRepresent, partAweituoAgent,partAcontactTel,partBadress,partBLegalRepresent,partBweituoAgent,partBcontactTel")] VideoContractInfo contractInfo, string dateSigned, string planningStartDate, string planningEndDate, string constructArea) { if (ModelState.IsValid) { if (dateSigned != null && dateSigned != "") { contractInfo.dateSigned = DateTime.Parse(dateSigned); } if (planningStartDate != null && planningStartDate != "") { contractInfo.planningStartDate = DateTime.Parse(planningStartDate); } if (planningEndDate != null && planningEndDate != "") { contractInfo.planningEndDate = DateTime.Parse(planningEndDate); } if (contractInfo.planningStartDate == null) { return(Content("<script >alert('计划开工时间不能为空,请核查!');window.history.back();</script >")); } if (contractInfo.planningEndDate == null) { return(Content("<script >alert('计划竣工时间不能为空,请核查!');window.history.back();</script >")); } if (contractInfo.dateSigned == null) { return(Content("<script >alert('签订日期不能为空,请核查!');window.history.back();</script >")); } contractInfo.constructArea = constructArea; db.Entry(contractInfo).State = EntityState.Modified; db.SaveChanges(); return(Content("<script >alert('修改成功!');window.location.href='/VideoContractInfoes/Index';</script >")); //return Content("<script >alert('修改成功!');window.history.back();</script >"); } return(View(contractInfo)); }