private void gr_btn_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { int intRow = gridView1.FocusedRowHandle; if ((intRow >= 0) && (gridView1.GetRowCellValue(intRow, "PhieuNhapID") != null)) { string strPhieuNhap = gridView1.GetRowCellValue(intRow, "PhieuNhapID").ToString(); switch (e.Button.Caption.ToUpper()) { //case "PRINT": // PhieuBanHang rp = new PhieuBanHang(); // rp.SetDataSource(reportsController.prtDonHang(strDonHangID)); // rp.Refresh(); // ThongTinShop shop = ThongTinShopController.GetItem(); // rp.SetParameterValue("TenShop", shop.TenShop); // rp.SetParameterValue("DiaChi", shop.DiaChi); // rp.SetParameterValue("SoDienThoai", shop.SoDienThoai); // rp.SetParameterValue("WebSite", shop.Website); // frmViewReports fReport = null; // foreach (Form item in MdiChildren) // { // if (item.GetType() == typeof(frmViewReports)) // { // fReport = (item as frmViewReports); // fReport.crystalReportViewer1.ReportSource = rp; // fReport.Activate(); // return; // } // } // fReport = new frmViewReports(); // fReport.crystalReportViewer1.ReportSource = rp; // fReport.MdiParent = this.MdiParent; // fReport.Show(); // break; case "DEL": if (MessageBox.Show("Bạn muốn xóa đơn hàng này", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { PhieuNhapController.Del(strPhieuNhap); gridControl1.DataSource = PhieuNhapController.GetAllList(); } break; case "VIEW": PhieuNhap viewItem = PhieuNhapController.GetItem(strPhieuNhap); if (viewItem != null) { frmAddPhieuNhap f = new frmAddPhieuNhap(); f.ViewItem = viewItem; f.forMode = "view"; f.MdiParent = this.MdiParent; f.Show(); this.Dispose(); } break; default: break; } } }