void AddExpensesClicked(object sender, EventArgs e) { cost = HomeSubCtegory.homeexpenseCost; var ExpPage = new ExpensesPage(cost); Navigation.PushAsync(ExpPage); }
public async void OnSaveButtonClicked(object sender, EventArgs e) { if (ExpensesPage.SelectedCategory == "Home & Utilities") { HomeSubcatFile = Path.Combine(App.specificFolder, "HomeCategoryList2.txt"); homecost = decimal.Parse(homecatCost.Text); utilcost = decimal.Parse(UtilcatCost.Text); othercost = decimal.Parse(otherCost.Text); SubCat1 = Subcat1.Text; SubCat2 = Subcat2.Text; SubCat3 = Subcat3.Text; homeexpenseCost = homecost + utilcost + othercost; TotalHomeExp = homeexpenseCost; creationdate = File.GetLastAccessTime(HomeSubcatFile); data = SubCat1 + ":" + homecost + ":" + SubCat2 + ":" + utilcost + ":" + SubCat3 + ":" + othercost + ":" + creationdate; string categorydata = SubCat1 + "," + homecost + "," + SubCat2 + "," + utilcost + "," + SubCat3 + "," + othercost; File.WriteAllText(HomeSubcatFile, categorydata); WriteCategoryCost(); WriteCatandSubCatDetailsToFile(); } if (ExpensesPage.SelectedCategory == "Insurance") { HomeSubcatFile = Path.Combine(App.specificFolder, "Insurance2.txt"); homecost = decimal.Parse(homecatCost.Text); utilcost = decimal.Parse(UtilcatCost.Text); othercost = decimal.Parse(otherCost.Text); SubCat1 = Subcat1.Text; SubCat2 = Subcat2.Text; SubCat3 = Subcat3.Text; homeexpenseCost = homecost + utilcost + othercost; TotalInsuranceExp = homeexpenseCost; creationdate = File.GetLastAccessTimeUtc(HomeSubcatFile); data = SubCat1 + ":" + homecost + ":" + SubCat2 + ":" + utilcost + ":" + SubCat3 + ":" + othercost + ":" + creationdate; string categorydata = SubCat1 + "," + homecost + "," + SubCat2 + "," + utilcost + "," + SubCat3 + "," + othercost; File.WriteAllText(HomeSubcatFile, categorydata); WriteCategoryCost(); WriteCatandSubCatDetailsToFile(); } if (ExpensesPage.SelectedCategory == "Food") { HomeSubcatFile = Path.Combine(App.specificFolder, "Food2.txt"); homecost = decimal.Parse(homecatCost.Text); utilcost = decimal.Parse(UtilcatCost.Text); othercost = decimal.Parse(otherCost.Text); SubCat1 = Subcat1.Text; SubCat2 = Subcat2.Text; SubCat3 = Subcat3.Text; homeexpenseCost = homecost + utilcost + othercost; TotalFoodExp = homeexpenseCost; creationdate = File.GetLastAccessTimeUtc(HomeSubcatFile); data = SubCat1 + ":" + homecost + ":" + SubCat2 + ":" + utilcost + ":" + SubCat3 + ":" + othercost + ":" + creationdate; string categorydata = SubCat1 + "," + homecost + "," + SubCat2 + "," + utilcost + "," + SubCat3 + "," + othercost; File.WriteAllText(HomeSubcatFile, categorydata); WriteCategoryCost(); WriteCatandSubCatDetailsToFile(); } if (ExpensesPage.SelectedCategory == "Travel") { HomeSubcatFile = Path.Combine(App.specificFolder, "Travel2.txt"); homecost = decimal.Parse(homecatCost.Text); utilcost = decimal.Parse(UtilcatCost.Text); othercost = decimal.Parse(otherCost.Text); SubCat1 = Subcat1.Text; SubCat2 = Subcat2.Text; SubCat3 = Subcat3.Text; homeexpenseCost = homecost + utilcost + othercost; TotalTravelExp = homeexpenseCost; creationdate = File.GetLastAccessTimeUtc(HomeSubcatFile); data = SubCat1 + ":" + homecost + ":" + SubCat2 + ":" + utilcost + ":" + SubCat3 + ":" + othercost + ":" + creationdate; string categorydata = SubCat1 + "," + homecost + "," + SubCat2 + "," + utilcost + "," + SubCat3 + "," + othercost; File.WriteAllText(HomeSubcatFile, categorydata); WriteCategoryCost(); WriteCatandSubCatDetailsToFile(); } if (ExpensesPage.SelectedCategory == "Groceries") { HomeSubcatFile = Path.Combine(App.specificFolder, "Groceries2.txt"); homecost = decimal.Parse(homecatCost.Text); utilcost = decimal.Parse(UtilcatCost.Text); othercost = decimal.Parse(otherCost.Text); SubCat1 = Subcat1.Text; SubCat2 = Subcat2.Text; SubCat3 = Subcat3.Text; homeexpenseCost = homecost + utilcost + othercost; TotalGroceriesExp = homeexpenseCost; creationdate = File.GetLastAccessTimeUtc(HomeSubcatFile); data = SubCat1 + ":" + homecost + ":" + SubCat2 + ":" + utilcost + ":" + SubCat3 + ":" + othercost + ":" + creationdate; string categorydata = SubCat1 + "," + homecost + "," + SubCat2 + "," + utilcost + "," + SubCat3 + "," + othercost; File.WriteAllText(HomeSubcatFile, categorydata); WriteCategoryCost(); WriteCatandSubCatDetailsToFile(); } if (ExpensesPage.SelectedCategory == "Shopping & Entertainment") { HomeSubcatFile = Path.Combine(App.specificFolder, "ShoppingEntertainment2.txt"); homecost = decimal.Parse(homecatCost.Text); utilcost = decimal.Parse(UtilcatCost.Text); othercost = decimal.Parse(otherCost.Text); SubCat1 = Subcat1.Text; SubCat2 = Subcat2.Text; SubCat3 = Subcat3.Text; homeexpenseCost = homecost + utilcost + othercost; TotalShoppingExp = homeexpenseCost; creationdate = File.GetLastAccessTimeUtc(HomeSubcatFile); data = SubCat1 + ":" + homecost + ":" + SubCat2 + ":" + utilcost + ":" + SubCat3 + ":" + othercost + ":" + creationdate; string categorydata = SubCat1 + "," + homecost + "," + SubCat2 + "," + utilcost + "," + SubCat3 + "," + othercost; File.WriteAllText(HomeSubcatFile, categorydata); WriteCategoryCost(); WriteCatandSubCatDetailsToFile(); } if (ExpensesPage.SelectedCategory == "Cash, Checks & Misc") { HomeSubcatFile = Path.Combine(App.specificFolder, "MiscList2.txt"); homecost = decimal.Parse(homecatCost.Text); utilcost = decimal.Parse(UtilcatCost.Text); othercost = decimal.Parse(otherCost.Text); SubCat1 = Subcat1.Text; SubCat2 = Subcat2.Text; SubCat3 = Subcat3.Text; homeexpenseCost = homecost + utilcost + othercost; TotalMiscExp = homeexpenseCost; creationdate = File.GetLastAccessTimeUtc(HomeSubcatFile); data = SubCat1 + ":" + homecost + ":" + SubCat2 + ":" + utilcost + ":" + SubCat3 + ":" + othercost + ":" + creationdate; string categorydata = SubCat1 + "," + homecost + "," + SubCat2 + "," + utilcost + "," + SubCat3 + "," + othercost; File.WriteAllText(HomeSubcatFile, categorydata); WriteCategoryCost(); WriteCatandSubCatDetailsToFile(); } // var exp = (Expenses)BindingContext; // var homeExp = (HomeSubCtegory)BindingContext; // List<string> filesList = Directory.GetFiles(App.specificFolder).ToList(); // Console.WriteLine(filesList); // Expenses.homeExpenseCost = homeexpenseCost ; // AddExpenses.TotalExpensesCost = TotalHomeExp + TotalFoodExp + TotalGroceriesExp + TotalInsuranceExp + // TotalTravelExp + TotalShoppingExp + TotalMiscExp; // TotalExpenses = Path.Combine(App.specificFolder, "TotalExpenses.txt"); // File.WriteAllText(TotalExpenses, (AddExpenses.TotalExpensesCost).ToString()); var expensePage = new ExpensesPage(homeexpenseCost); await Navigation.PushAsync(expensePage); // item.expenseCost = Expenses.homeExpenseCost; Expenses.isFileLoaded = true; }
private void OnCancelButtonClicked(object sender, EventArgs e) { var ExpPage = new ExpensesPage(homeexpenseCost); Navigation.PushAsync((ExpPage)); }