Пример #1
0
        public OrderModel(Guid id) : this()
        {
            var order = _orderManagementService.GetById(id);

            CustomerName = order.CustomerName;
        }
Пример #2
0
        public object GetInvoiceJsonData(DataTablesAjaxRequestModel model, Guid id)
        {
            // All Post Data
            string[] columnOrder     = { null, "Amount" };
            int      index           = model.GetPageIndex();
            int      length          = model.GetPageSize();
            string   searchValue     = model.GetSearchText();
            string   sortColumnName  = model.GetSortColumnName(columnOrder);
            string   sortDirection   = model.GetSortDirection();
            int      recordsTotal    = 0;
            int      recordsFiltered = 0;

            List <Invoice> records = _invoiceManagementService.GetInvoicePagedOrder(index, length, searchValue,
                                                                                    sortColumnName, sortDirection, out recordsTotal, out recordsFiltered);
            //List<Order> orderRecords = _orderManagementService.GetPagedOrder(index, length, searchValue,
            //    sortColumnName, sortDirection, out recordsTotal, out recordsFiltered);
            //foreach(var order in orderRecords)
            //{
            //    if (order.Id == id)
            //    {
            //        Order newOrder = order;
            //    }

            //}
            List <Invoice> newRecords = new List <Invoice>();
            Order          order      = _orderManagementService.GetById(id);

            foreach (var invoice in order.Invoices)
            {
                newRecords.Add(invoice);
            }

            //List<Invoice> newRecords = new List<Invoice>();
            ////Item item = records.Find(x => x.OrderId == id);
            ////newReocrds.Add(item);
            //foreach (var invoice in records)
            //{
            //    foreach (var order in invoice.Orders)
            //    {
            //        if (order.Id == id)
            //        {
            //            newRecords.Add(invoice);

            //        }

            //    }
            //}

            int serial  = model.GetSerialNumber();
            var dataSet = (
                from record in newRecords
                select new string[]
            {
                serial++.ToString(),
                record.Amount.ToString(),
                record.CreatedAt.ToString(),
                record.IsPaid.ToString(),
                //record.Quantity.ToString(),
                //record.Price.ToString(),
                //record.CountryOfCitizenship.ToString(),
                //(record.DateOfBirth != null ? record.DateOfBirth.Value.ToLongDateString() : "-" ),
                //(record.FirstLanguage != null ? record.FirstLanguage.ToString() : "-" ),
                //(record.PrimaryEmail != null ? record.PrimaryEmail.ToString() : "-" ),
                //(record.MaritalStatus != null ? record.MaritalStatus.ToString() : "-" ),
                record.Id.ToString()
            }
                );

            var jsonData = new
            {
                recordsTotal    = recordsTotal,
                recordsFiltered = recordsFiltered,
                data            = dataSet
            };

            return(jsonData);
        }