Esempio n. 1
0
        public override ActionResult Index()
        {
            EmployeePortalSettings content;

            if (!String.IsNullOrEmpty(Request.QueryString["r"]))
            {
                int requestedID = int.Parse(Request.QueryString["r"]);
                content = _settingsRepo.FindBy(d => d.ID == requestedID).First();
                DisplayRollbackWarning();
                var live = _settingsRepo.GetLive(content.BaseID);
            }
            else
            {
                content = _settingsRepo.GetLive(1);
            }

            var viewModel = new EmployeePortalViewModel();

            viewModel.Item  = content;
            viewModel.Pages = _repo.GetAll().Where(x => x.ParentId == null && x.Status == VersionableItemStatus.Live).ToList();

            ViewBag.History = _settingsRepo.GetVersions(1).ToList();

            return(View(viewModel));
        }
Esempio n. 2
0
        public virtual ActionResult Index(EmployeePortalViewModel ob, FormCollection form)
        {
            ob.Pages = _repo.GetAll().Where(x => x.ParentId == null && x.Status == VersionableItemStatus.Live).ToList();


            try
            {
                var obj = ob.Item;

                _settingsRepo.Add(obj, 1);

                obj.Password = IMCMS.Common.Hashing.AESEncrypt.Encrypt(obj.Password);

                if (ModelState.IsValid)
                {
                    _settingsRepo.Edit(entity: obj, BaseID: 1);
                    _uow.Commit();
                    ModifiedItem();
                }
            }
            catch (Exception ex)
            {
                RaiseError(ex);
            }

            ViewBag.History = _settingsRepo.GetVersions(1).ToList();

            return(View(ob));
        }
Esempio n. 3
0
        public ActionResult EmployeePortal()
        {
            AppRole CustomerRole = RoleManager.FindByName("Customer");

            string[] CustomerIds = CustomerRole.Users.Select(x => x.UserId).ToArray();
            IEnumerable <AppUser> CustomerList = UserManager.Users.Where(x => CustomerIds.Any(y => y == x.Id));

            AppRole EmployeeRole = RoleManager.FindByName("Employee");

            string[] EmployeeIds = EmployeeRole.Users.Select(x => x.UserId).ToArray();
            IEnumerable <AppUser> EmployeeList = UserManager.Users.Where(x => EmployeeIds.Any(y => y == x.Id));

            AppRole ManagerRole = RoleManager.FindByName("Manager");

            string[] ManagerIds = ManagerRole.Users.Select(x => x.UserId).ToArray();
            IEnumerable <AppUser> ManagerList = UserManager.Users.Where(x => ManagerIds.Any(y => y == x.Id));

            var TransactionsQuery = from t in db.Transactions
                                    where t.isPending.Equals(true)
                                    select t;
            List <Transaction> PendingTransactionsList = TransactionsQuery.ToList();

            var DisputesQuery = from d in db.Disputes
                                where d.CurrentStatus.Equals("Submitted")
                                select d;
            List <Dispute> DisputesList = DisputesQuery.ToList();

            var StockPortfoliosQuery = from s in db.StockPortfolios
                                       where s.isPending.Equals(true)
                                       select s;
            List <StockPortfolio> PendingStockPortfoliosList = StockPortfoliosQuery.ToList();

            EmployeePortalViewModel model = new EmployeePortalViewModel {
                Customers = CustomerList, Employees = EmployeeList, Managers = ManagerList, PendingTransactions = PendingTransactionsList, Disputes = DisputesList, PendingStockPortfolios = PendingStockPortfoliosList
            };

            return(View(model));
        }