Exemplo n.º 1
0
        public async Task <ActionResult <Label> > GetLabel(long id)
        {
            var label = _labelService.Get(id);

            if (label == null)
            {
                return(NotFound());
            }

            return(label);
        }
Exemplo n.º 2
0
        public IEnumerable <IndexLabelDto> Get(DateTime startDateTime, DateTime endDateTime)
        {
            DateTime startLastMonth = Util.MyDate.GetStartLastMonth(startDateTime.Month, startDateTime.Year);
            DateTime endLastMonth   = Util.MyDate.GetEndLastMonth(endDateTime.Month, endDateTime.Year);

            bool FilterDate(Expense x) => x.Data >= startDateTime && x.Data <= endDateTime;
            bool FilterDateIncoming(Expense x) => x.Data >= startDateTime && x.Data <= endDateTime && x.IsIncoming;
            bool FilterDateOutcoming(Expense x) => x.Data >= startDateTime && x.Data <= endDateTime && !x.IsIncoming;
            bool FilterLastMonthIncoming(Expense x) => x.Data >= startLastMonth && x.Data <= endLastMonth && x.IsIncoming;
            bool FilterLastMonthOutComing(Expense x) => x.Data >= startLastMonth && x.Data <= endLastMonth && !x.IsIncoming;
            bool FilterUntilThisMonth(Expense x) => x.Data <= endLastMonth;

            return(_service.Get(x => x.Expenses)
                   .Select(x => new IndexLabelDto
            {
                Label = _adapter.ModelToDto(x),
                Amount = x.Expenses.Count(FilterDate),
                Value = x.Expenses.Where(FilterDateIncoming).Select(y => y.Value).Sum() -
                        x.Expenses.Where(FilterDateOutcoming).Select(y => y.Value).Sum(),

                LastMonth = x.Expenses.Where(FilterLastMonthIncoming).Select(y => y.Value).Sum() -
                            x.Expenses.Where(FilterLastMonthOutComing).Select(y => y.Value).Sum(),

                Average = x.Expenses.Any(FilterUntilThisMonth) ? x.Expenses.Where(FilterUntilThisMonth).Select(y => y.Value).Average() : 0
            })
                   .OrderBy(x => x.Label.Name));
        }
Exemplo n.º 3
0
        private OrderSummaryViewModel GetOrderSummary(int orderId)
        {
            var source = _labelService.Get(orderId);

            return(new OrderSummaryViewModel
            {
                Bags = source.BagTotal.NullableToString(),
                Boxes = source.BoxTotal.NullableToString(),
                CustomerName = source.CustomerName,
                Locations = source.CustomerLocationsTotal.ToString(CultureInfo.InvariantCulture),
                Pieces = source.PieceTotal.NullableToString(),
                Title = "Order Summary"
            });
        }
Exemplo n.º 4
0
        private void CreateSelectLists(long?labelId = null, long?paymentId = null)
        {
            IEnumerable <Label>   lables   = _labelService.Get();
            IEnumerable <Payment> payments = _paymentService.Get();

            Label[] l = { new Label {
                              Id = -1, Name = string.Empty
                          } };
            lables = lables.Concat(l).OrderBy(x => x.Id);

            Payment[] p = { new Payment {
                                Id = -1, Name = string.Empty
                            } };
            payments = payments.Concat(p).OrderBy(x => x.Id);

            ViewData[Resource.LabelsViewData]   = new SelectList(lables, "Id", "Name", labelId);
            ViewData[Resource.PaymentsViewData] = new SelectList(payments, "Id", "Name", paymentId);
        }
Exemplo n.º 5
0
 public ActionResult Index(int?OrderId)
 {
     ViewBag.Orders = _labelService.GetOrders();
     return(View(_labelService.Get(OrderId)));
 }
Exemplo n.º 6
0
 public virtual void RenderLabel(string key, RenderingContext context)
 {
     context.Writer.Write(_labelService.Get(key));
 }
Exemplo n.º 7
0
        public async Task <Models.Label> Get(string id, string Token)
        {
            var tasks = await _labelService.Get(id, Token);

            return(tasks);
        }
Exemplo n.º 8
0
 public BaseResponse <IEnumerable <LabelOutputDto> > Get([FromHeader] IDictionary <string, string> @params)
 {
     return(_labelService.Get(@params));
 }
Exemplo n.º 9
0
        public async Task <IEnumerable <LabelAliasDto> > GetLabels()
        {
            var result = await _labelService.Get();

            return(result.Select(x => x.TranslateToLabelAliasDto()));
        }