示例#1
0
        //
        // 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));
        }
示例#2
0
        public ActionResult Details(int id = 0, enumErrorCode error = enumErrorCode.NONE)
        {
            using (var t = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {
                IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
            }))
            {
                Schedules schedules = db.Schedules.Find(id);

                if (schedules == null)
                {
                    return(HttpNotFound());
                }
                int userId = Convert.ToInt32(Session["UserID"]);
                if (!roomControl.CheckUserInRoom(userId, schedules.RoomId))
                {
                    return(RedirectToAction("Login", "Account"));
                }
                ViewData["error"] = Constants.GetErrorString(error);
                return(View(schedules));
            }
        }