Beispiel #1
0
        private List <BillingMethodDTO> GetBillingMethods(Langs l)
        {
            List <BillingMethodDTO> billingMethodDTOs = new List <BillingMethodDTO>();
            var lang    = Utils.getLanguage(l);
            var methods = unitOfWork.ShippingBillingMethodRepository.Get(c => c.IsActive == true && c.IsShipping == false).ToList();

            foreach (var method in methods)
            {
                BillingMethodDTO billingMethodDTO = new BillingMethodDTO();
                billingMethodDTO.Id = method.Id;

                ShippingBillingMethodDescription desc = unitOfWork.ShippingBillingMethodDescriptionRepository.Get(c =>
                                                                                                                  c.LanguageId == lang &&
                                                                                                                  c.ShippingBillingMethodId == method.Id).FirstOrDefault();

                billingMethodDTO.Name            = desc.Name;
                billingMethodDTO.MetaDescription = desc.MetaDescription;

                billingMethodDTOs.Add(billingMethodDTO);
            }
            return(billingMethodDTOs);
        }
Beispiel #2
0
        public OrderDTO GetOrderById(long id, Langs l, Currency c)
        {
            OrderDTO orderDTO = new OrderDTO();
            Order    order    = unitOfWork.OrderRepository.GetByID(id);

            orderDTO.BillingAddress  = GetOrderAddress(order.BillingAddress);
            orderDTO.ShippingAddress = GetOrderAddress(order.ShippingAddress);
            orderDTO.OrderItems      = GetOrderItems(order.Id, l, c);
            orderDTO.CurrencyName    = Utils.getCurrencyName(c, l);
            orderDTO.InvoiceId       = order.InvoiceId;
            orderDTO.ClosingDate     = order.ClosingDate;
            orderDTO.UserIpAddress   = order.UserIpAddress;
            orderDTO.UserAgent       = order.UserAgent;
            if (!String.IsNullOrEmpty(order.CouponCode))
            {
                orderDTO.CouponCode     = order.CouponCode;
                orderDTO.CouponValue    = order.CouponValue;
                orderDTO.CouponCurrency = orderDTO.CurrencyName;
                if (!order.CouponIsPercentage)
                {
                    orderDTO.CouponValue    = Utils.getCurrency(c, l, order.CouponValue).Item1;
                    orderDTO.CouponCurrency = "-";
                }
                else
                {
                    orderDTO.CouponCurrency = "%";
                }
            }

            // get Order Owner
            var user = _userService.getuserById(order.UserId);

            orderDTO.CreationDate       = order.CreationDate.Value;
            orderDTO.DateModified       = order.DateModified;
            orderDTO.Discount           = order.Discount;
            orderDTO.Id                 = order.Id;
            orderDTO.InvoiceId          = order.InvoiceId;
            orderDTO.PaymentDate        = order.PaymentDate;
            orderDTO.PaymentNotes       = order.PaymentNotes;
            orderDTO.PaymentDate        = order.PaymentDate;
            orderDTO.ShippingCost       = order.ShippingCost;
            orderDTO.Status             = order.Status;
            orderDTO.SubTotal           = Utils.getCurrency(c, l, order.SubTotal).Item1;
            orderDTO.Total              = Utils.getCurrency(c, l, order.Total).Item1;
            orderDTO.TransactionDetails = order.TransactionDetails;
            orderDTO.TransactionId      = order.TransactionId;
            orderDTO.UserId             = order.UserId;
            orderDTO.Phone              = order.ShippingAddress.Phone;
            orderDTO.UserName           = user.FirstName + " " + user.LastName;
            orderDTO.Email              = user.Email;
            orderDTO.OrderHistories     = GetOrderHistory(id);


            ShippingMethodDTO  shippingMethodDTO  = new ShippingMethodDTO();
            BillingMethodDTO   billingMethodDTO   = new BillingMethodDTO();
            ShippingCompanyDTO shippingCompanyDTO = new ShippingCompanyDTO();

            if (l == Langs.English)
            {
                shippingMethodDTO.Name  = order.EnglishShippingName;
                billingMethodDTO.Name   = order.EnglishBillingName;
                shippingCompanyDTO.Name = order.EnglishCompanyName;
            }
            else
            {
                shippingMethodDTO.Name  = order.ArabicShippingName;
                billingMethodDTO.Name   = order.ArabicBillingName;
                shippingCompanyDTO.Name = order.ArabicCompanyName;
            }

            orderDTO.ShippingMethod = shippingMethodDTO;
            orderDTO.BillingMethod  = billingMethodDTO;
            return(orderDTO);
        }