private void button2_Click(object sender, EventArgs e) { MouseEventArgs eventargs = e as MouseEventArgs; Button button1 = sender as Button; string filename = filenameBox.Text; if (filename != "") { Tranche tranche = ReadWriteTools.ReadConditionFromTextFile(filename); capitalTextBox.Text = tranche.capital.ToString(ci); periodTextBox.Text = tranche.period.ToString(ci); assetsGrid.Rows.Clear(); foreach (var asset in tranche.assets) { assetsGrid.Rows.Add(/*this.assetsGrid.Rows.Count,*/ asset.profit.ToString(ci), asset.prob.ToString(ci)); } setRowNumber(this.assetsGrid); assetsGrid.Visible = true; } }
public static void f() { Tranche tranche = ReadWriteTools.MakeSimpleTranche(); ReadWriteTools.WriteConditionToTextFile("another_sample.txt", tranche); Tranche t = ReadWriteTools.ReadConditionFromTextFile("another_sample.txt"); ReadWriteTools.WriteConditionToTextFile("just_sample.txt", t); }
static void Main(string[] args) { CultureInfo ci = CultureInfo.CreateSpecificCulture("en-US"); if (args.Length > 0 && args[0] != "") { string filename = args[0]; //"another_sample.txt"; //args[0]; Tranche tranche = ReadWriteTools.ReadConditionFromTextFile(filename); InvestmentPlan plan = EasySolve.solve(tranche); //Console.WriteLine(answerToString(plan, ci)); String s = answerToString(plan, ci);//.Split(new char[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries); /*foreach (String t in s) * { * Console.WriteLine(t); * }*/ //Console.WriteLine(s.Count()); Console.WriteLine(s); /*ReadWriteTools.WriteConditionToFile( * "sample", * ReadWriteTools.MakeSimpleTranche() * ); * * Tranche tranche = ReadWriteTools.ReadConditionFromFile("sample"); * * * Investor investor = new Investor(tranche.period, tranche.capital, tranche.assets); * * InvestmentsSolver solver = new InvestmentsSolver(investor); * * InvestmentPlan plan = solver.TheoreticalProfitPlan(); * * foreach (Tuple<decimal, decimal> x in plan.Plan) * { * System.Console.WriteLine(x); * } * * System.Console.WriteLine(plan.GetFinalProfit());*/ } }