private async void btnCalculate_Click(object sender, EventArgs e)
        {
            CalcInterests calcInterests = new CalcInterests();

            Interest = calcInterests.CalculateSimpleInterest(tbPrincipal.Text.Trim().ToString(), tbYear.Text.Trim().ToString(), tbMonth.Text.Trim().ToString(), tbRate.Text.Trim().ToString());
            Converter converter = new Converter();

            Principal = converter.ToDouble(tbPrincipal.Text.Trim().ToString());
            Interestdata interestdata = new Interestdata
            {
                Interest   = Interest,
                Total      = Interest + Principal,
                Principal  = Principal,
                Rate       = converter.ToDouble(tbRate.Text.Trim().ToString()),
                Time_Month = (converter.ToDouble(tbYear.Text.Trim().ToString()) * 12) + converter.ToDouble(tbMonth.Text.Trim().ToString()),
            };

            if (interestDatalist == null)
            {
                List <Interestdata> list = new List <Interestdata>();
                interestDatalist = list;
            }
            interestDatalist.Add(interestdata);
            Label lb = new Label();

            lb.Location = new Point(251, 70);
            lb.Text     = Interest.ToString();
            dataGridView1.DataSource = null;
            dataGridView1.DataSource = interestDatalist;
            // Adding this label in the form
            this.Controls.Add(lb);
            //richTextBox1.Document.Blocks.Add(new Paragraph(new Run("Text")));
        }
Exemple #2
0
        // ------------------------------------------------

        public List <PaymentProperty> GetProperties()
        {
            var retVal = new List <PaymentProperty>();

            retVal.Add(new PaymentProperty()
            {
                Name = "Payment No", Value = PaymentNo.ToString()
            });;
            retVal.Add(new PaymentProperty()
            {
                Name = "Payment", Value = Payment.ToString()
            });
            retVal.Add(new PaymentProperty()
            {
                Name = "Interest", Value = Interest.ToString()
            });
            retVal.Add(new PaymentProperty()
            {
                Name = "Principle", Value = Principle.ToString()
            });
            retVal.Add(new PaymentProperty()
            {
                Name = "Insurance", Value = Insurance.ToString()
            });
            retVal.Add(new PaymentProperty()
            {
                Name = "Tax", Value = Tax.ToString()
            });
            retVal.Add(new PaymentProperty()
            {
                Name = "Balance", Value = Balance.ToString()
            });

            return(retVal);
        }
Exemple #3
0
    /// <summary>
    /// Add or update a topic-
    /// </summary>
    /// <remarks>topics-endpoint (https://developer.feedly.com/v3/topics/#add-a-topic-to-the-user-feedly-account)</remarks>
    /// <param name="topicId">The topic id.</param>
    /// <param name="interest">The interest of the topic.</param>
    /// <param name="cancellationToken">The cancellation token.</param>
    /// <returns></returns>
    /// <exception cref="System.ArgumentOutOfRangeException">Select low, medium or high for the interest.</exception>
    public async Task<bool> AddOrUpdateTopic(string topicId, Interest interest = Interest.Low, CancellationToken cancellationToken = default(CancellationToken))
    {
      if (interest == Interest.Unknown)
      {
        throw new ArgumentOutOfRangeException("Select low, medium or high for the interest.");
      }

      await Client.Request(HttpMethod.Post, "v3/topics", new { id = ValueToResource("topic", topicId, false), interest = interest.ToString().ToLower() }, true, true, cancellationToken);
      return true;
    }
Exemple #4
0
        }         // DeepClone

        public override string ToString()
        {
            return(string.Format(
                       "on {0}: {1} = p{2} + i{3} + f{4}",
                       Time.MomentStr(),
                       Amount.ToString("C2", Culture),
                       Principal.ToString("C2", Culture),
                       Interest.ToString("C2", Culture),
                       Fees.ToString("C2", Culture)
                       ));
        }         // ToString
Exemple #5
0
 public IHandler SelectHandler(string key, Type service, IHandler[] handlers)
 {
     foreach (var handler in handlers)
     {
         if (handler.ComponentModel.Name.ToUpper().Contains(Interest.ToString().ToUpper()))
         {
             return(handler);
         }
     }
     return(null);
 }
Exemple #6
0
        }         // DaysInMonth

        public override string ToString()
        {
            return(string.Format(
                       "on {0}: {1} = {2} / {3} - for {4} days",
                       Date.ToString("MMM dd yyyy", ms_oCulture),
                       Interest.ToString(ms_oCulture).PadLeft(30, ' '),
                       OriginalInterest.ToString(ms_oCulture).PadLeft(30, ' '),
                       DaysInMonth.ToString("N0", ms_oCulture),
                       PeriodLength.ToString("N0", ms_oCulture)
                       ));
        }         // ToString
Exemple #7
0
        public string ToHtml()
        {
            var row = EmbadedResources.GetEmbeddedResource("Mashkanta.Reports.TableCourseRows.html");

            row = row.Replace("@@Course@@", GetCourseTitle(Type));
            row = row.Replace("@@Amount@@", Amount.ToString("C0"));
            row = row.Replace("@@AmountPercentage@@", (LoanPercentage * 100).ToString("N0"));
            row = row.Replace("@@Interest@@", Interest.ToString("N2"));
            row = row.Replace("@@Period@@", $"{Period} חודשים ({Years} שנים)");
            row = row.Replace("@@Rcycle@@", Recycle == null ? "ללא" : "כן");
            return(row);
        }
Exemple #8
0
        private string Validate(string propertyName)
        {
            // Return error message if there is error on else return empty or null string
            string validationMessage = string.Empty;

            if (_firstLoad)
            {
                return(validationMessage);
            }
            switch (propertyName)
            {
            case "Deposit":
                if (!double.TryParse(Deposit.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "Interest":
                if (!double.TryParse(Interest.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "Withdraw":
                if (!double.TryParse(Withdraw.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "ServiceCharge":
                if (!double.TryParse(ServiceCharge.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;
            }

            return(validationMessage);
        }
        private void btnCalculate_Click(object sender, EventArgs e)
        {
            Converter converter = new Converter();

            try
            {
                CalcInterests calcInterests = new CalcInterests();
                Interest  = calcInterests.CalculateCompoundInterest(tbPrincipal.Text.Trim().ToString(), tbYear.Text.Trim().ToString(), tbMonth.Text.Trim().ToString(), tbRate.Text.Trim().ToString(), tbNoOfTimes.Text.Trim().ToString());
                Principal = converter.ToDouble(tbPrincipal.Text.Trim().ToString());
                Rate      = converter.ToDouble(tbRate.Text.Trim().ToString());
                Time      = converter.ToDouble(tbYear.Text.Trim().ToString()) * 12 + converter.ToDouble(tbMonth.Text.Trim().ToString());
                Interest  = Interest - Principal;
                Interestdata interestdata2 = new Interestdata();
                interestdata           = interestdata2;
                interestdata.Interest  = Interest;
                interestdata.Total     = Interest + Principal;
                interestdata.Principal = Principal;
                interestdata.Rate      = Rate;

                interestdata.Time_Month = Time;;
                if (interestDatalist == null)
                {
                    List <Interestdata> list = new List <Interestdata>();
                    interestDatalist = list;
                }
                interestDatalist.Add(interestdata);
                dataGridView1.DataSource = null;
                dataGridView1.DataSource = interestDatalist;
                Label lb = new Label();
                lb.Location = new Point(251, 70);
                lb.Text     = Interest.ToString();

                // Adding this label in the form
                this.Controls.Add(lb);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #10
0
        /// <summary>
        /// Add or update a topic-
        /// </summary>
        /// <remarks>topics-endpoint (https://developer.feedly.com/v3/topics/#add-a-topic-to-the-user-feedly-account)</remarks>
        /// <param name="topicId">The topic id.</param>
        /// <param name="interest">The interest of the topic.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentOutOfRangeException">Select low, medium or high for the interest.</exception>
        public async Task <bool> AddOrUpdateTopic(string topicId, Interest interest = Interest.Low, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (interest == Interest.Unknown)
            {
                throw new ArgumentOutOfRangeException("Select low, medium or high for the interest.");
            }

            await Client.Request(HttpMethod.Post, "v3/topics", new { id = ValueToResource("topic", topicId, false), interest = interest.ToString().ToLower() }, true, true, cancellationToken);

            return(true);
        }
 public IMessage GenerateCultMentionResponse(System.Random r, bool success, Interest interest)
 {
     if (success)
     {
         return(new TestMessage("I have always wondered about that and other " + interest.ToString() + "-related issues."));
     }
     return(new TestMessage("That's, uh, that's really weird."));
 }
 public IMessage GenerateCultHintResponse(System.Random r, bool success, Interest interest)
 {
     if (success)
     {
         return(new TestMessage("Oh wow I didn't realize you spent much time thinking about " + interest.ToString()));
     }
     return(new TestMessage("That's kinda weird you spend so much time thinking about " + interest.ToString()));
 }
Exemple #13
0
 public void SetInterest(Interest value)
 {
     Interest = value.ToString();
 }
Exemple #14
0
 public override string ToString()
 {
     return(string.Format("{0} i: {1,10} f: {2,10}", base.ToString(), Interest.ToString("C2", Culture), Fees.ToString("C2", Culture)));
 } // ToString
        public double CalculateCompoundInterest(double p = 0, double i = 0, double timesInYear = 0)
        {
            Converter converter = new Converter();

            try
            {
                if (p == 0)
                {
                    Principal = converter.ToDouble(tbPrincipal.Text.Trim().ToString());
                }
                else
                {
                    Principal = p;
                }
                CalcInterests calcInterests = new CalcInterests();
                if (i == 0)
                {
                    Interest = calcInterests.CalculateCompoundInterest(Principal.ToString(), tbYear.Text.Trim().ToString(), tbMonth.Text.Trim().ToString(), tbRate.Text.Trim().ToString(), tbNoOfTimes.Text.Trim().ToString());
                }
                else
                {
                    Interest = i;
                }

                Rate     = converter.ToDouble(tbRate.Text.Trim().ToString());
                Time     = converter.ToDouble(tbYear.Text.Trim().ToString()) * 12 + converter.ToDouble(tbMonth.Text.Trim().ToString());
                Interest = Interest - Principal;
                Interestdata interestdata2 = new Interestdata();
                interestdata           = interestdata2;
                interestdata.Interest  = Interest;
                interestdata.SN        = Serial;
                interestdata.Total     = Interest + Principal;
                interestdata.Principal = Principal;
                interestdata.Rate      = Rate;
                if (timesInYear == 0)
                {
                    interestdata.Time_Month = Time;;
                }
                else
                {
                    interestdata.Time_Month = timesInYear;
                }
                if (interestDatalist == null)
                {
                    List <Interestdata> list = new List <Interestdata>();
                    interestDatalist = list;
                }
                interestDatalist.Add(interestdata);
                dataGridView1.DataSource = null;
                dataGridView1.DataSource = interestDatalist;
                Label lb = new Label();
                lb.Location = new Point(251, 70);
                lb.Text     = Interest.ToString();

                // Adding this label in the form
                this.Controls.Add(lb);
                return(interestdata.Total);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(interestdata.Total);
        }
Exemple #16
0
 public override string ToString()
 {
     return($"{Month} - {Principal.ToString("C")}/{Interest.ToString("C")} - {RemainingPrincipal.ToString("C")}");
 }