Ejemplo n.º 1
0
 private void FrmOperation_Load(object sender, EventArgs e)
 {
     this.Focus();
     CmpSetDgv();
     dgvOperationlog.DataSource = OperationDao.SelectOperationlogAll();
     spOperationlog.DataSource  = SpendDao.SelectSpendOperation();
 }
Ejemplo n.º 2
0
        private void spendClear_Click(object sender, EventArgs e)
        {
            string sql = "delete from spend";
            int    n   = DBHelper.ExecuteNonQuery(sql);

            if (n > 0)
            {
                MessageBox.Show("删除日志成功", "删除提示");
                spOperationlog.DataSource = SpendDao.SelectSpendOperation();
            }
            else
            {
                MessageBox.Show("删除日志失败", "错误提示");
            }
        }
Ejemplo n.º 3
0
 private void spOperation_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == this.spOperationlog.Columns["SpendDelete"].Index)
     {
         //判断列索引是不是删除按钮
         int rows    = spOperationlog.CurrentRow.Index; //得到当前行的索引
         int spendId = (int)(spOperationlog.Rows[rows].Cells[1].Value);
         if (spendId != 0 && MessageBox.Show("您确定要删除吗?", "重要提示!", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.OK)
         {
             string sql = "delete from spend where SpendId='" + spendId + "'";
             int    n   = DBHelper.ExecuteNonQuery(sql);
             if (n > 0)
             {
                 MessageBox.Show("删除日志成功", "删除提示");
                 spOperationlog.DataSource = SpendDao.SelectSpendOperation();
             }
             else
             {
                 MessageBox.Show("删除日志失败", "错误提示");
             }
         }
     }
 }