Example #1
0
        public ActionResult Index(Request request, string serial)
        {
            request = db.SetRequest(User.Identity.Name, request, serial);

            TryUpdateModel(request);
            if (ModelState.IsValid)
            {
                db.paramQuery("add_request", db.paramInsertRequest(request));
                int requestID = db.noParamQuery("get_requestID");

                return RedirectToAction("RequestDetails", "UserRequest", new { id = requestID });
            }
            return View("Index");
        }
 public ActionResult GetDetails(int id)
 {
     try
     {
         var request = new Request<VehicleVM>();
         request.Data.VehID = id;
         var business = ProcessOneBussinesFactory.NewRead1VehicleOnIdBusiness();
         var response = business.Process(request);
         return Json(response.Data,JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return RedirectToAction("ProcessError", "Crm", ex.Message);
     }
 }
 // can use this to sort advertised inventory by make
 public ActionResult DisplayVehiclesForMake(int makeID)
 {
     try
     {
         var crmBusiness = IViewModelPrimeableFactory.NewCrmDisplayVehicleForMakeVMPrimer();
         var request = new Request<VehicleVM>();
         request.Data.MakeID = makeID;
         var responseVM = crmBusiness.PrimeViewModel(request);
         return View("DisplayVehiclesForMake", responseVM.Data);
     }
     catch (Exception ex)
     {
         return RedirectToAction("ProcessError", "Crm", ex.Message);
     }
 }
 public ActionResult Manage(LeadUpdateVM inVm)
 {
     try
     {
         var updateBusiness = ProcessOneBussinesFactory.NewLeadUpdateBusiness();
         var request = new Request<LeadUpdateVM>();
         request.Data = inVm;
         updateBusiness.Process(request);
         return RedirectToAction("Index");
     }
     catch (Exception ex)
     {
         return RedirectToAction("ProcessError", "Crm", ex.Message);
     }
 }
 public ActionResult Manage(int id, int vehID)
 {
     try
     {
         var leadBus = IViewModelPrimeableFactory.NewLeadUpdatePrimer();
         var request = new Request<LeadUpdateVM>();
         request.Data.VehID = vehID;
         request.Data.LeadID = id;
         var responseVM = leadBus.PrimeViewModel(request);
         return View(responseVM.Data);
     }
     catch (Exception ex)
     {
         return RedirectToAction("ProcessError", "Crm", ex.Message);
     }
 }
        public ActionResult Inquire(int id)
        {
            try
            {
                var request = new Request<InqueryVM>();
                request.Data.VehID = id;
                var areaBusiness = IViewModelPrimeableFactory.NewCrmInqueryVMPrimer();
                var response = areaBusiness.PrimeViewModel(request);

                return View(response.Data);

            }
            catch (Exception ex)
            {
                return RedirectToAction("ProcessError", "Crm", ex.Message);
            }
        }
 public ActionResult Inquire(InqueryVM inDto)
 {
     try
     {
         var request = new Request<InqueryVM>();
         request.Data = inDto;
         var inqueryBusiness = ProcessOneBussinesFactory.NewCreateInquerybusiness();
         var responseVM = inqueryBusiness.Process(request);
         return View("ThankYou", responseVM.Data);
     }
     catch (Exception ex)
     {
         return RedirectToAction("ProcessError","Crm",ex.Message);
     }
 }
 private void ServerHandle(Request r)
 {
     if (r.RequestType == RequestEnum.ListOfDrives)
       {
     SendMessageToClient(GetListOfDrives());
       }
       else if (r.RequestType == RequestEnum.OpenFolder)
       {
     string dir = r.Data.ToString();
     SendMessageToClient(GetFilesAndFolders(dir));
       }
       else if (r.RequestType == RequestEnum.CopyData)
       {
     var j = ((JObject)r.Data).ToObject<CopyDataRequest>();
     SendMessageToClient(CopyData(j.Data as List<string>, j.Destination, false));
       }
       else if (r.RequestType == RequestEnum.MoveData)
       {
     var j = ((JObject)r.Data).ToObject<CopyDataRequest>();
     SendMessageToClient(CopyData(j.Data as List<string>, j.Destination, true));
       }
 }
Example #9
0
 //
 // GET: /Account/
 public ActionResult Index(string serial)
 {
     ViewBag.CalendarEvents = dbSchedule.GetScheduleJS(serial);
     Request request = new Request() { SerialNumber = serial, End = DateTime.Now };
     return View(request);
 }
        public void CreateDependencies()
        {
            _assignedRequest = new Request()
            {
                RequestId = 1,
                CreatedDate = DateTime.Now.AddDays(-1).Date,
                EndDate = DateTime.Today.AddDays(10).Date,
                Description = "Assigned Request",
                CreatorId = 1,
                AssigneeId = 2,
                Completed = false,
                Location = "B"
            };
            _unassignedRequest = new Request()
            {
                RequestId = 2,
                CreatedDate = DateTime.Now.AddDays(-2).Date,
                EndDate = DateTime.Today.AddDays(20).Date,
                Description = "Unassigned Request",
                CreatorId = 1,
                Completed = false,
                Location = "A"
            };
            _completedRequest = new Request()
            {
                RequestId = 3,
                CreatedDate = DateTime.Now.AddDays(-3).Date,
                EndDate = DateTime.Today.AddDays(30).Date,
                Description = "Completed Request",
                CreatorId = 1,
                AssigneeId = 2,
                Completed = true,
                Location = "C"
            };

            var data = new List<Request>
            {
                _assignedRequest,
                _unassignedRequest,
                _completedRequest
            }.AsQueryable();

            _requestList = data;

            // prepare mock queryable set the implements DbAsyncQueryProvider
            _mockSet = new Mock<IQueryable<Request>>();
            _mockSet.As<IDbAsyncEnumerable<Request>>()
                .Setup(m => m.GetAsyncEnumerator())
                .Returns(new TestDbAsyncEnumerator<Request>(data.GetEnumerator()));

            _mockSet.As<IQueryable<Request>>()
                .Setup(m => m.Provider)
                .Returns(new TestDbAsyncQueryProvider<Request>(data.Provider));

            _mockSet.As<IQueryable<Request>>().Setup(m => m.Expression).Returns(data.Expression);
            _mockSet.As<IQueryable<Request>>().Setup(m => m.ElementType).Returns(data.ElementType);
            _mockSet.As<IQueryable<Request>>().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

            // Set up the data service
            _mockDataService = new Mock<IDataService>();
            _mockDataService.Setup(c => c.Requests).Returns(_mockSet.Object);

            // set up request service
            _requestService = new RequestService(_mockDataService.Object);
        }