private void btnProceed_Click(object sender, EventArgs e) { if (dgv.Rows.Count <= 0) { MessageBox.Show("No data found", "Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (!haveSelected()) { MessageBox.Show("No data selected", "Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { string ids = ""; for (int i = 0; i < dgv.Rows.Count; i++) { if (Convert.ToBoolean(dgv.Rows[i].Cells["selectt"].Value.ToString()) == true) { ids = ids + "," + dgv.Rows[i].Cells["id"].Value.ToString(); } } ids = (string.IsNullOrEmpty(ids) ? "" : ids.Substring(1)); string sIDs = string.IsNullOrEmpty(ids) ? "" : "?ids=%5B" + ids + "%5D"; JObject jObjectBody = new JObject(); SAPNumber sAPNumber = new SAPNumber(); sAPNumber.ShowDialog(); if (SAPNumber.isSubmit) { jObjectBody.Add("sap_number", SAPNumber.sap_number); apiPUT(jObjectBody, "/api/sap_num/payment/update" + sIDs); } } }
public void forUpdatingSAP() { JObject jObjectBody = new JObject(); if (this.Text.Equals("Pullout Items")) { SAPWarehouse sAPWarehouse = new SAPWarehouse(); sAPWarehouse.ShowDialog(); if (SAPWarehouse.isSubmit) { int sapNumber = SAPWarehouse.sapNumber; string warehouseCode = SAPWarehouse.warehouseCode; jObjectBody.Add("sap_number", sapNumber); jObjectBody.Add("to_whse", warehouseCode); string URL = "/api/pullout/transfer/" + selectedID; apiPUT(jObjectBody, URL); } } else { SAPNumber sAPNumber = new SAPNumber(); sAPNumber.ShowDialog(); if (SAPNumber.isSubmit) { int sap_number = SAPNumber.sap_number; if (sap_number.Equals(0)) { jObjectBody.Add("sap_number", null); } else { jObjectBody.Add("sap_number", sap_number); } } string URL = (this.Text.Equals("Pullout Items") ? "/api/sap_num/pullout/update?ids=" + "%5B" + selectedID + "%5D" : "/api/inv/recv/update/" + selectedID); apiPUT(jObjectBody, URL); } }