コード例 #1
0
        private void button_them_Click(object sender, EventArgs e)
        {
            if (CheckData())
            {
                DTO.PhieuChi pc = new DTO.PhieuChi();
                //sb.masb = textBox_masb.Text;
                pc.manv     = textBox_manv.Text;
                pc.tenpc    = textBox_lido.Text;
                pc.giapc    = Convert.ToDecimal(textBox_sotien.Text.ToString());
                pc.noidung  = textBox_noidung.Text;
                pc.thoigian = DateTime.Now;



                if (bllPC.InsertPhieuChi(pc))
                {
                    MessageBox.Show("Thêm phiếu chi thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ShowAllPC();
                    textBox_lido.Clear();    // Clear() để xóa hết kí tự khi vừa thêm xong
                    textBox_sotien.Clear();
                    textBox_noidung.Clear();
                }
                else
                {
                    MessageBox.Show("Có lỗi xảy ra, xin hãy thử lại!", "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
        }
コード例 #2
0
ファイル: PhieuChi.cs プロジェクト: hungtran135/QLBVMB
        private void btnHuy_Click(object sender, EventArgs e)
        {
            int index = dataGridView_pc.CurrentCell.RowIndex;

            if (index != -1)
            {
                DTO.PhieuChi pc = new DTO.PhieuChi();
                //sb.masb = textBox_masb.Text;
                pc.mapc = dataGridView_pc.Rows[index].Cells[0].Value.ToString();

                if (MessageBox.Show("Bạn muốn hủy phiếu chi " + pc.mapc + " ", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (bllPC.DeletePhieuChi(pc))
                    {
                        MessageBox.Show("Hủy phiếu chi thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ShowAllPC();
                        textBox_lido.Clear();    // Clear() để xóa hết kí tự khi vừa thêm xong
                        textBox_sotien.Clear();
                        textBox_noidung.Clear();
                    }
                    else
                    {
                        MessageBox.Show("Có lỗi xảy ra, xin hãy thử lại!", "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                }
            }
        }