Example #1
0
 public List<OrderBusiEntity> GetOrdersbyUserId(int userId)
 {
     IOrderInfoRepository iRepos = IoCContext.Container.Resolve<IOrderInfoRepository>();
     List<OrderInfo> orderList = iRepos.Find(m => m.UserId == userId).ToList();
     List<OrderBusiEntity> reslut = new List<OrderBusiEntity>();
     foreach (OrderInfo item in orderList)
     {
         OrderBusiEntity model = new OrderBusiEntity {
             CurrencyStr = item.CurrencyStr,
             IsPayment = item.IsPayment,
             OrderDate =item.OrderDate.Value,
             TotalPrice = item.TotalPrice,
              OrderId = item.OrderId};
         model.Goodies = GetGoodies(item);
         model.UnitPrices = GetUnitPrices(item);
         reslut.Add(model);
     }
     return reslut;
 }
Example #2
0
        private List<OrderBusiEntity> GetOrderBusiEntityByIds(IOrderInfoRepository iOrderRepos, List<string> orderIds)
        {
            List<OrderInfo> orderList = iOrderRepos.Find(m => orderIds.Contains(m.OrderId)).OrderByDescending(m => m.OrderDate).ToList();
            List<OrderBusiEntity> reslut = new List<OrderBusiEntity>();
            foreach (OrderInfo item in orderList)
            {
                OrderBusiEntity model = new OrderBusiEntity
                {
                    CurrencyStr = item.CurrencyStr,
                    IsPayment = item.IsPayment,
                    OrderDate = item.OrderDate.Value,
                    TotalPrice = item.TotalPrice,
                    OrderId = item.OrderId,
                    Address = item.User ==null? string.Empty : item.User.Address,
                    CountryName = item.User ==null? string.Empty : item.User.CountryName,
                    FirstName = item.User ==null? string.Empty : item.User.FirstName,
                    EmailAddress = item.User == null ? string.Empty : item.User.EmailAddress,
                    Zip = item.User == null ? string.Empty : item.User.Zip,
                    Town = item.User == null ? string.Empty : item.User.Town,
                    PayType = item.PayType
                };

                foreach (var record in item.DonateRecords)
                {
                   model.ProjecName = record.DonationProject.ProjectName;
                   break;
                }

                if (item.User != null)
                {
                    model.Goodies = GetGoodies(item);
                    model.UnitPrices = GetUnitPrices(item);
                }
                reslut.Add(model);
            }
            return reslut;
        }