private void btnPrint_Click(object sender, EventArgs e) { if (txtOrderID.Text == string.Empty || txtCustomerID.Text == string.Empty || dgvProducts.Rows.Count < 1 || txtDesOrder.Text == string.Empty) { MessageBox.Show("ينبغي تسجيل المعلومات المهمه", "تنبية", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ///إضافة معلومات الفاتورة order.ADD_ORDER(Convert.ToInt32(txtOrderID.Text), dtOrder.Value, Convert.ToInt32(txtCustomerID.Text), txtDesOrder.Text, txtSalesMan.Text); ///إضافة المنتجات المدخلة for (int i = 0; i < dgvProducts.Rows.Count - 1; i++) { order.ADD_ORDER_DETAILS(dgvProducts.Rows[i].Cells[0].Value.ToString(), Convert.ToInt32(txtOrderID.Text), Convert.ToInt32(dgvProducts.Rows[i].Cells[3].Value), dgvProducts.Rows[i].Cells[2].Value.ToString(), Convert.ToInt32(dgvProducts.Rows[i].Cells[5].Value), dgvProducts.Rows[i].Cells[4].Value.ToString(), dgvProducts.Rows[i].Cells[6].Value.ToString()); } // MessageBox.Show("تمت عملية الحفظ بنجاح", "عملية الحفظ", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearData(); this.Cursor = Cursors.WaitCursor; RPT.REP_ORDER report = new RPT.REP_ORDER(); RPT.FRM_ORD frm = new RPT.FRM_ORD(); report.SetParameterValue("@ID_ORDER", Convert.ToInt32(label19.Text)); frm.crystalReportViewer1.ReportSource = report; frm.ShowDialog(); this.Cursor = Cursors.Default; }
private void button1_Click(object sender, EventArgs e) { // this.Cursor = Cursors.WaitCursor; // int order_ID = Convert.ToInt32(dgvOrders.CurrentRow.Cells[0].Value); // RPT.rpt_orders report = new RPT.rpt_orders(); // RPT.FRM_RPT_PRODUCT frm = new RPT.FRM_RPT_PRODUCT(); // report.SetDataSource(order.GetOrderDetails(order_ID)); // frm.crystalReportViewer1.ReportSource = report; // frm.ShowDialog(); // this.Cursor = Cursors.Default; this.Cursor = Cursors.WaitCursor; int order_ID = Convert.ToInt32(dgvOrders.CurrentRow.Cells[0].Value); RPT.REP_ORDER report = new RPT.REP_ORDER(); RPT.FRM_ORD frm = new RPT.FRM_ORD(); frm.crystalReportViewer1.ReportSource = report; frm.ShowDialog(); this.Cursor = Cursors.Default; }