Exemple #1
0
        public UnitOfWork(MyDbContext context)
        {
            _context = context;

            Rates        = new RateRepository(_context);
            Transactions = new TransactionRepository(_context);
        }
Exemple #2
0
        public static int CopyProgram(int id, string loggedOnUser)
        {
            using (CustomClearviewEntities ctx = new CustomClearviewEntities())
            {
                RateRepository repo    = new RateRepository(ctx);
                Program        current = repo.Find(r => r.ProgramId == id, type => type.ProgramVendors);

                Program copy = new Program
                {
                    AccountNumberFixedLength = current.AccountNumberFixedLength,
                    AccountNumberLength      = current.AccountNumberLength,
                    AccountNumberTypeId      = current.AccountNumberTypeId,
                    BrandId = current.BrandId,
                    CancellationVerbiage        = current.CancellationVerbiage,
                    CancellationVerbiageSpanish = current.CancellationVerbiageSpanish,
                    EffectiveEndDate            = current.EffectiveEndDate,
                    EffectiveStartDate          = current.EffectiveStartDate,
                    Etf                 = current.Etf,
                    Hefpa               = current.Hefpa,
                    Market              = current.Market,
                    MeterNumber         = current.MeterNumber,
                    MeterNumberLength   = current.MeterNumberLength,
                    Msf                 = current.Msf,
                    PremiseTypeId       = current.PremiseTypeId,
                    ProgramCode         = current.ProgramCode + " - COPY",
                    ProgramName         = current.ProgramName + " - COPY",
                    ProgramDescription  = current.ProgramDescription + " - COPY",
                    PromotionalCode     = current.PromotionalCode,
                    Rate                = current.Rate,
                    RateVerbiage        = current.RateVerbiage,
                    RateVerbiageSpanish = current.RateVerbiageSpanish,
                    RescindBy           = current.RescindBy,
                    SalesChannel        = current.SalesChannel,
                    State               = current.State,
                    Term                = current.Term,
                    UnitOfMeasureId     = current.UnitOfMeasureId,
                    UtilityId           = current.UtilityId,
                    UtilityTypeId       = current.UtilityTypeId,
                    UpdatedBy           = loggedOnUser,
                    UpdatedDateTime     = DateTime.Now,
                    ServiceReference    = current.ServiceReference,
                    CreditCheck         = current.CreditCheck
                };

                foreach (ProgramVendor pv in current.ProgramVendors)
                {
                    copy.ProgramVendors.Add(new ProgramVendor
                    {
                        VendorId        = pv.VendorId,
                        CreatedBy       = "test",
                        CreatedDateTime = DateTime.Now
                    });
                }

                repo.Create(copy);
                ctx.SaveChanges();

                return(copy.ProgramId);
            }
        }
Exemple #3
0
 public static void ClassInit(TestContext context)
 {
     _mockFileReader = new Mock <IFileReader>();
     _mockFileReader.Setup(m => m.GetLines(It.IsAny <string>())).Returns(new String[] { "Lion;0.10;meat;",
                                                                                        "Zebra;0.08;fruit;",
                                                                                        "Wolf;0.07;both;90%" });
     _rateRepository = new RateRepository(@"c:\temp\RateRepository.txt", _mockFileReader.Object);
 }
Exemple #4
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context  = context;
     Rides     = new RideRepository(context);
     Requests  = new RequestRepository(context);
     Members   = new MemberRepository(context);
     Car       = new CarRepository(context);
     MemberCar = new MemberCarRepository(context);
     Rate      = new RateRepository(context);
 }
Exemple #5
0
 public void SetUp()
 {
     rateRepository = new RateRepository();
     rateDMList     = new List <RateDM>
     {
         new RateDM("RBR", "YEN", 15.55m),
         new RateDM("EUR", "PES", 23.32m),
         new RateDM("DOL", "COL", 0.25m)
     };
 }
Exemple #6
0
        public DBTests()
        {
            var options = new DbContextOptionsBuilder <CurrencyRateContext>()
                          .UseInMemoryDatabase(databaseName: "DBTest")
                          .Options;

            _context           = new CurrencyRateContext(options);
            _rateRepository    = new RateRepository(_context);
            _serviceRepository = new ServiceRepository(_context);
            AddServicesData();
        }
Exemple #7
0
        public static Program GetProgram(int id)
        {
            Program program;

            using (CustomClearviewEntities ctx = new CustomClearviewEntities())
            {
                RateRepository repo = new RateRepository(ctx);
                program = repo.Find(x => x.ProgramId == id, t => t.ProgramVendors);
            }
            return(program);
        }
 /// <summary>
 /// Disposes of any unmanaged resources
 /// </summary>
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         if (this._rateRepository != null)
         {
             this._rateRepository.Dispose();
             this._rateRepository = null;
         }
     }
 }
Exemple #9
0
        public static List <Program> GetPrograms(int utilityId, int vendorId, string utilityType)
        {
            List <Program> programs;

            using (CustomClearviewEntities ctx = new CustomClearviewEntities())
            {
                RateRepository repo = new RateRepository(ctx);
                programs = repo.Filter(p => p.UtilityId == utilityId && p.ProgramVendors.Any(pv => pv.VendorId == vendorId) && p.UtilityType.UtilityTypeName.ToUpper() == utilityType.ToUpper(),
                                       sort => sort.ProgramName, SortOrder.Ascending, u => u.UnitOfMeasure, p => p.PremiseType,
                                       ut => ut.UtilityType, u => u.Utility, b => b.Brand, a => a.AccountNumberType, v => v.ProgramVendors);
            }
            return(programs);
        }
Exemple #10
0
 public RatesController(
     AppTransaction tx,
     IMapper mapper,
     RateRepository rateRepository,
     BoardGameRepository boardGameRepository,
     UserManager <User> userManager
     )
 {
     TX                   = tx;
     _mapper              = mapper;
     _rateRepository      = rateRepository;
     _userManager         = userManager;
     _boardGameRepository = boardGameRepository;
 }
Exemple #11
0
        static async Task InitializeDatabase()
        {
            var startDate = DateTime.Now.AddDays(-365);
            var endDate   = DateTime.Now;

            for (int i = 0; i < currencies.Length; i++)
            {
                for (int j = 0; j < currencies.Length; j++)
                {
                    var source = currencies[i];
                    var target = currencies[j];

                    if (source == target)
                    {
                        continue;
                    }

                    Console.WriteLine($"{source} {target}");
                    var rates = (await client.GetRatesAsync(source, target, startDate, endDate)).ToList();

                    var rep = new RateRepository("rates", source, target);
                    foreach (var rate in rates)
                    {
                        var r = new Models.Rate {
                            Value = rate.Value, Date = rate.Time
                        };
                        await rep.Add(r);
                    }

                    // var rep90 = new RateRepository("sma90", source, target);
                    // foreach (var rate in GetRate(rates, sma90, 0).ToList())
                    // {
                    //     await rep90.Add(rate);
                    // }

                    // var rep4 = new RateRepository("sma4", source, target);
                    // foreach (var rate in GetRate(rates, sma4, 0).ToList())
                    // {
                    //     await rep4.Add(rate);
                    // }

                    // var rep14 = new RateRepository("rsi14", source, target);
                    // foreach (var rate in GetRsi(rates, rsi14, 0).ToList())
                    // {
                    //     await rep14.Add(rate);
                    // }
                }
            }
        }
Exemple #12
0
        public static List <Program> GetPrograms(bool activeOnly, int id)
        {
            List <Program> programs;

            using (CustomClearviewEntities ctx = new CustomClearviewEntities())
            {
                RateRepository repo = new RateRepository(ctx);
                programs = activeOnly
                    ? repo.Filter(a => a.ProgramVendors.Any(v => v.VendorId == id) && a.EffectiveEndDate > DateTime.Now, sort => sort.ProgramName, SortOrder.Ascending, u => u.UnitOfMeasure, p => p.PremiseType,
                                  ut => ut.UtilityType, u => u.Utility, b => b.Brand)
                    : repo.Filter(a => a.ProgramVendors.Any(v => v.VendorId == id), sort => sort.ProgramName, SortOrder.Ascending, t => t.UnitOfMeasure, u => u.UtilityType, p => p.PremiseType,
                                  ut => ut.UtilityType, u => u.Utility, b => b.Brand); //EffecticeEndDate >= today
            }
            return(programs);
        }
Exemple #13
0
        public static List <Utility> GetUtilities()
        {
            List <Utility> utilities = new List <Utility>();

            using (CustomClearviewEntities ctx = new CustomClearviewEntities())
            {
                RateRepository repo     = new RateRepository(ctx);
                List <Program> programs = repo.All(type => type.Utility);
                foreach (Program p in programs)
                {
                    utilities.Add(p.Utility);
                }
            }

            return(utilities.Distinct().ToList());
        }
Exemple #14
0
 public BooksController(BookRepository bookRepository,
                        RateRepository rateRepository,
                        CommentRepository commentRepository,
                        BookToGenreRepository bookToGenreRepository,
                        BookToAuthorRepository bookToAuthorRepository,
                        AuthorRepository authorRepository,
                        UserManager <User> userManager)
 {
     this.bookRepository         = bookRepository;
     this.rateRepository         = rateRepository;
     this.commentRepository      = commentRepository;
     this.bookToGenreRepository  = bookToGenreRepository;
     this.bookToAuthorRepository = bookToAuthorRepository;
     this.authorRepository       = authorRepository;
     this.userManager            = userManager;
 }
Exemple #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="utilityId"></param>
        /// <param name="vendorId"></param>
        /// <param name="utilityType">Gas, Electric, Duel Fuel</param>
        /// <param name="accountType">B = Business, R = Residential</param>
        /// <returns></returns>
        public static List <Program> GetPrograms(int utilityId, int vendorId, Enums.UtilityType utilityType, Enums.PremiseType premiseType)
        {
            List <Program> programs;
            DateTime       dateOnly = DateTime.Now.Date;

            using (CustomClearviewEntities ctx = new CustomClearviewEntities())
            {
                RateRepository repo = new RateRepository(ctx);
                programs = repo.Filter(p => p.UtilityId == utilityId &&
                                       p.PremiseTypeId == (int)premiseType &&
                                       p.ProgramVendors.Any(pv => pv.VendorId == vendorId) &&
                                       p.UtilityTypeId == (int)utilityType &&
                                       dateOnly >= p.EffectiveStartDate &&
                                       dateOnly <= p.EffectiveEndDate,
                                       sort => sort.ProgramName, SortOrder.Ascending, u => u.UnitOfMeasure, p => p.PremiseType,
                                       ut => ut.UtilityType, u => u.Utility, b => b.Brand, a => a.AccountNumberType, v => v.ProgramVendors);
            }
            return(programs);
        }
Exemple #16
0
        public static int CreateRate(Program program)
        {
            if (program == null)
            {
                throw new System.ArgumentNullException()
                      {
                          Source = "program"
                      };
            }

            using (CustomClearviewEntities ctx = new CustomClearviewEntities())
            {
                RateRepository repo = new RateRepository(ctx);
                repo.Create(program);
                ctx.SaveChanges();
            }

            return(program.ProgramId);
        }
Exemple #17
0
        public void GetAllRates_With_Service_Available()
        {
            // Arrenge
            const string ratesUrl = "http://quiet-stone-2094.herokuapp.com/rates.json";
            var          options  = new DbContextOptionsBuilder <GNBContext>()
                                    .UseInMemoryDatabase(databaseName: "GNBTestDB")
                                    .Options;

            var mockLogger = new Mock <ILogger <RateService> >();
            var logger     = mockLogger.Object;

            var context        = new GNBContext(options);
            var rateRepository = new RateRepository(context);
            var rateService    = new RateService(rateRepository, logger);

            // Act
            var rates = rateService.GetAllAsync(ratesUrl).Result;

            // Assertion
            Assert.True(rates.Any()); // Checks if all ratess  were fetched from server.
        }
Exemple #18
0
        public void Constructor_InvalidData_ThrowsExpectedError()
        {
            var mockFileReader = new Mock <IFileReader>();

            mockFileReader.Setup(m => m.GetLines(It.IsAny <string>())).Returns(new String[] { "Lion;xyz;meat;",
                                                                                              "Zebra;0.08;fruit;",
                                                                                              "Wolf;0.07;both;90%" });
            //simulate badd data in a line, like the rate value
            Exception expectedException = null;

            try
            {
                var rateRepository = new RateRepository(@"c:\temp\RateRepository.txt", mockFileReader.Object);
            }
            catch (Exception e)
            {
                expectedException = e;
            }

            Assert.IsNotNull(expectedException);
            Assert.AreEqual("This line 'Lion;xyz;meat;' contained invalid data", expectedException.Message);
        }
Exemple #19
0
        public static List <Utility> GetUtilities(int vendorId, Enums.UtilityType utilityType, Enums.PremiseType accountType)
        {
            List <Utility> utilities = new List <Utility>();
            DateTime       dateOnly  = DateTime.Now.Date;

            using (CustomClearviewEntities ctx = new CustomClearviewEntities())
            {
                RateRepository repo     = new RateRepository(ctx);
                List <Program> programs = repo.Filter(r => r.ProgramVendors.Any(v => v.VendorId == vendorId) &&
                                                      r.PremiseTypeId == (int)accountType &&
                                                      r.UtilityTypeId == (int)utilityType &&
                                                      dateOnly >= r.EffectiveStartDate &&
                                                      dateOnly <= r.EffectiveEndDate
                                                      , type => type.Utility);

                foreach (Program p in programs)
                {
                    utilities.Add(p.Utility);
                }
            }

            return(utilities.Distinct().OrderBy(sort => sort.Name).ToList());
        }
Exemple #20
0
        public AddRateOutputModel Save(AddRateInputModel data)
        {
            RateRepository     repo   = new RateRepository(db);
            AddRateOutputModel output = new AddRateOutputModel();

            LogRateSite temp = new LogRateSite();

            temp.SiteID    = data.SiteID;
            temp.RateScore = data.RateScore;
            temp.UserID    = data.UserID;

            var res = repo.Insert(temp);

            if (res.ID != Guid.Empty)
            {
                SiteRepository siteRepo  = new SiteRepository(db);
                var            updateRes = siteRepo.UpdateRateScore(temp);

                output.ID = updateRes.ID;
            }

            return(output);
        }
Exemple #21
0
 public void SetUp()
 {
     _recipeManagerContext = RecipeManagerContextHelper.CreateTestContext();
     _rateRepository       = new RateRepository(_recipeManagerContext);
 }
Exemple #22
0
        public static int UpdateRate(Program program)
        {
            if (program == null)
            {
                throw new System.ArgumentNullException()
                      {
                          Source = "program"
                      };
            }

            using (CustomClearviewEntities ctx = new CustomClearviewEntities())
            {
                using (DbContextTransaction trans = ctx.Database.BeginTransaction())
                {
                    RateRepository repo = new RateRepository(ctx);

                    Program oldRate = repo.Find(p => p.ProgramId == program.ProgramId, t => t.ProgramVendors);

                    oldRate.ProgramId          = program.ProgramId;
                    oldRate.ProgramCode        = program.ProgramCode;
                    oldRate.ProgramName        = program.ProgramName;
                    oldRate.ProgramDescription = program.ProgramDescription;
                    oldRate.EffectiveStartDate = program.EffectiveStartDate;
                    oldRate.EffectiveEndDate   = program.EffectiveEndDate;
                    oldRate.Msf                         = program.Msf;
                    oldRate.Etf                         = program.Etf;
                    oldRate.Rate                        = program.Rate;
                    oldRate.PromotionalCode             = program.PromotionalCode;
                    oldRate.UnitOfMeasureId             = program.UnitOfMeasureId;
                    oldRate.Term                        = program.Term;
                    oldRate.UtilityTypeId               = program.UtilityTypeId;
                    oldRate.PremiseTypeId               = program.PremiseTypeId;
                    oldRate.State                       = program.State;
                    oldRate.UtilityId                   = program.UtilityId;
                    oldRate.AccountNumberTypeId         = program.AccountNumberTypeId;
                    oldRate.AccountNumberLength         = program.AccountNumberLength;
                    oldRate.AccountNumberFixedLength    = program.AccountNumberFixedLength;
                    oldRate.MeterNumber                 = program.MeterNumber;
                    oldRate.MeterNumberLength           = program.MeterNumberLength;
                    oldRate.ServiceReference            = program.ServiceReference;
                    oldRate.RescindBy                   = program.RescindBy;
                    oldRate.Hefpa                       = program.Hefpa;
                    oldRate.Vendor                      = program.Vendor;
                    oldRate.Market                      = program.Market;
                    oldRate.SalesChannel                = program.SalesChannel;
                    oldRate.RateVerbiage                = program.RateVerbiage;
                    oldRate.CancellationVerbiage        = program.CancellationVerbiage;
                    oldRate.RateVerbiageSpanish         = program.RateVerbiageSpanish;
                    oldRate.CancellationVerbiageSpanish = program.CancellationVerbiageSpanish;
                    oldRate.BrandId                     = program.BrandId;
                    oldRate.UpdatedBy                   = program.UpdatedBy;
                    oldRate.UpdatedDateTime             = program.UpdatedDateTime;
                    oldRate.CreditCheck                 = program.CreditCheck;

                    List <ProgramVendor> deleteList = new List <ProgramVendor>();
                    List <ProgramVendor> addList    = new List <ProgramVendor>();

                    foreach (ProgramVendor cpv in oldRate.ProgramVendors)
                    {
                        if (!program.ProgramVendors.Any(x => x.ProgramId == cpv.ProgramId && x.VendorId == cpv.VendorId))
                        {
                            deleteList.Add(cpv);
                        }
                    }

                    foreach (ProgramVendor pv in program.ProgramVendors)
                    {
                        if (!oldRate.ProgramVendors.Any(x => x.ProgramId == pv.ProgramId && x.VendorId == pv.VendorId))
                        {
                            pv.ProgramId = program.ProgramId;
                            addList.Add(pv);
                        }
                    }

                    foreach (ProgramVendor d in deleteList)
                    {
                        oldRate.ProgramVendors.Remove(d);
                    }

                    foreach (ProgramVendor a in addList)
                    {
                        oldRate.ProgramVendors.Add(a);
                    }

                    repo.Update(oldRate);

                    ctx.SaveChanges();
                    trans.Commit();
                }
            }

            return(program.ProgramId);
        }
Exemple #23
0
 public RateService(ApplicationDbContext applicationDbContext)
 {
     _rateService = new RateRepository(applicationDbContext);
 }
Exemple #24
0
 public RateController(RateRepository RateController)
 {
     _RateRepository = RateController;
 }
        public List <Rate> Index([FromQuery] string source, [FromQuery] string target, [FromQuery] string type)
        {
            var repository = new RateRepository(source, target, type);

            return(repository.Get().Result.ToList());;
        }
 public AxadoCarrierUnitOfWork()
 {
     this.DbContext         = new AxadoCarrierDBContext();
     this.CarrierRepository = new CarrierRepository(this.DbContext);
     this.RateRepository    = new RateRepository(this.DbContext);
 }
Exemple #27
0
        static async Task MonitorAlert()
        {
            Dictionary <string, List <Rate> > cache = new Dictionary <string, List <Rate> >();
            DateTime day = DateTime.Now;

            while (true)
            {
                for (int i = 0; i < currencies.Length; i++)
                {
                    for (int j = 0; j < currencies.Length; j++)
                    {
                        var source = currencies[i];
                        var target = currencies[j];

                        if (source == target)
                        {
                            continue;
                        }

                        Console.WriteLine($"{source} {target}");
                        var key = $"{source}_{target}";
                        if (!cache.ContainsKey(key))
                        {
                            var startDate = DateTime.Now;
                            var endDate   = DateTime.Now.AddDays(-90);

                            var rates = (await client.GetRatesAsync(source, target, startDate, endDate)).ToList();
                            cache.Add(key, rates);
                        }

                        var lastRate = (await client.GetRatesAsync(source, target, DateTime.Now, DateTime.Now)).FirstOrDefault();
                        var last     = new Models.Rate();
                        last.Value = lastRate.Value;
                        // if (lastRate != null)
                        // {
                        //     var rates = cache[key];
                        //     rates.RemoveAt(rates.Count - 1);

                        //     rates.Add(lastRate);
                        // }

                        var updatedRates = cache[key];
                        var rate90       = GetRate(updatedRates, sma90);
                        var rate4        = GetRate(updatedRates, sma4);
                        var rateRsi      = GetRsi(updatedRates, rsi14);

                        TriggerAlerts(source, target, rate90, rate4, rateRsi, last);

                        if (DateTime.Now.DayOfYear != day.DayOfYear)
                        {
                            var rep90 = new RateRepository("sma90", source, target);
                            await rep90.Add(rate90);

                            var rep4 = new RateRepository("sma4", source, target);
                            await rep4.Add(rate4);

                            var rep14 = new RateRepository("rsi14", source, target);
                            await rep14.Add(rateRsi);

                            day = DateTime.Now;
                        }
                    }
                }

                return;

                System.Threading.Thread.Sleep(60000);
            }
        }
Exemple #28
0
        public static double CalculateReservationTotalPrice(Guid reservationId)
        {
            ReservationRepository reservationRepository = new ReservationRepository();
            RateRepository        rateRepository        = new RateRepository();

            var reservation = reservationRepository.GetReservationById(reservationId, LogInManager.LoggedInUserId).FirstOrDefault();

            double dblTotalPrice = 0;

            if (reservation != null)
            {
                int    noOfNights;
                double rate;
                int?   noOfChildren;
                double?discountAmount;
                double?discountPercentage;
                bool   blnIsDisocuntInPercentage = false;

                double totalDiscount   = 0;
                double childrenCharges = 0;

                noOfNights         = reservation.NoOfNight;
                rate               = reservation.Rate.HasValue ? reservation.Rate.Value : 0;
                noOfChildren       = reservation.NoOfChildren;
                discountAmount     = reservation.DiscountAmount;
                discountPercentage = reservation.DiscountPercentage;

                if (discountPercentage.HasValue)
                {
                    blnIsDisocuntInPercentage = true;
                }

                double?dblWeekEndPrice = rate;

                if (reservation.RoomTypeId.HasValue && reservation.RateCodeId.HasValue)
                {
                    var weekEndPrice = rateRepository.GetWeekEndPrice(reservation.RoomTypeId.Value, reservation.RateCodeId.Value).FirstOrDefault();

                    if (weekEndPrice != null)
                    {
                        dblWeekEndPrice = weekEndPrice.Amount;
                    }
                }

                int totalNoOfDays = noOfNights;

                DateTime dtStartDate = reservation.ArrivalDate.Value;

                for (int i = 1; i <= totalNoOfDays; i++)
                {
                    double discount = 0;
                    rate = reservation.Rate.HasValue ? reservation.Rate.Value : 0;

                    if (dtStartDate.DayOfWeek == DayOfWeek.Friday || dtStartDate.DayOfWeek == DayOfWeek.Saturday)
                    {
                        rate = dblWeekEndPrice.HasValue ? dblWeekEndPrice.Value : rate;
                    }

                    if (blnIsDisocuntInPercentage)
                    {
                        if (discountPercentage.HasValue && discountPercentage.Value > 0)
                        {
                            discount = (rate * discountPercentage.Value) / 100;
                        }
                    }
                    else
                    {
                        if (discountAmount.HasValue)
                        {
                            discount = discountAmount.Value;
                        }
                    }

                    totalDiscount = totalDiscount + discount;

                    dblTotalPrice += (1 * rate); // Each night (1, 2, 3 etc...). Here 1 = current night

                    dtStartDate = dtStartDate.AddDays(1);
                }

                //Deduct Discount from total price.
                if (totalDiscount > 0)
                {
                    dblTotalPrice = (dblTotalPrice - totalDiscount);
                }


                //Default 5 Euro for the one children.
                if (noOfChildren.HasValue)
                {
                    childrenCharges = (noOfChildren.Value * (double)Constants.CHILDREN_CHARGE);
                }

                //dblTotalPrice = (noOfNights * rate) + childrenCharges;
                dblTotalPrice += childrenCharges;

                //Append Add-Ons Price.
                var addOnsDetails = reservationRepository.GetReservationAddOnsMapping(reservation.Id, null, LogInManager.LoggedInUserId);
                if (addOnsDetails != null && addOnsDetails.Count > 0)
                {
                    var totalAddOnsPrice = addOnsDetails.Where(m => m.AddOnsPrice.HasValue).Sum(m => m.AddOnsPrice);

                    dblTotalPrice += (totalAddOnsPrice.HasValue) ? totalAddOnsPrice.Value : 0;
                }

                //Append Package Price.
                var packageDetails = reservationRepository.GetReservationPackageMapping(reservation.Id, null, LogInManager.LoggedInUserId);
                if (packageDetails != null && packageDetails.Count > 0)
                {
                    var totalPackagePrice = packageDetails.Where(m => m.TotalAmount.HasValue).Sum(m => m.TotalAmount);

                    dblTotalPrice += (totalPackagePrice.HasValue) ? totalPackagePrice.Value : 0;
                }
            }

            return(Math.Round(dblTotalPrice, 2));
        }
 public void SaveRates(ObservableCollection <Rate> rates)
 {
     RateRepository.Save(rates);
 }
 /// <summary>
 /// Basic constructor
 /// </summary>
 public RateController()
 {
     var data = new DataContext();
     RepositoryBase.InitRepository(data);
     this._rateRepository = RateRepository.GetInstance();
 }