Ejemplo n.º 1
0
        public async Task <string> HandleAsync(FindCurrencyDefault query)
        {
            using (ReadModelContext db = readModelContextFactory.Create())
            {
                CurrencyEntity currency = await db.Currencies.WhereUserKey(query.UserKey).FirstOrDefaultAsync(c => c.IsDefault);

                return(currency?.UniqueCode);
            }
        }
Ejemplo n.º 2
0
 private Product PrepareProduct(Product product, CurrencyEntity currency)
 {
     product.Reviews    = _productRepository.GetReviewsByProduct(product.Id).Select(x => x.ReviewEntityToReview()).ToArray();
     product.Images     = _productRepository.GetImagesByProduct(product.Id).Select(x => x.PhysicalPath).ToArray();
     product.TitleImage = product.Images.FirstOrDefault(x => Path.GetFileName(x) == product.TitleImage);
     product.Price      = _productRepository.GetPricesByProduct(product.Id).FirstOrDefault(x => x.Currency == currency.Code)?.PriceEntityToPrice(currency);
     product.Properties = _productRepository.GetProductProperties(product.Id).Select(x => x.PropertyEntityToProperty()).ToArray();
     return(product);
 }
Ejemplo n.º 3
0
 public static Price PriceEntityToPrice(this PriceEntity price, CurrencyEntity currency)
 {
     return(new Price
     {
         List = Convert.ToDecimal(price.List),
         Sale = Convert.ToDecimal(price.Sale),
         Currency = currency.EntitiesToModel()
     });
 }
Ejemplo n.º 4
0
 public async Task HandleAsync(CurrencyDeleted payload)
 {
     using (ReadModelContext db = readModelContextFactory.Create())
     {
         CurrencyEntity entity = db.Currencies.WhereUserKey(payload.UserKey).First(c => c.UniqueCode == payload.UniqueCode);
         entity.IsDeleted = true;
         await db.SaveChangesAsync();
     }
 }
 private Currency ToModel(CurrencyEntity entity)
 {
     return(new  Currency()
     {
         Accuracy = entity.Accuracy,
         Id = entity.Id,
         Timestamp = entity.Timestamp,
         InterestRateMdsCode = entity.InterestRateMdsCode,
     });
 }
        public List <CurrencyEntity> LoadDataFromFile(BudgetProgressChangedEventHandler OnProgress, string fileName)
        {
            Excel.Application     ExApp      = new Excel.Application();
            Excel.Workbook        ExBook     = ExApp.Workbooks.Open(fileName);
            Excel.Worksheet       ExSheet    = ExBook.Worksheets.Item[1];
            Process[]             excelList  = ExcelUtil.GetProcesses();
            List <CurrencyEntity> entityList = new List <CurrencyEntity>();
            int count = 1;

            try
            {
                int rowIdx = 3;

                string strKey = ConvertUtil.ToString(ExSheet.Range["A" + rowIdx].Value).Trim();

                while (!BudgetResource.Resource.ExcelDataEnd.Equals(strKey, StringComparison.OrdinalIgnoreCase) &&
                       !BudgetResource.Resource.ExcelDataBlank.Equals(strKey, StringComparison.OrdinalIgnoreCase))
                {
                    string strCurrencyCode = ConvertUtil.ToString(ExSheet.Range["A" + rowIdx].Value); //Currency Code
                    string strCurrencyName = ConvertUtil.ToString(ExSheet.Range["B" + rowIdx].Value); //Currency Name
                    string strPassword     = ConvertUtil.ToString(ExSheet.Range["C" + rowIdx].Value); //Password

                    CurrencyEntity entity = new CurrencyEntity();
                    entity.CurrencyCode = strCurrencyCode.Trim(); //Currency Code
                    entity.CurrencyName = strCurrencyName.Trim(); //Currency Name
                    entity.ReadOnly     = true;
                    entity.Row          = rowIdx;
                    entityList.Add(entity);

                    if (OnProgress != null)
                    {
                        string InfomationMessage            = string.Format("you are importing No. {0} data", count);
                        int    Percentage                   = (int)((count + 1) % BudgetConstant.ProgressBarMaximum);
                        BudgetProgressChangedEventArgs args = new BudgetProgressChangedEventArgs(InfomationMessage, Percentage, null);
                        OnProgress(this, args);
                    }

                    rowIdx++;
                    count++;
                    strKey = ConvertUtil.ToString(ExSheet.Range["A" + rowIdx].Value).Trim();
                    Thread.Sleep(10);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                ExcelUtil.ReleaseResource(ExSheet, ExBook, ExApp);
                ExcelUtil.KillProcess(excelList);
            }
            return(entityList);
        }
        /// <summary>
        /// Update.
        /// </summary>
        /// <param name="item">The item.</param>
        public void Update(ICurrencyDto item)
        {
            var entity = new CurrencyEntity
            {
                Id             = item.Id,
                AlphabeticCode = item.AlphabeticCode
            };

            _unitOfWork.CurrencyRepository.Update(entity);
            _unitOfWork.Commit();
        }
 public void InsertData(CurrencyEntity currencyEntity)
 {
     try
     {
         _connection.InsertOrReplaceWithChildren(currencyEntity);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public void ExportDataToFile(BudgetProgressChangedEventHandler OnProgress, string fileName)
        {
            string templateFilename = Path.Combine(Application.StartupPath, "ExcelTemplate", "Currency_Template.xls");

            List <CurrencyEntity> entityList = GetDataFromDB(OnProgress);

            int count = entityList.Count;

            Excel.Application ExApp     = new Excel.Application();
            Excel.Workbook    ExBook    = ExApp.Workbooks.Open(templateFilename);
            Excel.Worksheet   ExSheet   = ExBook.Worksheets.Item[1];
            Process[]         excelList = ExcelUtil.GetProcesses();

            try
            {
                int rowIdx = 3;

                ExSheet.Range["E" + 1].Value = DateTime.Now.ToString();//Date

                for (int i = 0; i < count; i++)
                {
                    if (OnProgress != null)
                    {
                        string InfomationMessage            = string.Format("you are processing No. {0} data", i + 1);
                        int    Percentage                   = (int)((i + 1) * BudgetConstant.ProgressBarMaximum / count);
                        BudgetProgressChangedEventArgs args = new BudgetProgressChangedEventArgs(InfomationMessage, Percentage, null);
                        OnProgress(this, args);
                    }

                    CurrencyEntity entity = entityList[i];
                    ExSheet.Range["A" + rowIdx].Value = ConvertUtil.ToString(entity.CurrencyCode); //Currency Code
                    ExSheet.Range["B" + rowIdx].Value = ConvertUtil.ToString(entity.CurrencyName); //Currency Name

                    rowIdx++;

                    Thread.Sleep(10);
                }

                ExSheet.Range["A" + rowIdx].Value = BudgetResource.Resource.ExcelDataEnd;//End Flag

                ExBook.SaveCopyAs(fileName);
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                ExcelUtil.ReleaseResource(ExSheet, ExBook, ExApp);
                ExcelUtil.KillProcess(excelList);
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Takes the specified budget source property.
 /// </summary>
 /// <param name="currency">The budget source property.</param>
 /// <returns>System.Object[][].</returns>
 private object[] Take(CurrencyEntity currency)
 {
     return(new object[]
     {
         "@CurrencyID", currency.CurrencyId,
         "@CurrencyCode", currency.CurrencyCode,
         "@CurrencyName", currency.CurrencyName,
         "@Prefix", currency.Prefix,
         "@Suffix", currency.Suffix,
         "@IsMain", currency.IsMain,
         "@IsActive", currency.IsActive
     });
 }
        public void AlphabeticCode_Set_Success()
        {
            // Arrange
            const string alphabeticCode = "USD";

            // Act
            var currencyEntity = new CurrencyEntity
            {
                AlphabeticCode = alphabeticCode
            };

            // Assert
            Assert.Equal(alphabeticCode, currencyEntity.AlphabeticCode);
        }
Ejemplo n.º 12
0
        public bool SaveCurrency(CurrencyEntity currency)
        {
            var currentCurrency = _connection.Table <CurrencyEntity>().FirstOrDefault();
            var result          = 0;

            if (currentCurrency != null)
            {
                result = _connection.Update(currency);
            }
            else
            {
                currency.Id = Guid.NewGuid().ToString();
                result      = _connection.Insert(currency);
            }
            return(result != -1);
        }
Ejemplo n.º 13
0
        public Currency Get(CurrencyEntity currencyEntity)
        {
            var instance = new Currency
            {
                Base  = currencyEntity.Base,
                Date  = currencyEntity.Date,
                Rates = new Dictionary <string, decimal>()
            };

            foreach (var item in currencyEntity.Rates)
            {
                instance.Rates.Add(item.CurrencyName, item.CurrencyRate);
            }

            return(instance);
        }
        /// <summary>
        /// Updates the account category.
        /// </summary>
        /// <param name="accountCategoryEntity">The account category entity.</param>
        /// <returns>AccountCategoryResponse.</returns>
        public CurrencyResponse UpdateCurrency(CurrencyEntity currencyEntity)
        {
            var response = new CurrencyResponse {
                Acknowledge = AcknowledgeType.Success
            };

            try
            {
                if (!currencyEntity.Validate())
                {
                    foreach (string error in currencyEntity.ValidationErrors)
                    {
                        response.Message += error + Environment.NewLine;
                    }
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }
                var currencyExited = ICurrencyDao.GetCurrenciesByCurrencyCode(currencyEntity.CurrencyCode);
                if (currencyExited != null)
                {
                    if (!currencyExited.CurrencyId.Equals(currencyEntity.CurrencyId))
                    {
                        response.Acknowledge = AcknowledgeType.Failure;
                        response.Message     = @"Mã tiền tệ " + currencyExited.CurrencyCode.Trim() + @" đã tồn tại!";
                        return(response);
                    }
                }

                response.Message = ICurrencyDao.UpdateCurrency(currencyEntity);
                if (!string.IsNullOrEmpty(response.Message))
                {
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }
                response.CurrencyId = currencyEntity.CurrencyId;
                return(response);
            }
            catch (Exception ex)
            {
                response.Acknowledge = AcknowledgeType.Failure;
                response.Message     = ex.Message;
                return(response);
            }
        }
 protected CountryRegionCurrencyEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _countryRegion = (CountryRegionEntity)info.GetValue("_countryRegion", typeof(CountryRegionEntity));
         if (_countryRegion != null)
         {
             _countryRegion.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _currency = (CurrencyEntity)info.GetValue("_currency", typeof(CurrencyEntity));
         if (_currency != null)
         {
             _currency.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
     }
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
Ejemplo n.º 16
0
        public async Task HandleAsync(CurrencyDefaultChanged payload)
        {
            using (ReadModelContext db = readModelContextFactory.Create())
            {
                CurrencyEntity entity = db.Currencies.WhereUserKey(payload.UserKey).FirstOrDefault(c => c.IsDefault);
                if (entity != null)
                {
                    entity.IsDefault = false;
                }

                entity = db.Currencies.WhereUserKey(payload.UserKey).FirstOrDefault(c => c.UniqueCode == payload.UniqueCode);
                if (entity != null)
                {
                    entity.IsDefault = true;
                }

                await db.SaveChangesAsync();
            }
        }
Ejemplo n.º 17
0
        public async Task Add(ICurrency currency)
        {
            using (var context = ContextFactory.CreateDbContext(null))
            {
                var entity = new CurrencyEntity
                {
                    Id     = (int)currency.Code,
                    Code   = currency.Code.ToString(),
                    Symbol = currency.Symbol,
                    Label  = currency.Label
                };

                if (await context.Currency.FindAsync(entity.Id) == null)
                {
                    await context.Currency.AddAsync(entity);

                    await context.SaveChangesAsync();
                }
            }
        }
        public CurrencyEntity Get(Currency currency)
        {
            var instance = new CurrencyEntity
            {
                Base           = currency.Base,
                Date           = currency.Date,
                Rates          = new List <RateEntity>(),
                LocalSavedDate = DateTime.Now
            };

            foreach (var item in currency.Rates)
            {
                var rate = new RateEntity
                {
                    CurrencyName = item.Key,
                    CurrencyRate = item.Value
                };

                instance.Rates.Add(rate);
            }

            return(instance);
        }
Ejemplo n.º 19
0
        public CurrencyEntity GetCurrencyDetail(int StoreId, int LoggedInUserId, int currencyID = 0)
        {
            CurrencyEntity CurrencyDetail = new CurrencyEntity();

            if (currencyID > 0)
            {
                try
                {
                    SqlParameter[] param = new SqlParameter[3];
                    param[0] = new SqlParameter("StoreId", StoreId);
                    param[1] = new SqlParameter("LoggedInUserId", LoggedInUserId);
                    param[2] = new SqlParameter("currency_id", currencyID);

                    CurrencyDetail = CurrencyEntityGenericRepository.ExecuteSQL <CurrencyEntity>("EXEC GetCurrencyDetails", param).ToList <CurrencyEntity>().FirstOrDefault();
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(CurrencyDetail);
        }
        public List <CurrencyEntity> GetCurrency(string connectionString)
        {
            List <CurrencyEntity> listCurrency = new List <CurrencyEntity>();

            using (var context = new MISAEntity(connectionString))
            {
                var categories = context.CCies.ToList();
                foreach (var result in categories)
                {
                    var currency = new CurrencyEntity
                    {
                        CurrencyCode = result.CurrencyID,
                        CurrencyName = result.CurrencyName,

                        IsMain   = result.CurrencyID.Contains("VND"),
                        IsActive = result.Inactive != true
                    };

                    listCurrency.Add(currency);
                }
            }

            return(listCurrency);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Updates the currency.
        /// </summary>
        /// <param name="currency">The currency.</param>
        /// <returns>System.String.</returns>
        public string UpdateCurrency(CurrencyEntity currency)
        {
            const string sql = "uspUpdate_Currency";

            return(Db.Update(sql, true, Take(currency)));
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Inserts the currency.
        /// </summary>
        /// <param name="currency">The currency.</param>
        /// <returns>System.Int32.</returns>
        public string InsertCurrency(CurrencyEntity currency)
        {
            const string sql = "uspInsert_Currency";

            return(Db.Insert(sql, true, Take(currency)));
        }
Ejemplo n.º 23
0
 public HttpResponseMessage CreateOrUpdateCurrency(int StoreId, int LoggedInUserId, CurrencyEntity CurrencyEntity)
 {
     try
     {
         var result = _CurrencyService.CreateOrUpdateCurrency(StoreId, LoggedInUserId, CurrencyEntity);
         return(Request.CreateResponse(HttpStatusCode.OK, result));
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 24
0
        /// <summary>
        /// The seed.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        protected override void Seed(BankingDbContext context)
        {
            var format   = Constants.DayFormat;
            var provider = CultureInfo.InvariantCulture;

            var bankMilleniumGuid = Guid.Parse("{1496DD29-14BF-4753-AACC-35203E3947B7}");
            var bankBcpGuid       = Guid.Parse("{740ED738-D34C-4918-9CD9-9EC280F3C093}");
            var bankMontepioGuid  = Guid.Parse("F8C95B7D-A8EA-4FE6-95B5-930122E9A5A2");
            var bankCaixaGuid     = Guid.Parse("752ABB7E-FECE-4673-B561-690C56FC44D2");

            var bankMillenium = new BankEntity {
                Code = bankMilleniumGuid, Name = "Bank Millennium", Country = "Pl", Swift = "BIGBPLPW", Url = "http://www.bankmillennium.pl"
            };
            var bankBcp = new BankEntity {
                Code = bankBcpGuid, Name = "Millennium BCP", Country = "Pt", Swift = "MillePt", Url = "http://www.millenniumbcp.pt"
            };
            var bankMontepio = new BankEntity {
                Code = bankMontepioGuid, Name = "Montepio Geral", Country = "Pt", Swift = "MPIOPTPL", Url = "http://www.montepio.pt"
            };
            var bankCaixa = new BankEntity {
                Code = bankCaixaGuid, Name = "Caixa Geral de Depositos", Country = "Pt", Swift = "caixa", Url = "http://www.cgd.pt"
            };

            var euro = new CurrencyEntity {
                Currency = Constants.Eur, Order = 1, Name = "Euro", ReasonToOneEuro = 0
            };
            var pln = new CurrencyEntity {
                Currency = "Pln", Order = 2, Name = "Zloty", ReasonToOneEuro = 4.20m
            };

            context.SeedAddOrUpdate(
                p => p.Code,
                p => new { p.Country, p.Name, p.Swift, p.Url, p.ChangeAt },
                bankMillenium,
                bankBcp,
                bankMontepio,
                bankCaixa);

            context.SeedAddOrUpdate(
                p => p.Currency,
                p => new { p.ReasonToOneEuro, p.Order, p.ChangeAt },
                euro,
                pln,
                new CurrencyEntity {
                Currency = "USD", Name = "Dollar", Order = 3, ReasonToOneEuro = 1.20m
            });

            var goncaloGuid = Guid.Parse("9B8B32D1-A950-4C11-B77D-6FEFFAA4C17B");
            var guiGuid     = Guid.Parse("AF47E41B-344A-42AA-AEFF-07FE41E5D53C");
            var vascoGuid   = Guid.Parse("C7EC913C-95A7-4BAC-9C2E-96A5E5B9C420");
            var isildaGuid  = Guid.Parse("99B84DE3-2D7F-4D56-9592-092CEBA834B8");
            var filipaGuid  = Guid.Parse("43E1428A-454B-4E6F-B83E-5E44BD28346D");

            var goncaloUser = new UserEntity
            {
                Code     = goncaloGuid,
                Name     = "Goncalo",
                Surname  = "Gaspar",
                Email    = "*****@*****.**",
                IdNumber = "xxxxx",
                IdNumberExpirationDate = DateTime.Today.AddYears(2),
                Nif        = "xxxYYyyyx",
                HealthCare = "xxxxx",
                HealthCareExpirationDate = DateTime.Today.AddMonths(-5).AddDays(5),
                SocialSecurity           = "xxxxxx",
            };

            context.SeedAddOrUpdate(
                p => p.Code,
                p =>
                new
            {
                p.Name,
                p.Surname,
                p.Email,
                p.IdNumber,
                p.IdNumberExpirationDate,
                p.Passport,
                p.PassportExpirationDate,
                p.Nif,
                p.HealthCare,
                p.HealthCareExpirationDate,
                p.SocialSecurity,
                p.ChangeAt
            },
                goncaloUser);

            var goncaloPerson = new PersonEntity {
                Code = goncaloGuid, Name = "Goncalo", Surname = "Gaspar", Email = "*****@*****.**", IsArchived = false, OwnerCode = goncaloGuid
            };
            var guilhermePerson = new PersonEntity {
                Code = guiGuid, Name = "Guilherme", Surname = "Gaspar", Email = "*****@*****.**", IsArchived = false, OwnerCode = goncaloGuid
            };
            var vascoPerson = new PersonEntity {
                Code = vascoGuid, Name = "Vasco", Surname = "Gaspar", Email = "*****@*****.**", IsArchived = false, OwnerCode = goncaloGuid
            };
            var isildaPerson = new PersonEntity {
                Code = isildaGuid, Name = "Isilda", Surname = "Gaspar", Email = "*****@*****.**", IsArchived = false, OwnerCode = goncaloGuid
            };
            var filipaPerson = new PersonEntity {
                Code = filipaGuid, Name = "Filipa", Surname = "Viegas", Email = "*****@*****.**", IsArchived = false, OwnerCode = goncaloGuid
            };

            context.SeedAddOrUpdate(
                p => p.Code,
                p => new { p.Name, p.Surname, p.Email, p.IsArchived, p.IsMe, p.ChangeAt },
                goncaloPerson,
                guilhermePerson,
                vascoPerson,
                isildaPerson,
                filipaPerson);

            var currentGoncaloGuid = Guid.Parse("303B2432-C710-4DD6-A034-17EB10793CEB");

            var currentGoncalo = new CurrentAccountEntity
            {
                Code        = currentGoncaloGuid,
                Description = "Conta ordenado",
                Number      = "029.10.012311-5",
                Iban        = "PT50.0036.0029.99100123115.13",
                Currency    = Constants.Eur,
                Amount      = 462.52m,
                StartDate   = DateTime.ParseExact("01/02/2008", format, provider),
                Holder      = goncaloGuid,
                Owner       = goncaloGuid,
                Bank        = bankMontepioGuid,
                IsArchived  = false
            };

            var currentPlGoncaloGuid = Guid.Parse("28244669-e675-4f28-bfeb-3074eb556c40");

            var currentPlGoncalo = new CurrentAccountEntity
            {
                Code        = currentPlGoncaloGuid,
                Description = "Conta Polonia",
                Number      = "0247914561",
                Iban        = "PL92.1160.2202.00000002479145.61",
                Currency    = "PLN",
                Amount      = 1000.55m,
                StartDate   = DateTime.ParseExact("04/10/2013", format, provider),
                Holder      = goncaloGuid,
                Owner       = goncaloGuid,
                Bank        = bankMilleniumGuid,
                IsArchived  = false
            };

            var currentPlEuroGoncalo = new CurrentAccountEntity
            {
                Code        = Guid.Parse("BFC9DF65-8650-4925-AEFF-31BC2062C357"),
                Description = "Conta Polonia Euros",
                Number      = "0248923401",
                Iban        = "PL79.1160.2202.00000002489234.01",
                Currency    = Constants.Eur,
                Amount      = 0m,
                StartDate   = DateTime.ParseExact("21/10/2013", format, provider),
                Holder      = goncaloGuid,
                Owner       = goncaloGuid,
                Bank        = bankMilleniumGuid,
                IsArchived  = false
            };

            var currentGuiGuid = Guid.Parse("9D73C73A-7E1F-40A9-A52E-460010566B4F");

            var currentGuilherme = new CurrentAccountEntity
            {
                Code        = currentGuiGuid,
                Description = "Conta fun",
                Number      = "029.10.013309-8",
                Iban        = "PT50.0036.0029.99100133098.37",
                Currency    = Constants.Eur,
                Amount      = 707.93m,
                StartDate   = DateTime.ParseExact("01/01/2015", format, provider),
                Holder      = guiGuid,
                Owner       = goncaloGuid,
                Bank        = bankMontepioGuid,
                IsArchived  = false
            };

            var currentVasco = new CurrentAccountEntity
            {
                Code        = Guid.Parse("4F248CC3-73FC-47D8-B772-49EF64E35D4D"),
                Description = "Conta Corrente",
                Number      = "63566423095",
                Iban        = "PT50.0035.0995.00635664230.95",
                Currency    = Constants.Eur,
                Amount      = 0,
                StartDate   = DateTime.Today.AddYears(-2),
                Holder      = vascoGuid,
                Owner       = goncaloGuid,
                Bank        = bankCaixaGuid,
                IsArchived  = false
            };

            var currentFilipa = new CurrentAccountEntity
            {
                Code        = Guid.Parse("DF756217-78C0-4877-BB7B-E210A88603C0"),
                Description = "Conta Corrente",
                Number      = "4956598449",
                Iban        = "PT50.0033.0000.00049565984.49",
                Currency    = Constants.Eur,
                Amount      = 0m,
                StartDate   = DateTime.Today.AddYears(-2),
                Holder      = filipaGuid,
                Owner       = goncaloGuid,
                Bank        = bankBcpGuid,
                IsArchived  = false
            };

            var loanGoncalo = new LoanAccountEntity
            {
                Code               = Guid.Parse("f03f8057-e33e-4ebd-8b50-7005d8bd2188"),
                Description        = "Conta Casa",
                Number             = "029.21.100472-5",
                Currency           = Constants.Eur,
                Amount             = 47580.38m,
                StartDate          = DateTime.ParseExact("23/07/2008", format, provider),
                Holder             = goncaloGuid,
                Owner              = goncaloGuid,
                Bank               = bankMontepioGuid,
                InitialAmount      = 70000,
                PremiumPercentage  = 0,
                InterestNetRate    = 0.189m,
                LoanEndDate        = DateTime.ParseExact("28/07/2033", format, provider),
                LoanInterestRate   = 5.441m,
                LoanRelatedAccount = currentGoncaloGuid,
                IsArchived         = false
            };

            var loan2Goncalo = new LoanAccountEntity
            {
                Code               = Guid.Parse("5e919e86-0d5a-4eca-b805-0a22471443cb"),
                Description        = "Conta Carro",
                Number             = "029.27.100168-6",
                Currency           = Constants.Eur,
                Amount             = 23618.64m,
                StartDate          = DateTime.ParseExact("16/07/2010", format, provider),
                Holder             = goncaloGuid,
                Owner              = goncaloGuid,
                Bank               = bankMontepioGuid,
                InitialAmount      = 38500,
                PremiumPercentage  = 0,
                InterestNetRate    = 3.298m,
                LoanEndDate        = DateTime.ParseExact("16/07/2033", format, provider),
                LoanInterestRate   = 4.328m,
                LoanRelatedAccount = currentGoncaloGuid,
                IsArchived         = false
            };

            var savingGoncalo = new SavingAccountEntity
            {
                Code                   = Guid.Parse("ec7bdd2c-a3fe-42f0-9e91-b2e4333b9ae9"),
                Description            = "Poupanca Activa",
                Number                 = "732.15.420299-6",
                Currency               = Constants.Eur,
                Amount                 = 1058.38m,
                StartDate              = DateTime.ParseExact("03/08/2016", format, provider),
                Holder                 = goncaloGuid,
                Owner                  = goncaloGuid,
                Bank                   = bankMontepioGuid,
                AutomaticRenovation    = AutomaticRenovation.No,
                InterestCapitalization = true,
                InterestPayment        = Cadence.Yearly,
                SavingEndDate          = DateTime.ParseExact("03/08/2017", format, provider),
                SavingInterestRate     = 0.8m,
                SavingRelatedAccount   = currentGoncaloGuid,
                IsArchived             = false
            };

            var savingGui = new SavingAccountEntity
            {
                Code                   = Guid.Parse("AA111116-70F2-47CC-9C21-01A161D10D92"),
                Description            = "Poupanca Bue",
                Number                 = "732.15.417187-8",
                Currency               = Constants.Eur,
                Amount                 = 400.00m,
                StartDate              = DateTime.ParseExact("08/07/2015", format, provider),
                Holder                 = guiGuid,
                Owner                  = goncaloGuid,
                Bank                   = bankMontepioGuid,
                AutomaticRenovation    = AutomaticRenovation.YesSamePeriod,
                InterestCapitalization = false,
                InterestPayment        = Cadence.Yearly,
                SavingEndDate          = DateTime.ParseExact("08/07/2016", format, provider),
                SavingInterestRate     = 1.0m,
                SavingRelatedAccount   = currentGuiGuid,
                IsArchived             = false
            };

            var saving2Gui = new SavingAccountEntity
            {
                Code                   = Guid.Parse("7D2E570A-BBC3-41D6-B2E3-B47BB491D60C"),
                Description            = "Poupanca Bue",
                Number                 = "732.15.430705-0",
                Currency               = Constants.Eur,
                Amount                 = 250.00m,
                StartDate              = DateTime.ParseExact("13/11/2015", format, provider),
                Holder                 = guiGuid,
                Owner                  = goncaloGuid,
                Bank                   = bankMontepioGuid,
                AutomaticRenovation    = AutomaticRenovation.YesSamePeriod,
                InterestCapitalization = false,
                InterestPayment        = Cadence.Yearly,
                SavingEndDate          = DateTime.ParseExact("13/11/2017", format, provider),
                SavingInterestRate     = 1.0m,
                SavingRelatedAccount   = currentGuiGuid,
                IsArchived             = false
            };

            context.SeedAddOrUpdate(
                p => p.Code,
                p => new { p.Description, p.Number, p.Iban, p.Amount, p.ChangeAt, p.IsArchived },
                currentGoncalo,
                currentGuilherme,
                currentVasco,
                currentFilipa,
                currentPlGoncalo,
                currentPlEuroGoncalo);

            context.SeedAddOrUpdate(
                p => p.Code,
                p => new { p.Description, p.Number, p.Amount, p.ChangeAt, InicialAmount = p.InitialAmount, p.InterestNetRate, p.LoanEndDate, p.LoanInterestRate, p.PremiumPercentage, p.LoanRelatedAccount, p.IsArchived },
                loanGoncalo,
                loan2Goncalo);

            context.SeedAddOrUpdate(
                p => p.Code,
                p => new { p.Description, p.Number, p.Amount, p.ChangeAt, p.InterestCapitalization, p.SavingEndDate, p.SavingInterestRate, p.SavingRelatedAccount, p.IsArchived },
                savingGoncalo,
                savingGui,
                saving2Gui);

            var visa = new CreditCardEntity
            {
                Code         = Guid.Parse("951C4C66-EA1C-4285-B122-308CDF0243D5"),
                CardNumber   = "5731",
                CardProvider = CardProvider.Visa,
                Description  = "Visa Cinza",
                PaymentDay   = 7,
                Limit        = 1000,
                UsedLimit    = 300,
                Expire       = DateTime.ParseExact("31/01/2020", format, provider),
                Account      = currentGoncaloGuid,
                Bank         = bankMontepioGuid,
                Currency     = Constants.Eur,
                Holder       = goncaloGuid,
                Owner        = goncaloGuid,
                IsArchived   = false
            };

            context.SeedAddOrUpdate(
                p => p.Code,
                p => new { p.Description, p.Code, p.CardNumber, p.PaymentDay, p.Limit, p.UsedLimit, p.Expire, p.Account, p.Bank, p.Currency, p.Holder, p.Owner, p.ChangeAt },
                visa);

            var currentMontepio = new DebitCardEntity
            {
                Code         = Guid.Parse("B22056AC-91FD-4769-9056-E235F2757A43"),
                CardNumber   = "5594",
                CardProvider = CardProvider.VisaElectron,
                Description  = "Debito Amarelo",
                Expire       = DateTime.ParseExact("30/09/2019", format, provider),
                Account      = currentGoncaloGuid,
                Bank         = bankMontepioGuid,
                Currency     = Constants.Eur,
                Holder       = goncaloGuid,
                Owner        = goncaloGuid,
                IsArchived   = false
            };

            var currentMille = new DebitCardEntity
            {
                Code         = Guid.Parse("1C3E3692-1AD9-401D-B4AA-C06A31967A95"),
                CardNumber   = "5505",
                CardProvider = CardProvider.Visa,
                Description  = "Debito Cinza",
                Expire       = DateTime.ParseExact("30/09/2019", format, provider),
                Account      = currentPlGoncaloGuid,
                Bank         = bankMilleniumGuid,
                Currency     = "PLN",
                Holder       = goncaloGuid,
                Owner        = goncaloGuid,
                IsArchived   = false
            };

            context.SeedAddOrUpdate(
                p => p.Code,
                p => new { p.Description, p.Code, p.CardNumber, p.Expire, p.Account, p.Bank, p.Currency, p.Holder, p.Owner, p.ChangeAt, p.IsArchived },
                currentMontepio,
                currentMille);

            var preMille = new PrePaidCardEntity
            {
                Code            = Guid.Parse("283FBB3A-B988-42A7-95F6-8A377D0C9CC1"),
                CardNumber      = "9102",
                CardProvider    = CardProvider.Maestro,
                Description     = "PrePago Preto",
                Expire          = DateTime.ParseExact("31/05/2019", format, provider),
                Account         = currentPlGoncaloGuid,
                Bank            = bankMilleniumGuid,
                Currency        = "PLN",
                Holder          = goncaloGuid,
                Owner           = goncaloGuid,
                AvailableAmount = 500,
                MaximumAmount   = 500,
                IsArchived      = false
            };

            var preMontepio = new PrePaidCardEntity
            {
                Code            = Guid.Parse("905FADBF-F44D-4DFC-850D-0368DA41CF58"),
                CardNumber      = "5555",
                CardProvider    = CardProvider.VisaElectron,
                Description     = "PrePago Mae",
                Expire          = DateTime.ParseExact("31/05/2019", format, provider),
                Account         = currentGoncaloGuid,
                Bank            = bankMilleniumGuid,
                Currency        = Constants.Eur,
                Holder          = isildaGuid,
                Owner           = goncaloGuid,
                AvailableAmount = 50,
                MaximumAmount   = 1500,
                IsArchived      = false
            };

            context.SeedAddOrUpdate(
                p => p.Code,
                p => new { p.Description, p.Code, p.CardNumber, p.AvailableAmount, p.MaximumAmount, p.Expire, p.Account, p.Bank, p.Currency, p.Holder, p.Owner, p.ChangeAt, p.IsArchived },
                preMontepio,
                preMille);

            context.SaveChanges();
        }