public async Task <IEnumerable <SavedCartViewModel> > LoadSavedCarts()
        {
            var memberId   = User.Identity.Name.ToUpper().Trim();
            var locale     = CultureInfo.CurrentUICulture.Name;
            var savedCarts = await _savedCartsLoader.Load(new GetSavedCartsByFilter
            {
                Filter   = string.Empty,
                MemberId = memberId,
                Locale   = locale
            });

            return(savedCarts);
        }
        public async Task <InvoiceModel> Load(int id)
        {
            var memberId = User.Identity.Name.ToUpper().Trim();
            var locale   = CultureInfo.CurrentUICulture.Name;
            var invoice  =
                await _invoiceLoader.Load(new GetInvoiceById { Id = id, MemberId = memberId, Locale = locale });

            if (invoice.MemberFirstName == null || invoice.MemberEmailAddress == null)
            {
                InvoiceProvider.LoadMemberInfo(invoice);
            }
            if (invoice.ReceiptChannel == "ClubSaleReceipt" || invoice.ReceiptChannel == "Club Visit/Sale")
            {
                if (invoice.ClubInvoice == null)
                {
                    ConvertToClubInvoiceLines(invoice.InvoiceLines, invoice);
                }
                else
                {
                    invoice.InvoiceLines = new List <InvoiceLineModel>();
                    invoice.InvoicePrice = new InvoicePriceModel();
                }
            }
            if (!HLConfigManager.Configurations.DOConfiguration.AddressOnInvoice)
            {
                invoice.MemberAddress = new InvoiceAddressModel();
            }
            return(invoice);
        }
        internal async Task <NavigationItemModel> GetNavigationModel(GetNavigationByName query)
        {
            NavigationItemModel data = null;

            data = await _NavigationLoader.Load(query).ConfigureAwait(false);

            return(data);
        }
        public async Task <List <decimal> > GetMemberDiscounts()
        {
            var locale    = CultureInfo.CurrentUICulture.Name;
            var discounts =
                await _discountsLoader.Load(new GetMemberDiscountsByLocale { Locale = locale });

            return(discounts);
        }
        public async Task <Dictionary <string, string> > LoadErrorMessage()
        {
            var locale    = CultureInfo.CurrentUICulture.Name;
            var errorMsgs = await _errorLoader.Load(new GetMemberInvoiceErrorListByLocale
            {
                Locale = locale
            });

            return(errorMsgs);
        }
        public async Task <InvoiceAddressModel> LoadMemberAddress()
        {
            var memberId = User.Identity.Name.ToUpper().Trim();
            var locale   = CultureInfo.CurrentUICulture.Name;
            var counrty  = locale.Substring(3);
            var address  = await _addressLoader.Load(new GetMemberAddressById
            {
                MemberId = memberId,
                Locale   = locale,
                Country  = counrty
            });

            return(address);
        }
Ejemplo n.º 7
0
    public void BeginLoad(IAsyncLoader loader)
    {
      if (IsAlreadyLoadingProperty(loader.Property)) return;

      lock (_syncRoot)
      {
        _loading.Add(loader);
      }
      // notify property busy
      OnPropertyBusy(loader.Property.Name, true);

      // start async loading 
      loader.Load(LoaderComplete);
    }
Ejemplo n.º 8
0
        public async Task SetMainNavigation()
        {
            var query = new GetNavigationByName
            {
                Name             = Constants.Navigation.MainNavigationName,
                Locale           = CultureInfo.CurrentUICulture.Name,
                NavigationOrigin = NavigationOrigin.Cms
            };

            NavigationItemModel data = null;

            data = await _NavigationLoader.Load(query);

            MainNavigationData = data;
        }
        public async Task <List <InvoiceModel> > LoadAll()
        {
            var locale   = CultureInfo.CurrentUICulture.Name;
            var memberId = User.Identity.Name.ToUpper().Trim();
            var invoices =
                await
                _invoicesLoader.Load(new GetInvoicesByFilter
            {
                InvoiceFilterModel = null,
                MemberId           = memberId,
                Locale             = locale
            });

            return(invoices);
        }
Ejemplo n.º 10
0
        public void BeginLoad(IAsyncLoader loader)
        {
            if (IsAlreadyLoadingProperty(loader.Property))
            {
                return;
            }

            lock (_syncRoot)
            {
                _loading.Add(loader);
            }
            // notify property busy
            OnPropertyBusy(loader.Property.Name, true);

            // start async loading
            loader.Load(LoaderComplete);
        }
Ejemplo n.º 11
0
        public async Task <List <InvoiceFilterDataModel> > LoadPaymentType()
        {
            var locale = CultureInfo.CurrentUICulture.Name;

            return(await _PaymentTypeLoader.Load(new GetInvoicePaymentTypeByLocale { Locale = locale }));
        }
Ejemplo n.º 12
0
        public async Task <List <InvoiceFilterDataModel> > LoadStatus()
        {
            var locale = CultureInfo.CurrentUICulture.Name;

            return(await _statusLoader.Load(new GetInvoiceStatusByLocale { Locale = locale }));
        }
Ejemplo n.º 13
0
        public async Task <List <InvoiceFilterDataModel> > LoadStates()
        {
            var locale = CultureInfo.CurrentUICulture.Name;

            return(await _statesLoader.Load(locale));
        }
        public ActionResult Print(int id)
        {
            var locale   = CultureInfo.CurrentUICulture.Name;
            var memberId = User.Identity.Name;
            var task     = _invoiceModelLoader.Load(new GetInvoiceById {
                Id = id, MemberId = memberId, Locale = locale
            });

            if (null != task && null != task.Result && task.Result.Id > 0)
            {
                if (task.Result.ReceiptChannel == "ClubSaleReceipt" || task.Result.ReceiptChannel == "Club Visit/Sale")
                {
                    var Price     = task.Result.ClubInvoice.ClubRecieptDisplayTotalDue.Replace(",", ".");
                    var yourPrice = Convert.ToDecimal(Price, CultureInfo.InvariantCulture);
                    yourPrice.FormatPrice();

                    task.Result.InvoiceLines.Add(new InvoiceLineModel()
                    {
                        ProductName    = task.Result.ClubInvoice.ClubRecieptProductName,
                        Quantity       = Convert.ToInt32(task.Result.ClubInvoice.ClubRecieptQuantity),
                        DisplayTotalVp = task.Result.ClubInvoice.ClubRecieptTotalVolumePoints,
                    });
                    task.Result.InvoicePrice.DisplayTotalYourPrice = yourPrice.ToString("0.##");
                }

                var htmlContent = this.RenderViewAsString("Print", task.Result);

                var pdfBytes           = _invoiceProvider.GeneratePdf(htmlContent);
                var contentDisposition = Request.QueryString["disposition"] == null
                    ? "inline"
                    : Request.QueryString["disposition"];

                if (null != pdfBytes && pdfBytes.Length > 0)
                {
                    Response.Clear();
                    Response.ClearHeaders();
                    Response.Charset     = "";
                    Response.ContentType = "application/pdf";
                    Response.AddHeader("Pragma", "public");
                    if (task.Result.ReceiptChannel == "ClubSaleReceipt" || task.Result.ReceiptChannel == "ProductSaleReceipt" || task.Result.ReceiptChannel == "Club Visit/Sale")
                    {
                        Response.AddHeader("content-disposition",
                                           string.Format("{0}; filename ={1}", contentDisposition, "Receipt"));
                    }
                    else
                    {
                        Response.AddHeader("content-disposition",
                                           string.Format("{0}; filename ={1}", contentDisposition, "Invoice"));
                    }

                    Response.BinaryWrite(pdfBytes);
                    Response.Flush();
                    try
                    {
                        Response.End();
                    }
                    catch (Exception ex)
                    {
                        LoggerHelper.Exception("System.Exception", ex, "Error in Print InvoiceController");
                    }
                }
                return(null);
            }
            return(View("Index", new InvoiceSearchModel {
                Action = "Invoice_Search"
            }));
        }