private void InitInsert() { _incomeItems = ((List <Income>)SQLLiteHelper.Read(Tables.Incomes)).Select(x => x.Item).Distinct().ToList(); _outcomeItems = ((List <Outcome>)SQLLiteHelper.Read(Tables.Outcomes)).Select(x => x.Item).Distinct().ToList(); _categories = ((List <Category>)SQLLiteHelper.Read(Tables.Categories)).Select(x => x.Name).Distinct().ToList(); cmbCategory.DataSource = _categories; rdbIncome.Checked = true; }
private void TestWrite() { int res = SQLLiteHelper.Insert(new Outcome { Date = DateTime.Now, Item = "Test Item", Description = "Test Description", Category = 1, Amount = 12.98 }); Console.WriteLine($"Write result: {res}"); }
private void AddTransaction(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtItem.Text) || string.IsNullOrEmpty(txtAmount.Text)) { MessageBox.Show("Fill all the fields.", "ERROR", MessageBoxButtons.OK); return; } int res = SQLLiteHelper.Insert(new Outcome { Date = date.SelectionStart, Item = txtItem.Text, Description = txtDescription.Text, Category = (int)cmbCategory.SelectedItem, Amount = double.Parse(txtAmount.Text) }); }
private void TestRead() { var list = SQLLiteHelper.Read( Tables.Outcomes, new List <Condition> { new Condition { Field = Fields.Category, Value = "2" }, new Condition { Field = Fields.Amount, Value = "12.98" } } ); }
private void TestWriteMulti() { int res = SQLLiteHelper.Insert( new List <Income> { new Income { Amount = 500, Date = DateTime.Now, Item = "Stipendio" }, new Income { Amount = 2500, Date = DateTime.Now, Item = "Accredito Pensione" }, new Income { Amount = 900, Date = DateTime.Now, Item = "Sto Cazzo" } }); }