Exemplo n.º 1
0
        public List <BaseOrderLineDTO> GetSalesRows(int userId, DashboardEnums.eSaleBoxType type, FiltersToken filter)
        {
            try
            {
                using (var context = new lfeAuthorEntities())
                {
                    string paymentSource = null;
                    byte?  lineTypeId    = null;


                    switch (type)
                    {
                    case DashboardEnums.eSaleBoxType.ONE_TIME:
                        paymentSource = DashboardEnums.eSaleSources.AS.ToString();
                        lineTypeId    = (byte)BillingEnums.eOrderLineTypes.SALE;
                        break;

                    case DashboardEnums.eSaleBoxType.SUBSCRIPTION:
                        paymentSource = DashboardEnums.eSaleSources.AS.ToString();
                        lineTypeId    = (byte)BillingEnums.eOrderLineTypes.SUBSCRIPTION;
                        break;

                    case DashboardEnums.eSaleBoxType.RENTAL:
                        paymentSource = DashboardEnums.eSaleSources.AS.ToString();
                        lineTypeId    = (byte)BillingEnums.eOrderLineTypes.RENTAL;
                        break;

                    case DashboardEnums.eSaleBoxType.SALES_BY_AFFILIATES:
                        paymentSource = DashboardEnums.eSaleSources.BAFS.ToString();
                        break;

                    case DashboardEnums.eSaleBoxType.AFFILIATE_SALES:
                        paymentSource = DashboardEnums.eSaleSources.AFS.ToString();
                        break;
                    }

                    var result = context.tvf_DB_GetUserSalesDetails(filter.DateRange.from, filter.DateRange.to, userId, filter.CurrencyId, filter.StoreId, paymentSource, lineTypeId).ToList();
                    var lines  = result.Select(x => x.DbSaleEntity2BaseOrderLineDto()).OrderByDescending(x => x.OrderNumber).ToList();

                    return(lines);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetSalesRows", ex, CommonEnums.LoggerObjectTypes.Dashboard);

                return(new List <BaseOrderLineDTO>());
            }
        }
Exemplo n.º 2
0
        public ActionResult GetSalesDetailsWindow(FiltersToken filter, DashboardEnums.eSaleBoxType type, bool compareBox)
        {
            var periodKind = filter.PeriodTypeId.ToPeriodSelectionKind();

            filter.DateRange = _dashboardServices.PeriodKindToDateRange(periodKind, compareBox);

            var token = new SalesDetailsWindowToken
            {
                Title          = String.Format("{0} for {1}-{2}", Utils.GetEnumDescription(type), filter.DateRange.from.ToString("MMMM dd, yyyy"), filter.DateRange.to.ToString("MMMM dd, yyyy"))
                , Filter       = filter
                , Type         = type
                , IsCompareBox = compareBox
            };

            return(PartialView("Dashboard/_SalesDetailWindow", token));
        }
Exemplo n.º 3
0
 public DashboardSaleBoxToken(DashboardEnums.eSaleBoxType type, decimal total, int qty)
 {
     Type     = type;
     Total    = total.FormatMoney(0);
     Quantity = qty;
 }
Exemplo n.º 4
0
 public DashboardSaleBoxToken(DashboardEnums.eSaleBoxType type)
 {
     Type     = type;
     Total    = 0;
     Quantity = 0;
 }
Exemplo n.º 5
0
        public ActionResult GetSubscriptionCancellation([DataSourceRequest] DataSourceRequest request, DashboardEnums.eSaleBoxType saleBoxType, short CurrencyId, int?StoreId, DateTime from, DateTime to, int userId)
        {
            var filter = new FiltersToken
            {
                CurrencyId = CurrencyId,
                DateRange  = new DateRangeToken {
                    from = from, to = to
                },
                StoreId = StoreId
            };
            var list = _dashboardServices.GetSubscriptionCancelRows(userId, filter);

            return(Json(list.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }