Example #1
0
        private void UpdateData()
        {
            int      nowRow = dgv.CurrentRow.Index;
            DateTime oldDate
                = DateTime.Parse(dgv.Rows[nowRow].Cells[0].Value.ToString());
            string oldCategory = dgv.Rows[nowRow].Cells[1].Value.ToString();
            string oldItem     = dgv.Rows[nowRow].Cells[2].Value.ToString();
            int    oldMoney
                = int.Parse(dgv.Rows[nowRow].Cells[3].Value.ToString());
            string   oldRemarks = dgv.Rows[nowRow].Cells[4].Value.ToString();
            ItemForm frmItem    = new ItemForm(categoryDataSet1,
                                               oldDate,
                                               oldCategory,
                                               oldItem,
                                               oldMoney,
                                               oldRemarks);
            DialogResult drRet = frmItem.ShowDialog();

            if (drRet == DialogResult.OK)
            {
                dgv.Rows[nowRow].Cells[0].Value
                    = frmItem.monCalendar.SelectionRange.Start;
                dgv.Rows[nowRow].Cells[1].Value = frmItem.cmbCategory.Text;
                dgv.Rows[nowRow].Cells[2].Value = frmItem.txtItem.Text;
                dgv.Rows[nowRow].Cells[3].Value = int.Parse(frmItem.mtxtMoney.Text);
                dgv.Rows[nowRow].Cells[4].Value = frmItem.txtRemarks.Text;
            }
        }
Example #2
0
        private void AddData()
        {
            ItemForm     frmItem = new ItemForm(categoryDataSet1);
            DialogResult drRet   = frmItem.ShowDialog();

            if (drRet == DialogResult.OK)
            {
                moneyDataSet.moneyDataTable.AddmoneyDataTableRow(
                    frmItem.monCalendar.SelectionRange.Start,
                    frmItem.cmbCategory.Text,
                    frmItem.txtItem.Text,
                    int.Parse(frmItem.mtxtMoney.Text),
                    frmItem.txtRemarks.Text);
            }

            // グラフの計算
            switch (frmItem.cmbCategory.Text)
            {
            case "食費": category_withdraw[0] += int.Parse(frmItem.mtxtMoney.Text); break;

            case "雑費": category_withdraw[1] += int.Parse(frmItem.mtxtMoney.Text); break;

            case "住居": category_withdraw[2] += int.Parse(frmItem.mtxtMoney.Text); break;
            }
            // グラフの描画
            switch (frmItem.cmbCategory.Text)
            {
            case "食費":
            case "雑費":
            case "住居": graf.Points.Clear(); create_chart(category_name, category_withdraw); break;
            }

            // 出費の計算
            if (frmItem.mtxtMoney.Text != "")
            {
                if (frmItem.cmbCategory.Text == "給料")
                {
                    total -= int.Parse(frmItem.mtxtMoney.Text);
                }
                else
                {
                    total += int.Parse(frmItem.mtxtMoney.Text);
                }
            }
            total_label.Text = "支出:" + total + "円";

            //予算
            remainmoney_labal.Text = (int.Parse(budget_box.Text) - total).ToString();
            message_text(int.Parse(remainmoney_labal.Text));
        }
Example #3
0
        private void AddData()
        {
            ItemForm frmItem = new ItemForm(categoryDataSet1);
            DialogResult drRet = frmItem.ShowDialog();

            if (drRet == DialogResult.OK)
            {
                moneyDataSet.moneyDataTable.AddmoneyDataTableRow(
                    frmItem.monCalendar.SelectionRange.Start,
                    frmItem.cmbCategory.Text,
                    frmItem.txtItem.Text,
                    int.Parse(frmItem.mtxtMoney.Text),
                    frmItem.txtRemarks.Text);
            }

            // グラフの計算
            switch ( frmItem.cmbCategory.Text ) {
                        case "食費": category_withdraw[0] += int.Parse(frmItem.mtxtMoney.Text); break;
                        case "雑費": category_withdraw[1] += int.Parse(frmItem.mtxtMoney.Text); break;
                        case "住居": category_withdraw[2] += int.Parse(frmItem.mtxtMoney.Text); break;
            }
            // グラフの描画
            switch (frmItem.cmbCategory.Text)
            {
                case "食費": 
                case "雑費":
                case "住居": graf.Points.Clear(); create_chart(category_name, category_withdraw); break;
            }
            
            // 出費の計算
            if (frmItem.mtxtMoney.Text != "")
            {
                if (frmItem.cmbCategory.Text == "給料")
                {
                    total -= int.Parse(frmItem.mtxtMoney.Text);
                }
                else
                {
                    total += int.Parse(frmItem.mtxtMoney.Text);
                }
            }
            total_label.Text = "支出:"+ total + "円";

            //予算
            remainmoney_labal.Text = (int.Parse(budget_box.Text) - total).ToString();
            message_text(int.Parse(remainmoney_labal.Text));
        }
Example #4
0
 private void UpdateData()
 {
     int nowRow = dgv.CurrentRow.Index;
     DateTime oldDate
         = DateTime.Parse(dgv.Rows[nowRow].Cells[0].Value.ToString());
     string oldCategory = dgv.Rows[nowRow].Cells[1].Value.ToString();
     string oldItem = dgv.Rows[nowRow].Cells[2].Value.ToString();
     int oldMoney
         = int.Parse(dgv.Rows[nowRow].Cells[3].Value.ToString());
     string oldRemarks = dgv.Rows[nowRow].Cells[4].Value.ToString();
     ItemForm frmItem = new ItemForm(categoryDataSet1,
                                     oldDate,
                                     oldCategory,
                                     oldItem,
                                     oldMoney,
                                     oldRemarks);
     DialogResult drRet = frmItem.ShowDialog();
     if (drRet == DialogResult.OK)
     {
         dgv.Rows[nowRow].Cells[0].Value
             = frmItem.monCalendar.SelectionRange.Start;
         dgv.Rows[nowRow].Cells[1].Value = frmItem.cmbCategory.Text;
         dgv.Rows[nowRow].Cells[2].Value = frmItem.txtItem.Text;
         dgv.Rows[nowRow].Cells[3].Value = int.Parse(frmItem.mtxtMoney.Text);
         dgv.Rows[nowRow].Cells[4].Value = frmItem.txtRemarks.Text;
     }
 }