Example #1
0
        private List <SelectListItem> GetAllAccountsList()
        {
            List <ProjectAccountDto> accounts = accountsService.GetAll();

            List <SelectListItem> accDDList = (from e in accounts
                                               orderby e.AccountName
                                               select new SelectListItem
            {
                Text = e.AccountName,
                Value = e.AccountID.ToString()
            }).ToList();

            return(accDDList);
        }
Example #2
0
        private IEnumerable <ProjectAccountModel> GetAllAccounts(int pageNo)
        {
            IEnumerable <ProjectAccountDto>   accounts   = accountsService.GetAll(RecordsPerPage, pageNo);
            IEnumerable <ProjectAccountModel> acctModels = Mapper.Map <IEnumerable <ProjectAccountDto>, IEnumerable <ProjectAccountModel> >(accounts);

            return(acctModels);
        }
Example #3
0
        private List <SelectListItem> GetAccountsList()
        {
            IEnumerable <ProjectAccountDto> accounts = accountService.GetAll();

            List <SelectListItem> accsList = (from a in accounts
                                              orderby a.AccountName
                                              select new SelectListItem
            {
                Text = a.AccountName,
                Value = a.AccountID.ToString()
            }).OrderBy(i => i.Text).ToList();

            return(accsList);
        }
Example #4
0
        private void LoadListItemsBasedOnEmployeeData(EmployeeDto employee)
        {
            IEnumerable <BuLevelDto> buLevelItems = buLevelService.GetAllByBU(employee.BusinessUnitID);
            List <SelectListItem>    level1Items  = new List <SelectListItem>();

            if (employee.BusinessUnitID == (int)BusinessUnitType.BusinessDelevopment)
            {
                ViewBag.Level1ListItems = (from a in buLevelItems
                                           orderby a.ItemName
                                           select new SelectListItem
                {
                    Text = a.ItemName,
                    Value = a.ItemEntryID.ToString(),
                }).ToList();

                int salesLevel = buLevelItems.Count() > 0 ? buLevelItems.FirstOrDefault(a => a.ItemName == "Sales").ItemEntryID : -1;
                List <ResourceLevelDto> resLevels = resLevelService.GetAllByLevel(salesLevel).ToList();
                ViewBag.Level2ListItems = (from a in resLevels
                                           orderby a.ItemName
                                           select new SelectListItem
                {
                    Text = a.ItemName,
                    Value = a.ItemEntryID.ToString(),
                }).ToList();

                ViewBag.Level3ListItems = (from a in resLevels
                                           orderby a.ItemName
                                           select new SelectListItem
                {
                    Text = a.ItemName,
                    Value = a.ItemEntryID.ToString(),
                }).ToList();

                ViewBag.Level4ListItems = (from a in resLevels
                                           orderby a.ItemName
                                           select new SelectListItem
                {
                    Text = a.ItemName,
                    Value = a.ItemEntryID.ToString(),
                }).ToList();

                ViewBag.Level5ListItems = (from a in resLevels
                                           orderby a.ItemName
                                           select new SelectListItem
                {
                    Text = a.ItemName,
                    Value = a.ItemEntryID.ToString(),
                }).ToList();
            }
            if (employee.BusinessUnitID == (int)BusinessUnitType.Operations ||
                employee.BusinessUnitID == (int)BusinessUnitType.RMG)
            {
                ViewBag.Level1ListItems = (from a in buLevelItems
                                           orderby a.ItemName
                                           select new SelectListItem
                {
                    Text = a.ItemName,
                    Value = a.ItemEntryID.ToString(),
                }).ToList();

                ViewBag.Level2ListItems = (from a in buLevelItems
                                           orderby a.ItemName
                                           select new SelectListItem
                {
                    Text = a.ItemName,
                    Value = a.ItemEntryID.ToString(),
                }).ToList();

                ViewBag.Level3ListItems = (from a in buLevelItems
                                           orderby a.ItemName
                                           select new SelectListItem
                {
                    Text = a.ItemName,
                    Value = a.ItemEntryID.ToString(),
                }).ToList();

                ViewBag.Level4ListItems = (from a in buLevelItems
                                           orderby a.ItemName
                                           select new SelectListItem
                {
                    Text = a.ItemName,
                    Value = a.ItemEntryID.ToString(),
                }).ToList();

                ViewBag.Level5ListItems = (from a in buLevelItems
                                           orderby a.ItemName
                                           select new SelectListItem
                {
                    Text = a.ItemName,
                    Value = a.ItemEntryID.ToString(),
                }).ToList();
            }
            else if (employee.BusinessUnitID == (int)BusinessUnitType.Delivery)
            {
                List <ProjectAccountDto> accounts = accService.GetAll();
                ViewBag.Level1ListItems = (from a in accounts
                                           orderby a.AccountName
                                           select new SelectListItem
                {
                    Text = a.AccountName,
                    Value = a.AccountID.ToString(),
                }).ToList();

                if (employee.Level1ID.HasValue)
                {
                    List <ProjectDto> projects = projectService.GetAllByAccount(employee.Level1ID.Value).ToList();
                    ViewBag.Level2ListItems = (from a in projects
                                               orderby a.ProjectName, a.ProjectCode
                                               select new SelectListItem
                    {
                        Text = a.ProjectName + " (" + a.ProjectCode + ")",
                        Value = a.ProjectID.ToString(),
                    }).ToList();
                }

                List <DropDownSubCategoryDto> subCategories = subCategoryService.GetSubCategories((int)CategoryType.BillabilityType).ToList();
                ViewBag.Level3ListItems = (from a in subCategories
                                           orderby a.SubCategoryName
                                           select new SelectListItem
                {
                    Text = a.SubCategoryName,
                    Value = a.SubCategoryID.ToString(),
                }).ToList();

                if (employee.Level3ID == (int)BillabilityType.Billable)
                {
                    ViewBag.Level4ListItems = (from a in subCategories
                                               orderby a.SubCategoryName
                                               select new SelectListItem
                    {
                        Text = a.SubCategoryName,
                        Value = a.SubCategoryID.ToString(),
                    }).ToList();

                    ViewBag.Level5ListItems = (from a in subCategories
                                               orderby a.SubCategoryName
                                               select new SelectListItem
                    {
                        Text = a.SubCategoryName,
                        Value = a.SubCategoryID.ToString(),
                    }).ToList();
                }
                else
                {
                    List <DropDownSubCategoryDto> level4SubCategories = subCategoryService.GetSubCategories((int)CategoryType.Level4_NonBillableItems).ToList();
                    ViewBag.Level4ListItems = (from a in level4SubCategories
                                               orderby a.SubCategoryName
                                               select new SelectListItem
                    {
                        Text = a.SubCategoryName,
                        Value = a.SubCategoryID.ToString(),
                    }).ToList();

                    List <DropDownSubCategoryDto> level5SubCategories = subCategoryService.GetSubCategories((int)CategoryType.Level5_NonBillableItems).ToList();
                    ViewBag.Level5ListItems = (from a in level5SubCategories
                                               orderby a.SubCategoryName
                                               select new SelectListItem
                    {
                        Text = a.SubCategoryName,
                        Value = a.SubCategoryID.ToString(),
                    }).ToList();
                }
            }
            else
            {
                // reserved
            }
        }