Пример #1
0
        public FundableList CreateFundableList(IList <MFunding_FundableSummary> mSummaries, PagingState pagingState)
        {
            var summaries = mSummaries.Select(r => CreateFundableListItem(r)).ToList();

            var sortFunction    = GetSortFunction(pagingState.Sort);
            var sortedSummaries = sortFunction != null
                ? pagingState.Descending
                    ? summaries.OrderByDescending(sortFunction).ToList()
                    : summaries.OrderBy(sortFunction).ToList()
                : summaries;

            var pageSize       = PagingState.PageSize;
            var pageNumber     = WebMath.GetPageNumber(pagingState.Page, sortedSummaries.Count, pageSize);
            var pagedSummaries = sortedSummaries.ToPagedList(pageNumber, pageSize);

            var(hasFundsRequired, recordCount) = ParsePagingStateFilter(pagingState.Filter);

            var model = new FundableList()
            {
                Items  = pagedSummaries,
                Filter = new FundableListFilter()
                {
                    HasFundsRequired = ToString(hasFundsRequired),
                    RecordCount      = recordCount,

                    HasFundsRequiredList = CreateNullableBooleanList(),
                    RecordCountList      = CreateRecordCountList()
                }
            };

            return(model);
        }
        public SquareCustomerList CreateSquareCustomerList(IList <MSquare_CustomerSummary> mSummaries, PagingState pagingState)
        {
            var summaries = mSummaries.Select(r => CreateSquareCustomerListItem(r)).ToList();

            var sortFunction    = GetSortFunction(pagingState.Sort);
            var sortedSummaries = sortFunction != null
                ? pagingState.Descending
                    ? summaries.OrderByDescending(sortFunction).ToList()
                    : summaries.OrderBy(sortFunction).ToList()
                : summaries;

            var pageSize       = PagingState.PageSize;
            var pageNumber     = WebMath.GetPageNumber(pagingState.Page, sortedSummaries.Count, pageSize);
            var pagedSummaries = sortedSummaries.ToPagedList(pageNumber, pageSize);

            var recordCount = ParsePagingStateFilter(pagingState.Filter);

            var model = new SquareCustomerList()
            {
                Items  = pagedSummaries,
                Filter = new SquareCustomerListFilter()
                {
                    RecordCount = recordCount,

                    RecordCountList = CreateRecordCountList()
                }
            };

            return(model);
        }
        public NotificationList CreateNotificationListModel(IList <ANotification_Notification> svcNotifications, PagingState pagingState)
        {
            var summaries = svcNotifications.Select(r => CreateNotificationListItem(r)).ToList();

            var sortFunction        = GetSortFunction(pagingState.Sort);
            var sortedNotifications = sortFunction != null
                ? pagingState.Descending
                    ? summaries.OrderByDescending(sortFunction).ToList()
                    : summaries.OrderBy(sortFunction).ToList()
                : summaries;

            int pageSize       = PagingState.PageSize;
            int pageNumber     = WebMath.GetPageNumber(pagingState.Page, sortedNotifications.Count, pageSize);
            var pagedSummaries = sortedNotifications.ToPagedList(pageNumber, pageSize);

            var(acknowledged, recordCount) = ParsePagingStateFilter(pagingState.Filter);

            var model = new NotificationList()
            {
                Items  = pagedSummaries,
                Filter = new NotificationListFilter()
                {
                    Acknowledged = ToString(acknowledged),
                    RecordCount  = recordCount,

                    AcknowledgedList = CreateNullableBooleanList(),
                    RecordCountList  = CreateRecordCountList()
                }
            };

            return(model);
        }
Пример #4
0
        public OrderList CreateOrderList(IList <AOrder_OrderSummary> aSummaries, PagingState pagingState)
        {
            var summaries = aSummaries.Select(r => CreateOrderListItem(r)).ToList();

            var sortFunction    = GetSortFunction(pagingState.Sort);
            var sortedSummaries = sortFunction != null
                ? pagingState.Descending
                    ? summaries.OrderByDescending(sortFunction).ToList()
                    : summaries.OrderBy(sortFunction).ToList()
                : summaries;

            var pageSize       = PagingState.PageSize;
            var pageNumber     = WebMath.GetPageNumber(pagingState.Page, sortedSummaries.Count, pageSize);
            var pagedSummaries = sortedSummaries.ToPagedList(pageNumber, pageSize);

            var(orderNumber, orderDate, orderStatus, userName, recordCount) = ParsePagingStateFilter(pagingState.Filter);

            var model = new OrderList()
            {
                Items  = pagedSummaries,
                Filter = new OrderListFilter()
                {
                    OrderNumber = orderNumber,
                    OrderDate   = orderDate,
                    UserName    = userName,
                    OrderStatus = orderStatus,
                    RecordCount = recordCount,

                    OrderStatusList = new List <SelectListItem>
                    {
                        new SelectListItem()
                        {
                            Text = "All", Value = MOrder_OrderStatus.MetaAll.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Pending", Value = MOrder_OrderStatus.Pending.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Submitted", Value = MOrder_OrderStatus.Submitted.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Fulfilling", Value = MOrder_OrderStatus.Fulfilling.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Closed", Value = MOrder_OrderStatus.Closed.ToString()
                        }
                    },
                    RecordCountList = CreateRecordCountList()
                }
            };

            return(model);
        }
Пример #5
0
        public DesignSummaryListModel CreateDesignSummaryListModel(UDesign_DesignSummaryList svcDesigns, PagingState pagingState)
        {
            var designSummaries = new List <DesignSummaryModel>();

            foreach (var svcDesignSummary in svcDesigns.Summaries)
            {
                var designSummary = new DesignSummaryModel()
                {
                    DesignId   = svcDesignSummary.DesignId,
                    DesignName = svcDesignSummary.DesignName
                };

                if (string.IsNullOrEmpty(designSummary.DesignName))
                {
                    designSummary.DesignName = "-";
                }

                designSummaries.Add(designSummary);
            }

            IList <DesignSummaryModel> sortedDesignSummaries;
            var sortFunction = GetSortFunction(pagingState.Sort);

            sortedDesignSummaries = sortFunction != null
                ? pagingState.Descending
                    ? designSummaries.OrderByDescending(sortFunction).ToList()
                    : designSummaries.OrderBy(sortFunction).ToList()
                : designSummaries;

            int pageSize             = 11;
            int pageNumber           = WebMath.GetPageNumber(pagingState.Page, sortedDesignSummaries.Count, pageSize);
            var pagedDesignSummaries = sortedDesignSummaries.ToPagedList(pageNumber, pageSize);

            var model = new DesignSummaryListModel()
            {
                DesignSummaries   = pagedDesignSummaries,
                HasDeletedDesigns = svcDesigns.HasDeletedDesigns,
                Filter            = pagingState.Filter,
                Filters           = new List <SelectListItem>
                {
                    new SelectListItem()
                    {
                        Text = "All", Value = "All"
                    }
                },
                CreateDesign = new DesignCreateModel(),
                RenameDesign = new DesignRenameModel()
            };

            return(model);
        }
Пример #6
0
        public FulfillableList CreateFulfillableList(IList <MFulfillment_FulfillableSummary> mSummaries, PagingState pagingState)
        {
            var summaries = mSummaries.Select(r => CreateFulfillableListItem(r)).ToList();

            var sortFunction    = GetSortFunction(pagingState.Sort);
            var sortedSummaries = sortFunction != null
                ? pagingState.Descending
                    ? summaries.OrderByDescending(sortFunction).ToList()
                    : summaries.OrderBy(sortFunction).ToList()
                : summaries;

            var pageSize       = PagingState.PageSize;
            var pageNumber     = WebMath.GetPageNumber(pagingState.Page, sortedSummaries.Count, pageSize);
            var pagedSummaries = sortedSummaries.ToPagedList(pageNumber, pageSize);

            var(fulfillableStatus, recordCount) = ParsePagingStateFilter(pagingState.Filter);

            var model = new FulfillableList()
            {
                Items  = pagedSummaries,
                Filter = new FulfillableListFilter()
                {
                    FulfillableStatus = fulfillableStatus,
                    RecordCount       = recordCount,

                    FulfillableStatusList = new List <SelectListItem>
                    {
                        new SelectListItem()
                        {
                            Text = "All", Value = MFulfillment_FulfillableStatus.MetaAll.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Active", Value = MFulfillment_FulfillableStatus.MetaActive.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Open", Value = MFulfillment_FulfillableStatus.Open.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Closed", Value = MFulfillment_FulfillableStatus.Closed.ToString()
                        }
                    },
                    RecordCountList = CreateRecordCountList()
                }
            };

            return(model);
        }
Пример #7
0
        public KitSummaryListModel CreateKitSummaryListModel(UProject_ProjectSummaryList svcKits, PagingState pagingState)
        {
            var kitSummaries = new List <KitSummaryModel>();

            foreach (var svcKitSummary in svcKits.ProjectSummaries)
            {
                var summary = new KitSummaryModel()
                {
                    KitId   = svcKitSummary.ProjectId,
                    KitName = svcKitSummary.ProjectName
                };

                kitSummaries.Add(summary);
            }

            IReadOnlyList <KitSummaryModel> sortedKitSummaries;
            var sortFunction = GetSortFunction(pagingState.Sort);

            sortedKitSummaries = sortFunction != null
                ? pagingState.Descending
                    ? kitSummaries.OrderByDescending(sortFunction).ToList()
                    : kitSummaries.OrderBy(sortFunction).ToList()
                : kitSummaries;

            int pageSize          = 11;
            int pageNumber        = WebMath.GetPageNumber(pagingState.Page, sortedKitSummaries.Count, pageSize);
            var pagedKitSummaries = sortedKitSummaries.ToPagedList(pageNumber, pageSize);

            var model = new KitSummaryListModel()
            {
                KitSummaries   = pagedKitSummaries,
                HasDeletedKits = svcKits.HasDeletedProjects,
                Filter         = pagingState.Filter,
                Filters        = new List <SelectListItem>
                {
                    new SelectListItem()
                    {
                        Text = "All", Value = "All"
                    }
                },
                RenameKit = new KitRenameModel()
            };

            return(model);
        }
Пример #8
0
        public BlockList CreateBlockList(IList <MDesign_Block> mBlocks, IList <string> allTags, PagingState pagingState)
        {
            var summaries = mBlocks.Select(r => CreateBlockListItem(r)).ToList();

            var sortFunction    = GetSortFunction(pagingState.Sort);
            var sortedSummaries = sortFunction != null
                ? pagingState.Descending
                    ? summaries.OrderByDescending(sortFunction).ToList()
                    : summaries.OrderBy(sortFunction).ToList()
                : summaries;

            var pageSize       = PagingState.PageSizeHuge;
            var pageNumber     = WebMath.GetPageNumber(pagingState.Page, sortedSummaries.Count, pageSize);
            var pagedSummaries = sortedSummaries.ToPagedList(pageNumber, pageSize);

            (var selectedTags, var recordCount) = ParsePagingStateFilter(pagingState.Filter);

            var tags = allTags
                       .OrderBy(r => r)
                       .Select(r => new BlockListFilterTagItem()
            {
                TagName = r, Selected = selectedTags.Contains(r)
            })
                       .ToList();

            var model = new BlockList()
            {
                Items  = pagedSummaries,
                Filter = new BlockListFilter()
                {
                    RecordCount = recordCount,

                    RecordCountList = CreateRecordCountList(),
                    Tags            = tags
                }
            };

            return(model);
        }
Пример #9
0
        public OrderDetailListModel CreateOrderDetalListModel(IReadOnlyList <UOrder_Order> svcOrders, PagingState pagingState)
        {
            var orders = new List <OrderDetailModel>();

            foreach (var svcOrder in svcOrders)
            {
                var order = CreateOrderDetailModel(svcOrder);
                order.Collapsable = true;
                orders.Add(order);
            }

            IList <OrderDetailModel> sortedOrders = orders.OrderByDescending(r => r.SubmissionDateTime).ToList();

            var pageSize    = 10;
            var pageNumber  = WebMath.GetPageNumber(pagingState.Page, sortedOrders.Count, pageSize);
            var pagedOrders = sortedOrders.ToPagedList(pageNumber, pageSize);

            var model = new OrderDetailListModel()
            {
                Orders = pagedOrders
            };

            return(model);
        }
Пример #10
0
        private IPagedList <NotificationDetailModel> CreateNotificationDetailModels(IEnumerable <MCommunication_Notification> from, PagingState pagingState)
        {
            var notifications = new List <NotificationDetailModel>();

            foreach (var fromItem in from)
            {
                notifications.Add(CreateNotificationDetailModel(fromItem));
            }

            IReadOnlyList <NotificationDetailModel> sortedNotifications;
            var sortFunction = GetNotificationSortFunction(pagingState.Sort);

            sortedNotifications = sortFunction != null
                ? pagingState.Descending
                    ? notifications.OrderByDescending(sortFunction).ToList()
                    : notifications.OrderBy(sortFunction).ToList()
                : notifications.OrderByDescending(r => r.SentDateTime).ToList();

            var pageSize           = 3;
            var pageNumber         = WebMath.GetPageNumber(pagingState.Page, sortedNotifications.Count, pageSize);
            var pagedNotifications = sortedNotifications.ToPagedList(pageNumber, pageSize);

            return(pagedNotifications);
        }
Пример #11
0
        public LogEntryListModel CreateLogEntryListModel(IReadOnlyList <ALog_LogEntry> svcLogEntries, PagingState pagingState, ILogAdminService logService)
        {
            var logEntries = svcLogEntries.Select(r => CreateLogEntryModel(r)).ToList();

            IReadOnlyList <LogEntryModel> sortedLogEntries;
            var sortFunction = GetSortFunction(pagingState.Sort);

            sortedLogEntries = sortFunction != null
                ? pagingState.Descending
                    ? logEntries.OrderByDescending(sortFunction).ToList()
                    : logEntries.OrderBy(sortFunction).ToList()
                : logEntries;

            var pageSize        = 10;
            var pageNumber      = WebMath.GetPageNumber(pagingState.Page, sortedLogEntries.Count, pageSize);
            var pagedLogEntries = sortedLogEntries.ToPagedList(pageNumber, pageSize);

            var model = new LogEntryListModel()
            {
                LogEntries = pagedLogEntries,
                Filter     = pagingState.Filter,
                Filters    = new List <SelectListItem>
                {
                    new SelectListItem()
                    {
                        Text = "All", Value = logService.ViewMode_All
                    },
                    new SelectListItem()
                    {
                        Text = "Exception", Value = logService.ViewMode_Exception
                    }
                }
            };

            return(model);
        }
        public InventoryItemListModel CreateInventoryItemListModel(IReadOnlyList <AInventory_InventoryItem> svcInventoryItems, PagingState pagingState)
        {
            var inventoryItems = new List <InventoryItemModel>();

            foreach (var svcInventoryItem in svcInventoryItems)
            {
                var inventoryItemStocks = new List <InventoryItemStockModel>();
                foreach (var svcInventoryItemStock in svcInventoryItem.InventoryItemStocks)
                {
                    inventoryItemStocks.Add(new InventoryItemStockModel()
                    {
                        Id               = svcInventoryItemStock.InventoryItemStockId.ToString(),
                        UnitOfMeasure    = svcInventoryItemStock.UnitOfMeasure,
                        UnitCost         = svcInventoryItemStock.UnitCost,
                        StockDateTime    = Locale.GetLocalTimeFromUtc(svcInventoryItemStock.StockDateTimeUtc),
                        OriginalQuantity = svcInventoryItemStock.OriginalQuantity,
                        CurrentQuantity  = svcInventoryItemStock.CurrentQuantity
                    });
                }

                inventoryItems.Add(new InventoryItemModel()
                {
                    Id               = svcInventoryItem.Id.ToString(),
                    TypeName         = svcInventoryItem.Type,
                    Sku              = svcInventoryItem.Sku,
                    Name             = svcInventoryItem.Name,
                    Manufacturer     = svcInventoryItem.Manufacturer,
                    Collection       = svcInventoryItem.Collection,
                    Quantity         = svcInventoryItem.Quantity,
                    ReservedQuantity = svcInventoryItem.ReservedQuantity,
                    WebColor         = svcInventoryItem.Color.WebColor,
                    Stocks           = inventoryItemStocks
                });
            }

            IList <InventoryItemModel> sortedInventoryItems;
            var sortFunction = GetSortFunction(pagingState.Sort);

            sortedInventoryItems = sortFunction != null
                ? pagingState.Descending
                    ? inventoryItems.OrderByDescending(sortFunction).ToList()
                    : inventoryItems.OrderBy(sortFunction).ToList()
                : inventoryItems;

            var pageSize            = 10;
            var pageNumber          = WebMath.GetPageNumber(pagingState.Page, sortedInventoryItems.Count, pageSize);
            var pagedInventoryItems = sortedInventoryItems.ToPagedList(pageNumber, pageSize);

            var model = new InventoryItemListModel()
            {
                InventoryItems = pagedInventoryItems,
                Filter         = pagingState.Filter ?? InventoryItemListModel.FILTER_ALL,
                Filters        = new List <SelectListItem>
                {
                    new SelectListItem()
                    {
                        Value = InventoryItemListModel.FILTER_ALL, Text = "All"
                    },
                    new SelectListItem()
                    {
                        Value = InventoryItemListModel.FILTER_LOW, Text = "Low"
                    },
                    new SelectListItem()
                    {
                        Value = InventoryItemListModel.FILTER_OUT, Text = "Out of Stock"
                    }
                }
            };

            return(model);
        }
Пример #13
0
        public MessageList CreateMessageList(IList <AMessage_Message> aMessages, PagingState pagingState)
        {
            var messages = aMessages.Select(r => CreateMessage(null, r.MMessage, false)).ToList();

            IReadOnlyList <Message> sortedMessages;
            var sortFunction = GetSortFunction(pagingState.Sort);

            sortedMessages = sortFunction != null
                ? pagingState.Descending
                    ? messages.OrderByDescending(sortFunction).ToList()
                    : messages.OrderBy(sortFunction).ToList()
                : messages;

            int pageSize      = PagingState.PageSize;
            int pageNumber    = WebMath.GetPageNumber(pagingState.Page, sortedMessages.Count, pageSize);
            var pagedMessages = sortedMessages.ToPagedList(pageNumber, pageSize);

            var(mailbox, status, recordCount) = ParsePagingStateFilter(pagingState.Filter);

            var model = new MessageList()
            {
                Messages = pagedMessages,
                Filter   = new MessageListFilter()
                {
                    Mailbox     = mailbox,
                    Status      = status,
                    RecordCount = recordCount,

                    MailboxList = new List <SelectListItem>
                    {
                        new SelectListItem()
                        {
                            Text = "Inbox", Value = MCommunication_MessageMailbox.FromUser.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Outbox", Value = MCommunication_MessageMailbox.ToUser.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "All", Value = MCommunication_MessageMailbox.MetaAll.ToString()
                        },
                    },
                    StatusList = new List <SelectListItem>
                    {
                        new SelectListItem()
                        {
                            Text = "Acknowledged", Value = MCommunication_MessageStatus.Acknowledged.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Unacknowledged", Value = MCommunication_MessageStatus.Unacknowledged.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "All", Value = MCommunication_MessageStatus.MetaAll.ToString()
                        },
                    },
                    RecordCountList = CreateRecordCountList()
                }
            };

            return(model);
        }
Пример #14
0
        public ReturnList CreateReturnListModel(IReadOnlyList <AReturn_ReturnSummary> aReturns, PagingState pagingState)
        {
            var summaries = aReturns.Select(r => CreateReturnDetailModel(r)).ToList();

            var sortFunction    = GetSortFunction(pagingState.Sort);
            var sortedSummaries = sortFunction != null
                ? pagingState.Descending
                    ? summaries.OrderByDescending(sortFunction).ToList()
                    : summaries.OrderBy(sortFunction).ToList()
                : summaries;

            var pageSize       = PagingState.PageSize;
            var pageNumber     = WebMath.GetPageNumber(pagingState.Page, sortedSummaries.Count, pageSize);
            var pagedSummaries = sortedSummaries.ToPagedList(pageNumber, pageSize);

            var(returnStatus, recordCount) = ParsePagingStateFilter(pagingState.Filter);

            var model = new ReturnList()
            {
                Items  = pagedSummaries,
                Filter = new ReturnListFilter()
                {
                    ReturnStatus = returnStatus,
                    RecordCount  = recordCount,

                    ReturnStatusList = new List <SelectListItem>
                    {
                        new SelectListItem()
                        {
                            Text = "All", Value = MFulfillment_ReturnStatus.MetaAll.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Active", Value = MFulfillment_ReturnStatus.MetaActive.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Open", Value = MFulfillment_ReturnStatus.Open.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Posted", Value = MFulfillment_ReturnStatus.Posted.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Complete", Value = MFulfillment_ReturnStatus.Complete.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Cancelled", Value = MFulfillment_ReturnStatus.Cancelled.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = "Exception", Value = MFulfillment_ReturnStatus.Exception.ToString()
                        }
                    },
                    RecordCountList = CreateRecordCountList()
                }
            };

            return(model);
        }
Пример #15
0
        public TransactionList CreateTransactionList(ATransaction_TransactionList mTransaction, PagingState pagingState)
        {
            var summaries = CreateTransactions(mTransaction);

            var sortFunction    = GetSortFunction(pagingState.Sort);
            var sortedSummaries = sortFunction != null
                ? pagingState.Descending
                    ? summaries.OrderByDescending(sortFunction).ToList()
                    : summaries.OrderBy(sortFunction).ToList()
                : summaries;

            var pageSize       = PagingState.PageSize;
            var pageNumber     = WebMath.GetPageNumber(pagingState.Page, sortedSummaries.Count, pageSize);
            var pagedSummaries = sortedSummaries.ToPagedList(pageNumber, pageSize);

            var(unitOfWork, source) = ParsePagingStateFilter(pagingState.Filter);

            var model = new TransactionList()
            {
                Items  = pagedSummaries,
                Filter = new TransactionListFilter()
                {
                    UnitOfWork = unitOfWork,
                    Source     = source,
                    SourceList = new List <SelectListItem>
                    {
                        new SelectListItem()
                        {
                            Text = "(Any)", Value = AnySource
                        },
                        new SelectListItem()
                        {
                            Text = "Fulfillable", Value = MSources.Fulfillable
                        },
                        new SelectListItem()
                        {
                            Text = "Fundable", Value = MSources.Fundable
                        },
                        new SelectListItem()
                        {
                            Text = "Funder", Value = MSources.Funder
                        },
                        new SelectListItem()
                        {
                            Text = "Order", Value = MSources.Order
                        },
                        new SelectListItem()
                        {
                            Text = "Shipment", Value = MSources.Shipment
                        },
                        new SelectListItem()
                        {
                            Text = "Shipment Request", Value = MSources.ShipmentRequest
                        },
                        new SelectListItem()
                        {
                            Text = "Square Payment", Value = MSources.SquarePayment
                        },
                        new SelectListItem()
                        {
                            Text = "Square Refund", Value = MSources.SquareRefund
                        },
                        new SelectListItem()
                        {
                            Text = "Return", Value = MSources.Return
                        },
                        new SelectListItem()
                        {
                            Text = "Return Request", Value = MSources.ReturnRequest
                        }
                    }
                }
            };

            return(model);
        }
Пример #16
0
        public UserList CreateUserList(IList <MUser_UserSummary> aUserSummaries, PagingState pagingState)
        {
            var userSummaries = aUserSummaries.Select(r => CreateUserListItem(r)).ToList();

            var sortFunction        = GetSortFunction(pagingState.Sort);
            var sortedUserSummaries = sortFunction != null
                ? pagingState.Descending
                    ? userSummaries.OrderByDescending(sortFunction).ToList()
                    : userSummaries.OrderBy(sortFunction).ToList()
                : userSummaries;

            var pageSize           = 10;
            var pageNumber         = WebMath.GetPageNumber(pagingState.Page, sortedUserSummaries.Count, pageSize);
            var pagedUserSummaries = sortedUserSummaries.ToPagedList(pageNumber, pageSize);

            (var role, var userName) = ParseFilter(pagingState.Filter);

            var model = new UserList()
            {
                UserSummaries = pagedUserSummaries,
                Role          = role,
                Roles         = new List <SelectListItem>
                {
                    new SelectListItem()
                    {
                        Text = "Any", Value = AnyRole
                    },
                    new SelectListItem()
                    {
                        Text = "Administrator", Value = ApplicationRoles.Administrator
                    },
                    new SelectListItem()
                    {
                        Text = "Service", Value = ApplicationRoles.Service
                    },
                    new SelectListItem()
                    {
                        Text = "User", Value = ApplicationRoles.User
                    },
                    new SelectListItem()
                    {
                        Text = "Financial Viewer", Value = ApplicationRoles.FinancialViewer
                    },
                    new SelectListItem()
                    {
                        Text = "Financial Editor", Value = ApplicationRoles.FinancialEditor
                    },
                    new SelectListItem()
                    {
                        Text = "Fulfillment Viewer", Value = ApplicationRoles.FulfillmentViewer
                    },
                    new SelectListItem()
                    {
                        Text = "Fulfillment Editor", Value = ApplicationRoles.FulfillmentEditor
                    },
                    new SelectListItem()
                    {
                        Text = "User Viewer", Value = ApplicationRoles.UserViewer
                    },
                    new SelectListItem()
                    {
                        Text = "User Editor", Value = ApplicationRoles.UserEditor
                    }
                },
                UserName = userName
            };

            return(model);
        }
Пример #17
0
        public LedgerTransactionList CreateLedgerTransactionList(IList <MLedger_LedgerTransaction> mLedgerTransactions, PagingState pagingState)
        {
            var transactions = mLedgerTransactions.Select(r => CreateLedgerTransaction(r)).ToList();

            var sortedTransactions = transactions;

            var pageSize          = PagingState.PageSize;
            var pageNumber        = WebMath.GetPageNumber(pagingState.Page, sortedTransactions.Count, pageSize);
            var pagedTransactions = sortedTransactions.ToPagedList(pageNumber, pageSize);

            var(postDate, ledgerAccountNumber, unitOfWork, recordCount) = ParsePagingStateFilter(pagingState.Filter);

            var model = new LedgerTransactionList()
            {
                Items  = pagedTransactions,
                Filter = new LedgerTransactionListFilter()
                {
                    PostDate            = postDate,
                    LedgerAccountNumber = ledgerAccountNumber ?? 0,
                    UnitOfWork          = unitOfWork,
                    RecordCount         = recordCount,

                    LedgerAccountNumberList = new List <SelectListItem>
                    {
                        new SelectListItem()
                        {
                            Text = $"(All)", Value = "0"
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.Cash} - Cash", Value = LedgerAccountNumbers.Cash.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.AccountReceivable} - Accounts Receivable", Value = LedgerAccountNumbers.AccountReceivable.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.SalesTaxReceivable} - Sales Tax Receivable", Value = LedgerAccountNumbers.SalesTaxReceivable.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.FabricSupplyAsset} - Fabric Supply", Value = LedgerAccountNumbers.FabricSupplyAsset.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.FabricSupplySuspense} - Fabric Supply Suspense", Value = LedgerAccountNumbers.FabricSupplySuspense.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.AccountPayable} - Accounts Payable", Value = LedgerAccountNumbers.AccountPayable.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.SalesTaxPayable} - Sales Tax Payable", Value = LedgerAccountNumbers.SalesTaxPayable.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.FundsSuspense} - Funds Suspense", Value = LedgerAccountNumbers.FundsSuspense.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.OwnersEquity} - Owners Equity", Value = LedgerAccountNumbers.OwnersEquity.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.Income} - Income", Value = LedgerAccountNumbers.Income.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.PaymentFeeExpense} - Payment Fee Expense", Value = LedgerAccountNumbers.PaymentFeeExpense.ToString()
                        },
                        new SelectListItem()
                        {
                            Text = $"{LedgerAccountNumbers.FabricSupplyExpense} - Fabric Supply Expense", Value = LedgerAccountNumbers.FabricSupplyExpense.ToString()
                        },
                    },
                    RecordCountList = CreateRecordCountList()
                }
            };

            return(model);
        }
Пример #18
0
        public EventLogList CreateEventLogList(AEvent_EventLogList mEventLog, PagingState pagingState)
        {
            var summaries = CreateEventLogs(mEventLog);

            var sortFunction    = GetSortFunction(pagingState.Sort);
            var sortedSummaries = sortFunction != null
                ? pagingState.Descending
                    ? summaries.OrderByDescending(sortFunction).ToList()
                    : summaries.OrderBy(sortFunction).ToList()
                : summaries;

            var pageSize       = PagingState.PageSize;
            var pageNumber     = WebMath.GetPageNumber(pagingState.Page, sortedSummaries.Count, pageSize);
            var pagedSummaries = sortedSummaries.ToPagedList(pageNumber, pageSize);

            ParseFilter(pagingState.Filter, out string unitOfWork, out string source);

            var model = new EventLogList()
            {
                Items      = pagedSummaries,
                UnitOfWork = unitOfWork,
                Source     = source,
                SourceList = new List <SelectListItem>
                {
                    new SelectListItem()
                    {
                        Text = "(Any)", Value = "*ANY"
                    },
                    new SelectListItem()
                    {
                        Text = "Fulfillable", Value = MSources.Fulfillable
                    },
                    new SelectListItem()
                    {
                        Text = "Fundable", Value = MSources.Fundable
                    },
                    new SelectListItem()
                    {
                        Text = "Funder", Value = MSources.Funder
                    },
                    new SelectListItem()
                    {
                        Text = "Order", Value = MSources.Order
                    },
                    new SelectListItem()
                    {
                        Text = "Shipment", Value = MSources.Shipment
                    },
                    new SelectListItem()
                    {
                        Text = "Shipment Request", Value = MSources.ShipmentRequest
                    },
                    new SelectListItem()
                    {
                        Text = "Square Payment", Value = MSources.SquarePayment
                    },
                    new SelectListItem()
                    {
                        Text = "Square Refund", Value = MSources.SquareRefund
                    },
                    new SelectListItem()
                    {
                        Text = "Return", Value = MSources.Return
                    },
                    new SelectListItem()
                    {
                        Text = "Return Request", Value = MSources.ReturnRequest
                    }
                }
            };

            return(model);
        }