private void button4_Click(object sender, EventArgs e) { try { //اضافة معلومات الفتورة order.ADD_ORDERS(Convert.ToInt32(text_order_id.Text), dt_order.Value, text_order_des.Text, Convert.ToInt32(text_cust_id.Text), text_sales_man.Text); //اضافة المنتوجات المدخلة for (int i = 0; i < DGV_PRD_BILL.Rows.Count - 1; i++) { order.ADD_ORDERS_DETAILS(DGV_PRD_BILL.Rows[i].Cells[0].Value.ToString(), Convert.ToInt32(text_order_id.Text) , DGV_PRD_BILL.Rows[i].Cells[1].Value.ToString(), DGV_PRD_BILL.Rows[i].Cells[2].Value.ToString() , Convert.ToInt32(DGV_PRD_BILL.CurrentRow.Cells[3].Value), Convert.ToInt32(DGV_PRD_BILL.Rows[i].Cells[5].Value) , DGV_PRD_BILL.Rows[i].Cells[4].Value.ToString(), DGV_PRD_BILL.Rows[i].Cells[6].Value.ToString()); } MessageBox.Show("Saved Successfully", "Save Operation", MessageBoxButtons.OK, MessageBoxIcon.Information); if (MessageBox.Show("Do you want to Print this Order?", "Inquiry Process", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { button_print.Enabled = true; butto_add.Enabled = false; //MessageBox.Show("Successfully Print", "Inquiry Process", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Print Canceled", "Print Process", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); button_new.Enabled = true; } // ClearData(); } catch { return; } }
private void BTM_SAVE_SALE_Click(object sender, EventArgs e) { if (TXT_ORDER_ID.Text == string.Empty || TXT_CUSTOMER_ID.Text == string.Empty || dataGridView1.Rows.Count < 1 || TXT_DESC_BILL.Text == string.Empty) { MessageBox.Show("ينبغي ملئ جميع البيانات", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { ORDER.ADD_ORDERS(Convert.ToInt32(TXT_ORDER_ID.Text), TXT_SALE_DATE.Value, Convert .ToInt32(TXT_CUSTOMER_ID.Text), TXT_DESC_BILL.Text, TXT_SALESMAN.Text); //DateTime dtValue; //dtValue = TXT_SALE_DATE.Value; // load your date & time into this variable //string montht = dtValue.ToString("MM"); //string yearrr= dtValue.ToString("yyyy"); //CUST.ADD_MONTH_YEAR_CUSTOMER(Convert.ToInt32(TXT_CUSTOMER_ID.Text), montht.ToString(), yearrr.ToString()); for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { ORDER.add_order_details(dataGridView1.Rows[i].Cells[0].Value.ToString() , Convert.ToInt32(TXT_ORDER_ID.Text) , Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value.ToString()) , dataGridView1.Rows[i].Cells[2].Value.ToString() , Convert.ToInt32(dataGridView1.Rows[i].Cells[5].Value.ToString()) , dataGridView1.Rows[i].Cells[4].Value.ToString() , dataGridView1.Rows[i].Cells[6].Value.ToString()); } MessageBox.Show("تمت عمليه الحفظ بنجاح", "عمليه الحفظ", MessageBoxButtons.OK, MessageBoxIcon.Information); CLEAR_ALL_DATA(); } }