Example #1
0
        public HttpResponseMessage GetList(GetListDTO dto)
        {
            var rolelist   = DotNetNuke.Security.Roles.RoleController.Instance.GetRoles(this.PortalSettings.PortalId).Cast <RoleInfo>().ToList();
            var stringList = rolelist.Select(r => r.RoleName).ToList();

            return(Request.CreateResponse(stringList));
        }
Example #2
0
        //-> Listing
        public async Task <GetListDTO <vSaleOrderDTO> > ListingHandler(int currentPage, IQueryable <dynamic> query)
        {
            int totalRecord = await query.CountAsync();

            var records = await query.Page(currentPage).ToListAsync();

            //var records = await query.Skip(0).Take(10).ToListAsync();
            //source.Skip((currentPage - 1) * PaginationHelper.PAGE_SIZE).Take(PaginationHelper.PAGE_SIZE);

            var myList = new List <vSaleOrderDTO>();

            foreach (var record in records)
            {
                vSaleOrderDTO tmp = await SelectByIDList(record.slor_SaleOrderID);

                //if(tmp.id !=null)
                myList.Add(tmp);
            }
            var getList = new GetListDTO <vSaleOrderDTO>();

            getList.metaData = PaginationHelper.GetMetaData(currentPage, totalRecord);
            getList.metaData.numberOfColumn = 15; // need to change number of column
            getList.items = myList;
            return(getList);
        }
Example #3
0
 public ListViewModel MapGetListDTOToListViewModel(GetListDTO model)
 {
     return(new ListViewModel
     {
         Id = model.Id,
         ListName = model.ListName,
         Description = model.Description,
         ParentId = model.ParentId
     });
 }
Example #4
0
 public ListDetailsViewModel MapGetListDTOToListDetailsViewModel(GetListDTO model)
 {
     return(new ListDetailsViewModel
     {
         Id = model.Id,
         ListName = model.ListName,
         Description = model.Description,
         ParentId = model.ParentId,
         ParentName = model.ParentName,
         ChildLists = string.Join(',', model.ChildLists.Select(l => l.Value))
     });
 }
Example #5
0
        public HttpResponseMessage GetList(GetListDTO dto)
        {
            var userlist = DotNetNuke.Entities.Users.UserController.GetUsers(this.PortalSettings.PortalId).Cast <UserInfo>().ToList();

            if (!string.IsNullOrEmpty(dto.inRole))
            {
                userlist = userlist.Where(u => u.IsInRole(dto.inRole)).ToList();
            }
            var usersVM = Mapper.Map <List <UserInfo>, List <UserViewModel> >(userlist);

            //var users = userlist.Cast<UserInfo>().ToList()
            //       .Select(user => new UserViewModel(user))
            //       .ToList();

            return(Request.CreateResponse(usersVM));
        }
Example #6
0
        //-> ListingHandler
        private async Task<GetListDTO<UserViewDTO>> ListingHandler(int currentPage, IQueryable<tblUser> query)
        {
            int totalRecord = await query.CountAsync();
            List<tblUser> records = await query.Page(currentPage).ToListAsync();

            var myList = new List<UserViewDTO>();
            foreach (var record in records)
            {
                myList.Add(await SelectByID(record.id));
            }
            var getList = new GetListDTO<UserViewDTO>();
            getList.metaData = PaginationHelper.GetMetaData(currentPage, totalRecord);
            getList.metaData.numberOfColumn = 6; // need to change number of column
            getList.items = myList;
            return getList;
        }
Example #7
0
        //-> Listing
        private async Task <GetListDTO <ItemGroupViewDTO> > Listing(int currentPage, IQueryable <tblItemGroup> itemGroups, string search = null)
        {
            int startRow     = Helper.Helper.GetStartRow(currentPage);
            var myList       = new List <ItemGroupViewDTO>();
            var myItemGroups = await itemGroups.Skip(startRow).Take(Helper.Helper.pageSize).ToListAsync();

            foreach (var itemGroup in myItemGroups)
            {
                myList.Add(await SelectByID(itemGroup.id));
            }
            var getList = new GetListDTO <ItemGroupViewDTO>();

            getList.metaData = await Helper.Helper.GetMetaData(currentPage, itemGroups, "name", "asc", search);

            getList.results = myList;
            return(getList);
        }
Example #8
0
        //-- private method --//
        private async Task <GetListDTO <CustomerViewDTO> > Listing(int currentPage, IQueryable <tblCustomer> customers, string search = null)
        {
            int startRow  = Helper.Helper.GetStartRow(currentPage);
            var myList    = new List <CustomerViewDTO>();
            var myRecords = await customers.Skip(startRow).Take(Helper.Helper.pageSize).ToListAsync();

            foreach (var record in myRecords)
            {
                myList.Add(await SelectByID(record.id));
            }
            var getList = new GetListDTO <CustomerViewDTO>();

            getList.metaData = await Helper.Helper.GetMetaData(currentPage, customers, "name", "asc", search);

            getList.results = myList;
            return(getList);
        }
Example #9
0
        //-- private function --//

        //-> ListingForMasterDetail
        private async Task <GetListDTO <ItemViewForMasterDTO> > ListingForMasterDetail(int currentPage, IQueryable <dynamic> items, string search = null)
        {
            int startRow = Helper.Helper.GetStartRow(currentPage);
            List <ItemViewForMasterDTO> itemViewForMasters = new List <ItemViewForMasterDTO>();
            var myItems = await items.Skip(startRow).Take(Helper.Helper.pageSize).ToListAsync();

            foreach (var item in myItems)
            {
                var itemViewForMaster = new ItemViewForMasterDTO();
                itemViewForMaster           = Helper.Helper.MapDBClassToDTO <tblItem, ItemViewForMasterDTO>(item.item);
                itemViewForMaster.documents = Helper.Helper.GetDocuments(item.document);
                itemViewForMasters.Add(itemViewForMaster);
            }
            var getList = new GetListDTO <ItemViewForMasterDTO>();

            getList.metaData = await Helper.Helper.GetMetaData(currentPage, items, "name", "asc", search);

            getList.results = itemViewForMasters;
            return(getList);
        }
        //*** private method ***/
        private async Task <GetListDTO <CheckLoanRequestViewDTO> > Listing(int currentPage, IQueryable <tblAccount> accounts, string search = null)
        {
            var checkLoanRequests = new List <CheckLoanRequestViewDTO>();

            foreach (var account in PaginationHelper.GetList(currentPage, accounts))
            {
                var checkLoanRequest = new CheckLoanRequestViewDTO();
                //var accountHandler = new AccountHandler();
                //checkLoanRequest.account =  await accountHandler.SelectByID(account.id);
                checkLoanRequest = await SelectByID(account.id);

                checkLoanRequests.Add(checkLoanRequest);
            }

            var getList = new GetListDTO <CheckLoanRequestViewDTO>();

            getList.metaData = await PaginationHelper.GetMetaData(currentPage, accounts, "id", "asc", search);

            getList.items = checkLoanRequests;
            return(getList);
        }
Example #11
0
        //-- ** private method --**/
        //-> Listing
        private async Task <GetListDTO <ItemGroupWithItemViewDTO> > Listing(int currentPage, IQueryable <dynamic> itemGroups, string search = null)
        {
            int startRow = Helper.Helper.GetStartRow(currentPage, true);
            List <ItemGroupWithItemViewDTO> itemGroupWithItemViews = new List <ItemGroupWithItemViewDTO>();
            var myItemGroups = itemGroups.Skip(startRow).Take(Helper.Helper.pageSize_MasterDetailList);

            foreach (var itemGroup in myItemGroups)
            {
                var itemGroupWithItem = new ItemGroupWithItemViewDTO();
                itemGroupWithItem       = Helper.Helper.MapDBClassToDTO <tblItemGroup, ItemGroupWithItemViewDTO>(itemGroup.itemGroup);
                itemGroupWithItem.items = await GetItemsForGroup(itemGroup.itemGroup.id);

                itemGroupWithItem.documents = Helper.Helper.GetDocuments(itemGroup.document);
                itemGroupWithItemViews.Add(itemGroupWithItem);
            }
            var getList = new GetListDTO <ItemGroupWithItemViewDTO>();

            getList.metaData = await Helper.Helper.GetMetaData(currentPage, itemGroups, "name", "asc", search, true);

            getList.results = itemGroupWithItemViews;
            return(getList);
        }