Exemple #1
0
        public decimal CalculateInterestEarned(DateTime processingDate)
        {
            var savingsDepositInterestRatePerAnnum   = GlobalSettings.RateOfInterestOnSavingsDeposit;
            var savingsDepositInterestEarnedPerAnnum = Amount * savingsDepositInterestRatePerAnnum;
            var savingsDepositInterestEarnedPerDay   = savingsDepositInterestEarnedPerAnnum /
                                                       CountDaysInBetweenDates(DateIn, DateIn.AddYears(1));

            var timeDepositInterestEarnedPerAnnum = Amount * Rate;
            var timeDepositInterestEarnedPerDay   = timeDepositInterestEarnedPerAnnum /
                                                    CountDaysInBetweenDates(DateIn, DateIn.AddYears(1));

            if (IsMature(processingDate))
            {
                // get days until maturity
                var timeDepositDays           = CountDaysInBetweenDates(DateIn, Maturity);
                var timeDepositInterestEarned = timeDepositInterestEarnedPerDay * timeDepositDays;

                // get days a day after maturity until processing date
                var daysAfterMaturity = CountDaysInBetweenDates(Maturity.AddDays(1), processingDate);
                if (daysAfterMaturity >= 1)
                {
                    timeDepositInterestEarned += savingsDepositInterestEarnedPerDay * daysAfterMaturity;
                }
                return(Math.Round(timeDepositInterestEarned));
            }

            // premature
            return(Math.Round(savingsDepositInterestEarnedPerDay * CountDaysInBetweenDates(DateIn, processingDate)));
        }
Exemple #2
0
        //public static IQueryable<T> EnforceAgeAndOwner<T>(
        //    this IQueryable<T> source,
        //    Maturity maturity)
        //    where T : class
        //{
        //    //return source.Annotate(Expression.Constant(notes));
        //    var method = _enforceAgeAndOwner.MakeGenericMethod(typeof(T));

        //    return source
        //        //.IgnoreQueryFilters() // should you have GlobalFilters
        //        .Provider.CreateQuery<T>(
        //        Expression.Call(
        //            null,
        //            method,
        //            new Expression[] { source.Expression,
        //                Expression.Constant(maturity) }
        //            ));
        //}


        // this overload takes a DbSet<T> so that it will
        // be the first call found from the visitor
        public static IQueryable <T> EnforceAgeAndOwner <T>(
            this IQueryable <T> source,
            string username, Maturity usernameMaturity)
            where T : class
        {
            if (username == null)
            {
                return(source);
            }

            var method = _enforceAgeAndOwner.MakeGenericMethod(typeof(T));

            return(source
                   //.IgnoreQueryFilters() // should you have GlobalFilters
                   .Provider.CreateQuery <T>(
                       Expression.Call(
                           null,
                           method,
                           new Expression[]
            {
                source.Expression,
                Expression.Constant(username),
                Expression.Constant(usernameMaturity)
            })
                       ));
        }
 public ActionResult MaturityGridViewPartialUpdate(Maturity item)
 {
     using (var db = new InnosixEntities())
     {
         var model = db.Maturity;
         if (ModelState.IsValid)
         {
             try
             {
                 var modelItem = model.FirstOrDefault(it => it.Id == item.Id);
                 if (modelItem != null)
                 {
                     UpdateModel(modelItem);
                     db.SaveChanges();
                 }
             }
             catch (Exception e)
             {
                 ViewData["EditError"] = e.Message;
             }
         }
         else
         {
             ViewData["EditError"] = "Please, correct all errors.";
         }
         return(PartialView("_MaturityGridViewPartial", model.ToList()));
     }
 }
Exemple #4
0
        public MaturityTests()
        {
            var list = MaturityDataFile.ParseYaml().Load <Maturity>();

            human = list.First(x => x.Name == "human");
            dwarf = list.First(x => x.Name == "dwarf");
        }
        public StreamingContent(string title, string description, Maturity maturityRating, double stars, GenreType genre)

        {
            Title          = title;
            Description    = description;
            MaturityRating = maturityRating;
            StarRating     = stars;
            GenreType      = genre;
        }
Exemple #6
0
        private void button1_Click(object sender, EventArgs e)         //opret ordning
        {
            try
            {
                customerName      = Convert.ToString(customerNameTextBox.Text);
                birthdate         = Convert.ToString(FødselsDatoTextBox.Text);
                premiumPrMaturity = Convert.ToInt32(premiumTextBox.Text);
                maturity          = (Maturity)maturityComboBox.SelectedItem;
                expirationYear    = Convert.ToInt32(expiryTextBox.Text);
                startDate         = startDateSelector.Value;
                isthereRate       = (isThereRatePensionCheckBox.Checked == true) ? true : false;
                if (isthereRate)
                {
                    rateYear    = Convert.ToInt32(rateYearTextBox.Text);
                    maxRateYear = Convert.ToInt32(maxRateTextBox.Text);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Der er fejl i indtastningen", "Fejl i indtastning", MessageBoxButtons.OK);
            }


            //Opret Kunde
            try
            {
                customer = new Customer(customerName, birthdate);
            }
            catch (Exception)
            {
                MessageBox.Show("Der er fejl i navn eller fødselsdag", "Fejl i navn eller fødselsdag", MessageBoxButtons.OK);
                throw;
            }

            //Opret ordning
            try
            {
                pensionScheme = new PensionScheme(customer,
                                                  new DepositAccount(),
                                                  new Premium(premiumPrMaturity, maturity),
                                                  expirationYear,
                                                  startDate,
                                                  PensionsSchemeNumber.Instance);
                CreationLabel.Text = "Ordning med nummer: " + pensionScheme.PensionsSchemeNumber + " Er oprettet.";

                if (isthereRate == true)
                {
                    pensionScheme.DepositAccount.AddRatePension(maxRateYear, rateYear);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Der er fejl i pensionsinfo", "Fejl i pensionsinfo", MessageBoxButtons.OK);
                throw;
            }
        }
        public void SetMaturityRating_ShouldGetCorrectFamilyFriendly(Maturity rating, bool expectedFamilyFriendly)
        {
            StreamingContent content = new StreamingContent();

            content.MaturityRating = rating;
            bool actual   = content.IsFamilyFriendly;
            bool expected = expectedFamilyFriendly;

            Assert.AreEqual(actual, expected);
        }
        /// <summary>
        /// Compute maturity values for type A policy
        /// </summary>
        /// <param name="policy">Policy properties</param>
        /// <returns>Maturity value</returns>
        private Maturity ComputeMaturityForTypeA(Policy policy)
        {
            long bonus = policy.Date < new DateTime(1990, 1, 1) ? policy.DiscretionaryBonus : 0;

            Maturity policyMaturityValue = new Maturity
            {
                Number = policy.Number,
                Value  = TruncateDecimal(((policy.Premiums - (policy.Premiums * ManagementFeeTypeA)) + bonus) * (policy.UpliftPercentage / 100 + 1), 2)
            };

            return(policyMaturityValue);
        }
 /// <summary>
 /// Convert Maturity model
 /// </summary>
 /// <param name="model">Maturity details</param>
 /// <returns>Maturity details</returns>
 public static DataAccess.Models.Maturity ConvertObject(Maturity model)
 {
     return(model == null ? null : new DataAccess.Models.Maturity
     {
         Date = model.Date,
         DiscretionaryBonus = model.DiscretionaryBonus,
         Membership = model.Membership,
         Number = model.Number,
         Premiums = model.Premiums,
         UpliftPercentage = model.UpliftPercentage,
         Value = model.Value
     });
 }
Exemple #10
0
 public bool Edit(Maturity obj)
 {
     try
     {
         _context.Maturity.Update(obj);
         _context.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #11
0
 public bool Create(Maturity obj)
 {
     try
     {
         obj.Id = Guid.Empty;
         _context.Maturity.Add(obj);
         _context.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #12
0
    public void Mature()
    {
        switch (maturity)
        {
        case Maturity.sapling:
            maturity = Maturity.young;
            break;

        case Maturity.young:
            maturity = Maturity.mature;
            break;
        }
        actionPoint++;
    }
Exemple #13
0
        public void AssignsAnAgeToACharacterBasedOnClassAndMaturity()
        {
            var cls      = ClassDevelopmentAge.Young;
            var maturity = new Maturity();

            maturity.Adulthood = 15;
            maturity.Young     = DiceStrings.ParseDice("1d4");

            var assignAges = new AssignAge();
            var age        = assignAges.RandomAge(cls, maturity);

            Assert.GreaterOrEqual(age, 16);
            Assert.LessOrEqual(age, 19);
        }
Exemple #14
0
        public int RandomAge(ClassDevelopmentAge classDevAge, Maturity maturity)
        {
            switch (classDevAge)
            {
            case ClassDevelopmentAge.Young:
                return(maturity.Adulthood + maturity.Young.Roll());

            case ClassDevelopmentAge.Trained:
                return(maturity.Adulthood + maturity.Trained.Roll());

            case ClassDevelopmentAge.Studied:
                return(maturity.Adulthood + maturity.Studied.Roll());
            }
            return(0);
        }
Exemple #15
0
 public void ConvertDates()
 {
     {
         DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0);
         if (maturityDate != 0)
         {
             Maturity          = epoch.AddMilliseconds(maturityDate).ToLocalTime();
             maturityShortDate = Maturity.ToShortDateString();
         }
         if (startDate != 0)
         {
             Start          = epoch.AddMilliseconds(startDate).ToLocalTime();
             startShortDate = Start.ToShortDateString();
         }
     }
 }
Exemple #16
0
        protected override void Execute(NativeActivityContext context)
        {
            //set env environment variables
            var steps =
                XElement.Parse("<AutoX.Steps  OnError=\"" + ErrorLevel + "\" InstanceId=\"" + InstanceId + "\"/>");
            var setEnv = XElement.Parse("<Step />");

            setEnv.SetAttributeValue(Constants.ACTION, Constants.SET_ENV);

            //Description += "\nProperties:\n";
            foreach (PropertyDescriptor propertyDescriptor in context.DataContext.GetProperties())
            {
                setEnv.SetAttributeValue(propertyDescriptor.Name, propertyDescriptor.GetValue(context.DataContext));
                //Description += propertyDescriptor.Name + " : " +
                //               propertyDescriptor.GetValue(context.DataContext) + ";";
            }
            var _config = Host.GetConfig();

            //Description += "\nVariables From Configuration:\n";
            foreach (var variable in _config.GetList())
            {
                if (variable.Key.Contains(":"))
                {
                    continue;
                }
                try
                {
                    setEnv.SetAttributeValue(variable.Key, variable.Value);
                    //Description += variable.Key + " : " + variable.Value + ";";
                }
                catch (Exception e)
                {
                    Log.Warn(ExceptionHelper.FormatStackTrace("Set Env attributes setting failed: key[" + variable.Key + "] value[" + variable.Value + "]", e));
                }
            }
            //Description += "\n";
            steps.Add(setEnv);
            Host.SetCommand(steps);
            Host.GetResult();
            //add a result level here
            Result = new XElement(Constants.RESULT);
            SetResult();
            SetVariablesBeforeRunning(context);
            InternalExecute(context, null);
            SetFinalResult("Maturity", Maturity.ToString());
        }
Exemple #17
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (Blockchain.Length != 0)
        {
            hash ^= Blockchain.GetHashCode();
        }
        if (Address.Length != 0)
        {
            hash ^= Address.GetHashCode();
        }
        if (Amount.Length != 0)
        {
            hash ^= Amount.GetHashCode();
        }
        if (Interest.Length != 0)
        {
            hash ^= Interest.GetHashCode();
        }
        if (Maturity.Length != 0)
        {
            hash ^= Maturity.GetHashCode();
        }
        if (Fee.Length != 0)
        {
            hash ^= Fee.GetHashCode();
        }
        if (Expiration != 0UL)
        {
            hash ^= Expiration.GetHashCode();
        }
        if (Block.Length != 0)
        {
            hash ^= Block.GetHashCode();
        }
        if (Sighash.Length != 0)
        {
            hash ^= Sighash.GetHashCode();
        }
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
Exemple #18
0
        public void Test1()
        {
            var json = "{ \"maturity\": 5, \"somethingElse\": \"etc\"}";
            var obj  = JsonDocument.Parse(json);

            var result = obj.TryParse((double d) => Maturity.TryCreate(d));

            if (result is Right <Error, Maturity> right)
            {
                var maturity = (Maturity)right;
                Assert.Equal(5, maturity.Value);
            }
            else
            {
                Assert.True(false);
            }
        }
Exemple #19
0
        public Task <Either <Error, Nothing> > Handle(Command command, CancellationToken cancellationToken)
        => Handle(cancellationToken, command.Id.NonEmpty(), whatToDo: curveRecipe =>
                  Maturity.TryCreate(command.OutputFrequency.MaximumMaturity)
                  .MapRight(m =>
        {
            var outputFrequency = new Domain.OutputFrequency(command.OutputFrequency.OutputSeries, m);

            return(curveRecipe.Define(
                       marketCurveId: command.MarketCurveId.NonEmpty(),
                       shortName: command.ShortName.NonEmpty(),
                       description: command.Description.NonEmpty(),
                       lastLiquidTenor: command.LastLiquidTenor,
                       dayCountConvention: command.DayCountConvention,
                       interpolation: command.Interpolation,
                       extrapolationShort: command.ExtrapolationShort,
                       extrapolationLong: command.ExtrapolationLong,
                       outputFrequency: outputFrequency,
                       outputType: command.OutputType
                       ));
        })
                  );
Exemple #20
0
        void OnEventConnect(string szCode, string szMsg)
        {
            if (szCode.Equals(code) && szMsg.Equals(msg) && IsConnected())
            {
                var account = new string[GetAccountListCount()];

                for (int i = 0; i < account.Length; i++)
                {
                    account[i] = GetAccountList(i);
                }

                Models = new Dictionary <string, Codes>();
                Client = new Maturity(new string[] { key, GetType().Name });

                foreach (var ctor in new Query[] { new T8435(), new T8401(), new T8432(), new MMDAQ91200() })
                {
                    ctor.Send += OnReceiveSecuritiesAPI;
                    ctor.QueryExcute();
                }
            }
        }
 public ActionResult MaturityGridViewPartialAddNew(Maturity item)
 {
     using (var db = new InnosixEntities())
     {
         var model = db.Maturity;
         if (ModelState.IsValid)
         {
             try
             {
                 model.Add(item);
                 db.SaveChanges();
             }
             catch (Exception e)
             {
                 ViewData["EditError"] = e.Message;
             }
         }
         else
         {
             ViewData["EditError"] = "Please, correct all errors.";
         }
         return(PartialView("_MaturityGridViewPartial", model.ToList()));
     }
 }
Exemple #22
0
 public Premium(double premiumPrMaturity, Maturity maturity)
 {
     this._premium = premiumPrMaturity;
     this.Maturity = maturity;
 }
Exemple #23
0
 public Premium(double premiumPrYear, Maturity maturity)
 {
     this._depositDistribution = new DepositDistribution(false);
     this.PremiumPrYear        = premiumPrYear;
     this._maturity            = maturity;
 }
Exemple #24
0
 public void TestInitialize()
 {
     target = new Maturity();
 }
Exemple #25
0
 public Premium(double premiumPrYear, double maxOnRate, Maturity maturity)
 {
     this._depositDistribution = new DepositDistribution(maxOnRate);
     this.PremiumPrYear        = premiumPrYear;
     this._maturity            = maturity;
 }
Exemple #26
0
 // Start is called before the first frame update
 void Start()
 {
     //GetComponenet<SpriteRenderer>().sprite = sprites[0];
     maturity    = Maturity.sapling;
     actionPoint = 1;
 }
Exemple #27
0
 public void SetUp()
 {
     gateway = new RaceMaturityYamlGateway(MaturityDataFile.ParseYaml());
     human   = gateway.All().First(x => x.Name == "human");
     dwarf   = gateway.All().First(x => x.Name == "dwarf");
 }
 private Expression <Func <Article, bool> > MakeEnforceArticle(string username, Maturity maturity)
 {
     return(a =>
            a.Maturity < maturity &&
            (
                a.Owner == username ||   // owners can see all
                a.State == ArticleState.ListedForSelling ||
                (
                    a.Buyer == username &&
                    (a.State == ArticleState.Sold ||
                     a.State == ArticleState.Returned)
                )
            ));
 }
 public CheeseInfo(Maturity maturity, byte[] image)
 {
     Maturity = maturity;
     Image    = image;
 }
Exemple #30
0
 public Movie(string title, string description, Maturity rating, GenreType genre, double stars, double runTime)
     : base(title, description, rating, stars, genre)
 {
     RunTime = runTime;
 }