Esempio n. 1
0
        public void AssetClassificationContructionTest()
        {
            Debt s;
            AssetClassification ac;

            try
            {
                using (var db = new FGABusinessComponent.BusinessComponent.FGAContext("PREPROD", compiledModel))
                {
                    s = new Debt(ISIN: "AC0000000001", FinancialInstrumentName: "ClassificationSecurity 1", MaturityDate: new DateTime(2013, 1, 1), interestCoupon: new InterestCalculation(new PercentageRate(2.365), new FrequencyCode(1)));
                    db.Debts.Add(s);
                    db.SaveChanges();


                    ac = new AssetClassification("EXEMPLE");
                    ac.Classification1 = "CLASSIF1";
                    ac.Classification2 = "CLASSIF2";
                    ac.Classification3 = "CLASSIF3";
                    ac.Classification4 = "CLASSIF4";

                    s.Add(ac);

                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e);
                throw e;
            }
        }
Esempio n. 2
0
        public void IssuerRoleContructionTest()
        {
            Debt       s;
            IssuerRole role;

            try
            {
                using (var db = new FGABusinessComponent.BusinessComponent.FGAContext("PREPROD", compiledModel))
                {
                    s = new Debt(ISIN: "AC0000000001", FinancialInstrumentName: "ClassificationSecurity 1", MaturityDate: new DateTime(2013, 1, 1), interestCoupon: new InterestCalculation(new PercentageRate(2.365), new FrequencyCode(1)));
                    db.Debts.Add(s);
                    db.SaveChanges();
                    role = new IssuerRole("TOTO COMPANY", (CountryCode)"FR");
                    s.Add(role);

                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e);
                throw e;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Calculates the costs of claim and debt
        /// </summary>
        public void CostCalculation()
        {
            // CLAIM
            Claim.Clear();
            foreach (Purchase purchase in Session.Household.Purchases)
            {
                if (purchase.UserPayed.Contains(Session.User.Name))
                {
                    foreach (string user in purchase.UsersInvolved)
                    {
                        if (user != Session.User.Name)
                        {
                            if (!purchase.UsersInvolvedPayed.Contains(user))
                            {
                                if (!_claim_dictionary.ContainsKey(user))
                                {
                                    _claim_dictionary.Add(user, purchase.Price / purchase.UsersInvolved.Count);
                                }
                                else
                                {
                                    _claim_dictionary[user] += (purchase.Price / purchase.UsersInvolved.Count);
                                }
                            }
                        }
                    }
                }
            }
            foreach (KeyValuePair <string, double> entry in _claim_dictionary)
            {
                Claim.Add(new UserClaim()
                {
                    Name = entry.Key, Total = entry.Value
                });
                Netto += entry.Value;
            }

            // DEBT
            Debt.Clear();
            foreach (Purchase purchase in Session.Household.Purchases)
            {
                if (purchase.UsersInvolved.Contains(Session.User.Name) && !purchase.UsersInvolvedPayed.Contains(Session.User.Name))
                {
                    if (!_debt_dictionary.ContainsKey(purchase.UserPayed))
                    {
                        _debt_dictionary.Add(purchase.UserPayed, purchase.Price / purchase.UsersInvolved.Count);
                    }
                    else
                    {
                        _debt_dictionary[purchase.UserPayed] += (purchase.Price / purchase.UsersInvolved.Count);
                    }
                }
            }
            foreach (KeyValuePair <string, double> entry in _debt_dictionary)
            {
                Debt.Add(new UserDebt()
                {
                    Name = entry.Key, Total = entry.Value
                });
                Netto -= entry.Value;
            }
        }