Ejemplo n.º 1
0
        public ActionResult AllocationList()
        {
            UserProfile user = _userProfileService.GetUser(User.Identity.Name);

            Cats.Models.Hubs.Hub hub = user.DefaultHubObj;
            var list          = _dispatchAllocationService.GetUncommitedAllocationsByHub(hub.HubID);
            var listViewModel = (from item in list select BindDispatchAllocationViewModelDto(item));

            return(PartialView("AllocationList", listViewModel));
        }
Ejemplo n.º 2
0
 public virtual ActionResult Edit(Cats.Models.Hubs.Hub warehouse)
 {
     if (ModelState.IsValid)
     {
         _hubService.EditHub(warehouse);
         //return RedirectToAction("Index");
         return(Json(new { success = true }));
     }
     ViewBag.HubOwnerID = new SelectList(_hubOwnerService.GetAllHubOwner().OrderBy(o => o.Name), "HubOwnerID", "Name", warehouse.HubOwnerID);
     return(PartialView(warehouse));
 }
Ejemplo n.º 3
0
 public ActionResult CreateJson([DataSourceRequest] DataSourceRequest request, Cats.Models.Hubs.HubView viewModel)
 {
     if (viewModel != null && ModelState.IsValid)
     {
         Cats.Models.Hubs.Hub original = new Cats.Models.Hubs.Hub {
             Name       = viewModel.Name,
             HubOwnerID = viewModel.HubOwnerID
         };
         _hubService.AddHub(original);
     }
     return(Json(new[] { viewModel }.ToDataSourceResult(request, ModelState)));
 }
Ejemplo n.º 4
0
 public ActionResult CreateJson([DataSourceRequest] DataSourceRequest request, Cats.Models.Hubs.HubView viewModel)
 {
     if (viewModel != null && ModelState.IsValid)
     {
         Cats.Models.Hubs.Hub original = new Cats.Models.Hubs.Hub{
             Name = viewModel.Name,
             HubOwnerID = viewModel.HubOwnerID
             };
         _hubService.AddHub(original);
     }
     return Json(new[] { viewModel }.ToDataSourceResult(request, ModelState));
 }
Ejemplo n.º 5
0
        public virtual ActionResult UserHubs(FormCollection userHubs)
        {
            var hubModel = Session["Hubs"] as Cats.Models.Hubs.UserHubsModel;
            var userName = Session["UserName"].ToString();

            if (hubModel != null)
            {
                for (var i = 0; i < hubModel.UserHubs.Count(); i++)
                {
                    var model = new Cats.Models.Hubs.UserHubModel
                    {
                        HubID = hubModel.UserHubs[i].HubID, Name = hubModel.UserHubs[i].Name
                    };
                    model.Selected = userHubs.GetValue(string.Format("[{0}].Selected", model.HubID)).AttemptedValue.Contains("true");
                    if (model.Selected == hubModel.UserHubs[i].Selected)
                    {
                        continue;
                    }
                    var userID = (from v in _userProfileService.GetAllUserProfile()
                                  where v.UserName == userName
                                  select v.UserProfileID).FirstOrDefault();

                    var hub = new Cats.Models.Hubs.Hub();
                    if (model.Selected)
                    {
                        _userHubService.AddUserHub(model.HubID, userID);
                    }
                    else
                    {
                        _userHubService.RemoveUserHub(model.HubID, userID);
                    }
                }
            }

            return(Json(new { success = true }));
        }
Ejemplo n.º 6
0
        public virtual ActionResult UserHubs(FormCollection userHubs)
        {
            var hubModel = Session["Hubs"] as Cats.Models.Hubs.UserHubsModel;
            var userName = Session["UserName"].ToString();
            if (hubModel!=null)
            {
                for (var i = 0; i < hubModel.UserHubs.Count(); i++)
                {
                    var model = new Cats.Models.Hubs.UserHubModel
                        {HubID = hubModel.UserHubs[i].HubID, Name = hubModel.UserHubs[i].Name};
                    model.Selected = userHubs.GetValue(string.Format("[{0}].Selected", model.HubID)).AttemptedValue.Contains("true");
                    if (model.Selected == hubModel.UserHubs[i].Selected) continue;
                    var userID = (from v in _userProfileService.GetAllUserProfile()
                                  where v.UserName == userName
                                  select v.UserProfileID).FirstOrDefault();

                    var hub = new Cats.Models.Hubs.Hub();
                    if (model.Selected)
                    {
                        _userHubService.AddUserHub(model.HubID,userID);
                    }else
                    {
                        _userHubService.RemoveUserHub(model.HubID, userID);
                    }
                }
            }

            return Json(new { success = true });
        }