// // GET: /Order/Edit/5 public ActionResult Edit(int id) { using (var t = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted })) { Orders order = db.Orders.Find(id); ScheduleOrder tempSchedule = new ScheduleOrder(); tempSchedule.GetOrderMaterial(order.MaterialInfo); string[] materialArray = tempSchedule.MaterialList.Values.ToArray(); ViewData["materials"] = materialArray; List <SelectListItem> materialInfos = new List <SelectListItem>(); materialInfos.Add(new SelectListItem { Text = "不新增物料", Value = "0" }); foreach (Materials item in db.Materials) { materialInfos.Add(new SelectListItem { Text = string.Format(App_Start.Constants.MACHINE_MATERIAL_STRUCTURE, item.Code, item.Unit, item.DetailInfo), Value = item.ID.ToString() }); } ViewData["materialInfos"] = materialInfos; return(View(order)); } }
// // GET: /Order/Details/5 public ActionResult Detail(int id, enumErrorCode error = enumErrorCode.NONE) { Orders order = null; using (var t = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted })) { order = db.Orders.Find(id); if (order == null) { return(HttpNotFound()); } int userId = Convert.ToInt32(Session["UserID"]); if (!roomControl.CheckUserInRoom(userId, order.RoomId)) { return(RedirectToAction("Login", "Account")); } } ScheduleOrder tempSchedule = new ScheduleOrder(); tempSchedule.GetOrderMaterial(order.MaterialInfo); string[] materialArray = tempSchedule.MaterialList.Values.ToArray(); ViewData["materials"] = materialArray; ViewData["error"] = Constants.GetErrorString(error); return(View(order)); }