示例#1
0
        public List <FrayteExchangeRateHistory> GetExchangeRateHistory(FrayteSearchExchangeHistory search)
        {
            try
            {
                List <FrayteExchangeRateHistory> _rate = new List <FrayteExchangeRateHistory>();
                var detail = dbContext.OperationZoneExchangeRateHistories.Where(p => p.OperationZoneId == search.OperationZoneId && p.ExchangeType == search.ExchangeType &&
                                                                                p.StartDate.Value.Year == search.Year && p.StartDate.Value.Month == search.MonthName.MonthId)
                             .ToList();

                if (detail != null && detail.Count > 0)
                {
                    FrayteExchangeRateHistory frayte;
                    foreach (var Obj in detail)
                    {
                        frayte = new FrayteExchangeRateHistory();
                        OperationZone oz = dbContext.OperationZones.Where(p => p.OperationZoneId == Obj.OperationZoneId.Value).FirstOrDefault();
                        if (oz != null)
                        {
                            frayte.OperationZone = new FrayteOperationZone();
                            {
                                frayte.OperationZone.OperationZoneId   = oz.OperationZoneId;
                                frayte.OperationZone.OperationZoneName = oz.Name;
                            }
                        }
                        CurrencyType ct = dbContext.CurrencyTypes.Where(x => x.CurrencyCode == Obj.CurrencyCode).FirstOrDefault();
                        if (ct != null)
                        {
                            frayte.CurrencyDetail = new FrayteCurrencyDetail();
                            {
                                frayte.CurrencyDetail.CurrencyCode = ct.CurrencyCode;
                                frayte.CurrencyDetail.Description  = ct.CurrencyDescription;
                            }
                        }
                        frayte.ExchangeType = Obj.ExchangeType;
                        if (Obj.ExchangeRate.HasValue)
                        {
                            frayte.ExchangeRate = Obj.ExchangeRate.Value.ToString();
                        }
                        if (Obj.StartDate.HasValue)
                        {
                            frayte.StartDate = Obj.StartDate.Value;
                        }
                        if (Obj.FinishDate.HasValue)
                        {
                            frayte.FinishDate = Obj.FinishDate.Value;
                        }
                        _rate.Add(frayte);
                    }
                }
                return(_rate);
            }
            catch (Exception x)
            {
                return(null);
            }
        }
示例#2
0
        public List <FrayteExchangeRateHistory> ExchangeRateHistory(FrayteSearchExchangeHistory search)
        {
            List <FrayteExchangeRateHistory> _rate = new ExchangeRateRepository().GetExchangeRateHistory(search);

            return(_rate);
        }