private void txtsearch_TextChanged(object sender, EventArgs e) { if (raOR.Checked == true) { if (raMA.Checked == true) { DataTable Dt = new DataTable(); Dt = order.SearchOrders3(txtsearch.Text); this.dgvOrders.DataSource = Dt; } else if (raCA.Checked == true) { DataTable Dt = new DataTable(); Dt = order.SearchOrders(txtsearch.Text); this.dgvOrders.DataSource = Dt; } else { DataTable Dt = new DataTable(); Dt = order.SearchOrders2(txtsearch.Text); this.dgvOrders.DataSource = Dt; } } else { this.dgvOrders.DataSource = order.Search_Purchase_Orders(txtsearch.Text); } }
private void btnAdd_Click(object sender, EventArgs e) { try { if (raOR.Checked == true) { if (txtOrderID.Text == string.Empty || txtCustomerID.Text == string.Empty || dataGridView1.Rows.Count < 1 || txtAmounKash.Text == string.Empty || txtAmounDue.Text == string.Empty || txtDescount.Text == string.Empty) { MessageBox.Show("BUUXI XOGTA MUHIMKA AH", "ISKA JIR", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { if (txtOrderID.Text == string.Empty || txtCustomerID.Text == string.Empty || dataGridView1.Rows.Count < 1 || txtAmounKash.Text == string.Empty || txtAmounDue.Text == string.Empty) { MessageBox.Show("BUUXI XOGTA MUHIMKA AH", "ISKA JIR", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } int IN_ID = Convert.ToInt32(lbTrID.Text); string AMD = txtAmounDue.Text; string AMP = txtAmounKash.Text; if (raOR.Checked == true) { if (state == "add") { order.ADD_ORDER(Convert.ToInt32(txtOrderID.Text), Convert.ToInt32(txtCustomerID.Text), Convert.ToDateTime(dtOrder.Value.ToShortDateString()), Convert.ToInt32(txtDescount.Text), txtTotalAmount.Text, AMP, AMD, txtSalesMan.Text, txtDesOrder.Text); } else { order.EDIT_ORDER(Convert.ToInt32(txtOrderID.Text), Convert.ToInt32(txtCustomerID.Text), Convert.ToDateTime(dtOrder.Value.ToShortDateString()), Convert.ToInt32(txtDescount.Text), txtTotalAmount.Text, AMP, AMD, txtSalesMan.Text, txtDesOrder.Text); FRM_ORDERS_LIST.getMainForm.dgvOrders.DataSource = order.SearchOrders2(""); } /* * else * { * // order.ADD_ORDER2(Convert.ToInt32(txtOrderID.Text), dtOrder.Value, txtSalesMan.Text, txtDesOrder.Text); * order.ADD_ORDER(Convert.ToInt32(txtOrderID.Text), 33, dtOrder.Value, AMP, AMD, txtSalesMan.Text, txtDesOrder.Text); * }*/ } else { if (state == "add") { order.ADD_Purchase_Orders(Convert.ToInt32(txtOrderID.Text), Convert.ToInt32(txtCustomerID.Text), Convert.ToDateTime(dtOrder.Value.ToShortDateString()), AMP, AMD, txtSalesMan.Text, txtDesOrder.Text); } else { order.EDIT_Purchase_Orders(Convert.ToInt32(txtOrderID.Text), Convert.ToInt32(txtCustomerID.Text), Convert.ToDateTime(dtOrder.Value.ToShortDateString()), AMP, AMD, txtSalesMan.Text, txtDesOrder.Text); FRM_ORDERS_LIST.getMainForm.dgvOrders.DataSource = order.Search_Purchase_Orders(""); } } if (raOR.Checked == true) { if (state == "add") { for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { string ID_PR = dataGridView1.Rows[i].Cells[0].Value.ToString(); int ID_OR = Convert.ToInt32(txtOrderID.Text); int QTE = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value); string PRC = dataGridView1.Rows[i].Cells[2].Value.ToString(); // float DIS = Convert.ToInt32(dataGridView1.Rows[i].Cells[5].Value); string AM = dataGridView1.Rows[i].Cells[4].Value.ToString(); string COS = dataGridView1.Rows[i].Cells[5].Value.ToString(); order.ADD_ORDER_DETAILS(ID_OR, ID_PR, QTE, PRC, AM, IN_ID, COS); int TR = 2; int POR = 2; string CR = "OR"; int Qty = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value); order.Inventory_Transactions(IN_ID, TR, dtOrder.Value, ID_PR, Qty, POR, ID_OR, CR); } } else { for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { string ID_PR = dataGridView1.Rows[i].Cells[0].Value.ToString(); int ID_OR = Convert.ToInt32(txtOrderID.Text); int QTE = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value); string PRC = dataGridView1.Rows[i].Cells[2].Value.ToString(); // float DIS = Convert.ToInt32(dataGridView1.Rows[i].Cells[5].Value); string AM = dataGridView1.Rows[i].Cells[4].Value.ToString(); string COS = dataGridView1.Rows[i].Cells[5].Value.ToString(); order.EDIT_ORDER_DETAILS(ID_OR, ID_PR, QTE, PRC, AM, IN_ID, COS); int TR = 2; int POR = 2; string CR = "OR"; int Qty = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value); order.EDIT_Inventory_Transactions(IN_ID, TR, dtOrder.Value, ID_PR, Qty, POR, ID_OR, CR); } } } else { if (state == "add") { for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { string ID_PR = dataGridView1.Rows[i].Cells[0].Value.ToString(); int ID_OR = Convert.ToInt32(txtOrderID.Text); int QTE = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value); string PRC = dataGridView1.Rows[i].Cells[2].Value.ToString(); // float DIS = Convert.ToInt32(dataGridView1.Rows[i].Cells[5].Value); string AM = dataGridView1.Rows[i].Cells[4].Value.ToString(); // double TAM = Convert.ToDouble(dataGridView1.Rows[i].Cells[6].Value); order.ADD_Purchase_Order_Details(ID_OR, ID_PR, QTE, PRC, AM, dtOrder.Value, IN_ID); int TR = 1; int POR = 2; string CR = "POR"; int Qty = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value); order.Inventory_Transactions(IN_ID, TR, dtOrder.Value, ID_PR, Qty, ID_OR, POR, CR); } } else { for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { string ID_PR = dataGridView1.Rows[i].Cells[0].Value.ToString(); int ID_OR = Convert.ToInt32(txtOrderID.Text); int QTE = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value); string PRC = dataGridView1.Rows[i].Cells[2].Value.ToString(); // float DIS = Convert.ToInt32(dataGridView1.Rows[i].Cells[5].Value); string AM = dataGridView1.Rows[i].Cells[4].Value.ToString(); // double TAM = Convert.ToDouble(dataGridView1.Rows[i].Cells[6].Value); order.EDIT_Purchase_DETAILS(ID_OR, ID_PR, QTE, PRC, AM, IN_ID); int TR = 1; int POR = 2; string CR = "POR"; int Qty = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value); order.EDIT_Inventory_Transactions(IN_ID, TR, dtOrder.Value, ID_PR, Qty, ID_OR, POR, CR); } } } MessageBox.Show("waa lagu guuleestay kaydiska", "kaydis", MessageBoxButtons.OK, MessageBoxIcon.Information); btnNEW.Enabled = true; } catch { return; } }