示例#1
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            (new ThemHoaDon(null)).ShowDialog();
            ObjectCommonSearch search = new ObjectCommonSearch();

            reload(search);
        }
示例#2
0
 private void dgvHoaDon_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         string maKH = dgvHoaDon.Rows[e.RowIndex].Cells["maHDban"].Value.ToString();
         new ThemHoaDon(maKH).ShowDialog();
         ObjectCommonSearch search = new ObjectCommonSearch();
         reload(search);
     }
 }
示例#3
0
        private void btnTimKiem_Click(object sender, EventArgs e)
        {
            ObjectCommonSearch search = new ObjectCommonSearch();

            search.DateTime1 = dtpFromSearch.Value;
            search.DateTime2 = dtpToSearch.Value;
            search.Int1      = (int)nudTongTienFromSearch.Value;
            search.Int2      = (int)nudTongTienToSearch.Value;
            reload(search);
        }
示例#4
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            var db = new Database();

            if (MessageBox.Show("Bạn muốn xóa hóa đơn " + dgvHoaDon.CurrentRow.Cells["MaHDBan"].Value.ToString() + " ?", "Warning!!!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                //db.del_HDban(dgvKhachHang.CurrentRow.Cells["maKhach"].Value.ToString());
                db.del_HoaDon(dgvHoaDon.CurrentRow.Cells["maHDban"].Value.ToString());
            }
            ObjectCommonSearch search = new ObjectCommonSearch();

            reload(search);
        }
示例#5
0
        private void reload(ObjectCommonSearch search)
        {
            string sql = "select * from HDban ";

            sql += " where ngayBan between ";
            if (search.DateTime1 != null && search.DateTime1 != DateTime.MinValue)
            {
                sql += ("'" + search.DateTime1.ToString() + "'");
            }
            else
            {
                sql += ("'" + DateTime.Parse("01/01/2000").ToString() + "'");
            }
            sql += " and ";
            if (search.DateTime2 != null && search.DateTime2 != DateTime.MinValue)
            {
                sql += ("'" + search.DateTime2.ToString() + "'");
            }
            else
            {
                sql += ("'" + DateTime.Parse("01/01/2100").ToString() + "'");
            }
            sql += " and tongTien between ";
            if (search.Int1 > 0)
            {
                sql += search.Int1.ToString();
            }
            else
            {
                sql += int.MinValue.ToString();
            }
            sql += " and ";
            if (search.Int2 > 0)
            {
                sql += search.Int2.ToString();
            }
            else
            {
                sql += int.MaxValue.ToString();
            }
            dgvHoaDon.DataSource = new Database().SelectData(sql);
        }
示例#6
0
        private void QLHoaDon_Load(object sender, EventArgs e)
        {
            ObjectCommonSearch search = new ObjectCommonSearch();

            reload(search);
        }