private void InitialisingBudget() { Database_interaction db = new Database_interaction(); Budget budget = null; do { budget = db.GetBudget(DateTime.Now); float totalcost = db.GetTotalCostMonth(DateTime.Now); InvokeOnMainThread(delegate { if (budget != null) { lblmonth.Text = "This Month's Budget: " + budget.BudgetAmount.ToString(); lblRemaining.Text = "Remaining Budget: " + (budget.BudgetAmount - totalcost).ToString(); lblTotalCost.Text = "Total Cost This Month: " + totalcost.ToString(); } else { lblmonth.Text = "This Month's Budget: Not Set"; lblRemaining.Text = "Remaining Budget: 0"; lblTotalCost.Text = "Total Cost This Month: 0"; } }); Thread.Sleep(10000); } while (budget != null); }
internal void UpdateCell(ReportData report) { Database_interaction db = new Database_interaction(); Budget budget = db.GetBudget(DateTime.Now); type.Text = report.CostType; total.Text = report.CostValue.ToString(); //progressBar.MaxValue = budget.BudgetAmount; progressBar.Progress = report.CostValue / budget.BudgetAmount; //progressBar.Value = report.CostValue; }
partial void UIButton69_TouchUpInside(UIButton sender) { var textInputAlertController = UIAlertController.Create("Set Budget", "Put digit into the field", UIAlertControllerStyle.Alert); //Add Text Input textInputAlertController.AddTextField(textField => { }); //Add Actions Database_interaction db = new Database_interaction(); var cancelAction = UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, alertAction => Console.WriteLine("Cancel was Pressed")); var okayAction = UIAlertAction.Create("Okay", UIAlertActionStyle.Default, alertAction => buttonOKClicked(textInputAlertController)); textInputAlertController.AddAction(cancelAction); textInputAlertController.AddAction(okayAction); //Present Alert PresentViewController(textInputAlertController, true, null); }
partial void UIButton118_TouchUpInside(UIButton sender) { db_inter = new Database_interaction(); bool parseOK; string name = lblname.Text; string costvalue = lblcost.Text; float cost; parseOK = float.TryParse(costvalue, out cost); if (!parseOK) { UIAlertView alert1 = new UIAlertView() { Title = "Error", Message = "The Cost Must Be digit!!" }; alert1.AddButton("OK"); alert1.Show(); return; } string type = lbltype.Text; DateTime date = tempDate; //picker's time string details = lbldetails.Text; db_inter.AddCost(new Cost(name, cost, type, date, details)); //add cost UIAlertView alert2 = new UIAlertView() { Title = "Add Successfully", Message = "The Cost has been added!!" }; alert2.AddButton("OK"); alert2.Show(); }
private void buttonOKClicked(UIAlertController textInputAlertController) { Database_interaction db = new Database_interaction(); db.AddBudget(new Budget(float.Parse(textInputAlertController.TextFields[0].Text), DateTime.Now)); Budget budget = db.GetBudget(DateTime.Now); float totalcost = db.GetTotalCostMonth(DateTime.Now); if (budget != null) { lblmonth.Text = "This Month's Budget: " + budget.BudgetAmount.ToString(); lblRemaining.Text = "Remaining Budget: " + (budget.BudgetAmount - totalcost).ToString(); lblTotalCost.Text = "Total Cost This Month: " + totalcost.ToString(); } else { lblmonth.Text = "This Month's Budget: Not Set"; lblRemaining.Text = "Remaining Budget: 0"; lblTotalCost.Text = "Total Cost This Month: 0"; } }