private void btnXemNgay_Click(object sender, EventArgs e) { IList <Microsoft.Reporting.WinForms.ReportParameter> param = new List <Microsoft.Reporting.WinForms.ReportParameter>(); param.Add(new Microsoft.Reporting.WinForms.ReportParameter("ngay", "Ngày " + dtNgay.Value.Date.ToString("dd/MM/yyyy"))); this.reportViewer.LocalReport.SetParameters(param); this.ChiTietPhieuBanBindingSource.DataSource = ctrl.ChiTietPhieuBan(dtNgay.Value.Date); this.reportViewer.RefreshReport(); }
private void dataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e) { if (MessageBox.Show("Bạn có chắc chắn xóa không?", "Phieu Ban Le", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { e.Cancel = true; } else { DataRowView view = (DataRowView)bindingNavigator.BindingSource.Current; ChiTietPhieuBanController ctrl = new ChiTietPhieuBanController(); IList <ChiTietPhieuBan> ds = ctrl.ChiTietPhieuBan(view["ID"].ToString()); foreach (ChiTietPhieuBan ct in ds) { CuahangNongduoc.DataLayer.MaSanPhanFactory.CapNhatSoLuong(ct.MaSanPham.Id, ct.SoLuong); } ctrl.Save(); } }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { DataRowView view = (DataRowView)bindingNavigator.BindingSource.Current; if (view != null) { if (MessageBox.Show("Bạn có chắc chắn xóa không?", "Phieu Ban Le", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ChiTietPhieuBanController ctrl = new ChiTietPhieuBanController(); IList <ChiTietPhieuBan> ds = ctrl.ChiTietPhieuBan(view["ID"].ToString()); foreach (ChiTietPhieuBan ct in ds) { CuahangNongduoc.DataLayer.MaSanPhanFactory.CapNhatSoLuong(ct.MaSanPham.Id, ct.SoLuong); } bindingNavigator.BindingSource.RemoveCurrent(); ctrl.Save(); } } }