Beispiel #1
0
        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");
                    }
                }


                //
            }
        }
Beispiel #2
0
        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");
                }
            }
        }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
        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;
        }
Beispiel #5
0
        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);
            }
        }