public ActionResult Create(Budgets_BasketsToAllocation budgets_permissionstoallocation)
 {
     using (BasketsToAllocationsRepository perToAllRep = new BasketsToAllocationsRepository())
     {
         perToAllRep.Create(budgets_permissionstoallocation);
         return(RedirectToAction("PermissionAllocationList", "PermissionsAllocations", new { permissionId = budgets_permissionstoallocation.BasketId, budgetId = budgets_permissionstoallocation.BudgetId }));
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Budgets_BasketsToAllocation budgets_permissionstoallocation = db.Budgets_BasketsToAllocation.Single(b => b.Id == id);

            db.Budgets_BasketsToAllocation.DeleteObject(budgets_permissionstoallocation);
            db.SaveChanges();
            return(RedirectToAction("PermissionAllocationList", new { permissionId = budgets_permissionstoallocation.BasketId, budgetId = budgets_permissionstoallocation.BudgetId }));
        }
        public ActionResult Details(int id = 0)
        {
            Budgets_BasketsToAllocation budgets_permissionstoallocation = db.Budgets_BasketsToAllocation.Single(b => b.Id == id);

            if (budgets_permissionstoallocation == null)
            {
                return(HttpNotFound());
            }
            return(View(budgets_permissionstoallocation));
        }
        public ActionResult Edit(int id = 0)
        {
            Budgets_BasketsToAllocation budgets_permissionstoallocation = db.Budgets_BasketsToAllocation.Single(b => b.Id == id);

            if (budgets_permissionstoallocation == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BudgetsAllocationId = new SelectList(db.Budgets_Allocations, "Id", "Id", budgets_permissionstoallocation.BudgetsAllocationId);
            ViewBag.BasketId            = new SelectList(db.Budgets_Baskets, "Id", "Name", budgets_permissionstoallocation.BasketId);
            return(View(budgets_permissionstoallocation));
        }
 public ActionResult Edit(Budgets_BasketsToAllocation budgets_permissionstoallocation)
 {
     if (ModelState.IsValid)
     {
         db.Budgets_BasketsToAllocation.Attach(budgets_permissionstoallocation);
         db.ObjectStateManager.ChangeObjectState(budgets_permissionstoallocation, EntityState.Modified);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BudgetsAllocationId = new SelectList(db.Budgets_Allocations, "Id", "Id", budgets_permissionstoallocation.BudgetsAllocationId);
     ViewBag.BasketId            = new SelectList(db.Budgets_Baskets, "Id", "Name", budgets_permissionstoallocation.BasketId);
     return(View(budgets_permissionstoallocation));
 }
        public ActionResult Create(int permissionId, int budgetId)
        {
            Budgets_BasketsToAllocation perAlloc = new Budgets_BasketsToAllocation();

            using (BudgetsRepository budgetsRepository = new BudgetsRepository(CurrentUser.CompanyId))
                using (BudgetsPermissionsRepository permissionsRepository = new BudgetsPermissionsRepository())
                    using (AllocationRepository allocationRepository = new AllocationRepository(CurrentUser.CompanyId))
                    {
                        ViewBag.AllocationList = new SelectList(allocationRepository.GetList().Where(x => x.BudgetId == budgetId).OrderBy(x => x.ExternalId).ToList(), "Id", "DisplayName");
                        //ViewBag.BudgetsAllocationId = new SelectList(db.Budgets_Allocations, "Id", "Id");
                        perAlloc.BudgetId = budgetId;
                        perAlloc.BasketId = permissionId;
                        Budget budget = budgetsRepository.GetEntity(budgetId);
                        ViewBag.budgetYear = budget.Year;
                        Budgets_Baskets permission = permissionsRepository.GetEntity(permissionId);
                        ViewBag.PermissionName = permission.Name;
                    }
            return(View(perAlloc));
        }
Exemplo n.º 7
0
        public ActionResult BudgetBaskets(int id = 0, int page = FIRST_PAGE, string sortby = DEFAULT_SORT, string order = DEFAULT_DESC_ORDER)
        {
            if (!Authorized(RoleType.SystemManager))
            {
                return(Error(Loc.Dic.error_no_permission));
            }

            IEnumerable <Budgets_Baskets> baskets;
            Budgets_BasketsToAllocation   per = new Budgets_BasketsToAllocation();

            using (BudgetsRepository budgetsRep = new BudgetsRepository(CurrentUser.CompanyId))
                using (BudgetsPermissionsRepository permissionsRep = new BudgetsPermissionsRepository())
                {
                    baskets = permissionsRep.GetList("Budgets_BasketsToAllocation").Where(x => x.CompanyId == CurrentUser.CompanyId);

                    baskets = Pagination(baskets, page, sortby, order, true);

                    ViewBag.budgetId = id;
                    Budget budget = budgetsRep.GetList().SingleOrDefault(x => x.Id == id);
                    ViewBag.budgetYear = budget.Year;
                    ViewBag.budgetId   = budget.Id;
                    return(View(baskets.ToList()));
                }
        }