private void insertBtn_Click(object sender, EventArgs e) { if (this.textBox1.Text == "" || this.dateTimePicker1.Text == "") { MessageBox.Show("please insert Data"); } else { AccountingRepository ar = new AccountingRepository(); if (ar.GetCurrentAmmount() == 0) { AccountingR i = new AccountingR(); i.Date = this.dateTimePicker1.Value.ToShortDateString(); i.Money = Convert.ToDouble(this.textBox1.Text); i.CurrentAmmount = Convert.ToDouble(this.textBox1.Text); if (ar.Insert(i)) { List <AccountingR> allResult = ar.GetAllTransiction(); this.dataGrid1.DataSource = allResult; this.textBox1.Text = ""; this.dateTimePicker1.Text = ""; } else { MessageBox.Show("Can Not Insert Transition", "Insert Error"); } } else { AccountingR i = new AccountingR(); i.Date = this.dateTimePicker1.Value.ToShortDateString(); i.Money = Convert.ToDouble(this.textBox1.Text); i.CurrentAmmount = ar.GetCurrentAmmount() + Convert.ToDouble(this.textBox1.Text); if (ar.Insert(i)) { List <AccountingR> allResult = ar.GetAllTransiction(); this.dataGrid1.DataSource = allResult; this.textBox1.Text = ""; this.dateTimePicker1.Text = ""; } else { MessageBox.Show("Can Not Insert Transition", "Insert Error"); } } // } }
private void deleteBtn_Click(object sender, EventArgs e) { if (this.textBox1.Text == "" || this.dateTimePicker1.Text == "") { MessageBox.Show("please insert Data"); } else { string date = this.dateTimePicker1.Value.ToShortDateString(); AccountingRepository ar = new AccountingRepository(); if (ar.Delete(date)) { List <AccountingR> allResult = ar.GetAllTransiction(); this.dataGrid1.DataSource = allResult; this.textBox1.Text = ""; this.dateTimePicker1.Text = ""; } else { MessageBox.Show("Can Not Delete transition", "Delete Error"); } } }
public void showChart() { AccountingRepository ar = new AccountingRepository(); List <AccountingR> allTransiction = ar.GetAllTransiction(); foreach (AccountingR a in allTransiction) { this.chart1.Series["Money"].Points.AddXY(a.Date, a.Money); } }
private void cashInTab_Click(object sender, EventArgs e) { this.dataGrid.Visible = false; this.dataGrid1.Visible = true; this.groupBox1.Visible = true; this.groupBox2.Visible = false; this.chart1.Visible = false; AccountingRepository result = new AccountingRepository(); List <AccountingR> allResult = result.GetAllTransiction(); this.dataGrid1.DataSource = allResult; }
public void showChart() { AccountingRepository ar = new AccountingRepository(); List <AccountingR> allTransiction = ar.GetAllTransiction(); foreach (var series in chart1.Series) { series.Points.Clear(); } foreach (AccountingR a in allTransiction) { //this.chart1.Series.Add("taka"); this.chart1.Series["Money"].Points.AddXY(a.Date, a.Money); } }