Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         Count_tab_Untity counttab = new Count_tab_Untity();
         int id = count.Id;
         counttab.Count_data   = dateTimePicker1.Value;
         counttab.Count_type   = combType.Text;
         counttab.Count_proj   = combShouZhiType.Text;
         counttab.Count_money  = Convert.ToDouble(txtMoney.Text);
         counttab.Count_remark = txtRemark.Text;
         if (fbll.editCount(counttab, id))
         {
             datagridview.DataSource = fbll.returnDataTableFormCount_tab();
             BindDataGridView bind = new BindDataGridView(datagridview, pshouru, pzhichu, lab, shouru, zhichu, zongjine, jingshouru, "添加");
             bind.bindDataGridbView();
             f.Opacity = 1;
             this.Dispose();
         }
         else
         {
             MessageBox.Show("记账信息修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             f.Opacity = 1;
             this.Dispose();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "异常提示");
     }
 }
Example #2
0
 public bool SaveJiZhang(Count_tab_Untity count)
 {
     if (fdal.SaveJiZhang_DAL(count))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #3
0
        public EditCount(Form f, Count_tab_Untity count, DataGridView datagridview, ToolStripProgressBar pshouru, ToolStripProgressBar pzhichu, ToolStripLabel lab, Label shouru, Label zhichu, Label zongjine, Label jingshouru, string flag)
        {
            InitializeComponent();
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);

            this.f            = f;
            this.datagridview = datagridview;
            this.pshouru      = pshouru;
            this.pzhichu      = pzhichu;
            this.lab          = lab;
            this.shouru       = shouru;
            this.zhichu       = zhichu;
            this.zongjine     = zongjine;
            this.jingshouru   = jingshouru;
            this.flag         = flag;
            this.count        = count;
        }
Example #4
0
 public bool SaveJiZhang_DAL(Count_tab_Untity count)
 {
     using (OleDbConnection conn = DBConn.getConn())
     {
         conn.Open();
         string       sql = string.Format("insert into count_tab(count_data,count_type,count_proj,count_money,count_remark) values('{0}','{1}','{2}','{3}','{4}')", count.Count_data, count.Count_type, count.Count_proj, count.Count_money, count.Count_remark);
         OleDbCommand cmd = new OleDbCommand(sql, conn);
         int          i   = cmd.ExecuteNonQuery();
         if (i == 1)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Example #5
0
 public bool editCount_DAL(Count_tab_Untity counttab, int id)
 {
     using (OleDbConnection conn = DBConn.getConn())
     {
         conn.Open();
         string       sql = string.Format("update count_tab set count_data='{0}',count_type='{1}',count_proj='{2}',count_money={3},count_remark='{4}' where ID={5}", counttab.Count_data, counttab.Count_type, counttab.Count_proj, counttab.Count_money, counttab.Count_remark, id);
         OleDbCommand cmd = new OleDbCommand(sql, conn);
         int          i   = cmd.ExecuteNonQuery();
         if (i == 1)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Example #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (combType.Text != "" && comShouZhiType.Text != "" && txtMoney.Text != "")
                {
                    //封装数据
                    Count_tab_Untity count = new Count_tab_Untity();
                    count.Count_data   = Convert.ToDateTime(dateTimePicker1.Value);
                    count.Count_type   = combType.Text;
                    count.Count_proj   = comShouZhiType.Text;
                    count.Count_money  = Convert.ToDouble(txtMoney.Text.Trim());
                    count.Count_remark = txtRemark.Text;


                    if (fbll.SaveJiZhang(count))
                    {
                        //MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        BindDataGridView bind = new BindDataGridView(datagridview, process1, process2, lab, shouru, zhichu, zongjine, jingshouru, "添加");
                        bind.bindDataGridbView();
                        //跳转到刚才添加的数据所在行
                        datagridview.CurrentCell = datagridview.Rows[datagridview.RowCount - 1].Cells[0];
                        f.Opacity = 1;
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        f.Opacity = 1;
                        this.Dispose();
                    }
                }
                else
                {
                    MessageBox.Show("请将信息输入完整!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("金额输入有误,请检查输入", "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMoney.Focus();
            }
        }
Example #7
0
 public bool editCount(Count_tab_Untity counttab, int id)
 {
     return(fdal.editCount_DAL(counttab, id));
 }