//Delete private void button5_Click(object sender, EventArgs e) { try { ViettakInv.SyncInv sync = new SyncInv(user, pass, url, mauso, kyhieu); string result = sync.DeleteInvoice("0000061"); result = result.Replace("\n", ""); } catch (Exception ex) { } }
//Edit private void button4_Click(object sender, EventArgs e) { if (gridView1.SelectedRowsCount == 0) { return; } int[] iSelect = gridView1.GetSelectedRows(); foreach (int i in iSelect) { try { ViettakInv.SyncInv sync = new SyncInv(user, pass, url, mauso, kyhieu); string MT32ID = gridView1.GetDataRow(i)["MT32ID"].ToString(); if (MT32ID == string.Empty) { continue; } if (gridView1.GetDataRow(i)["status"] == DBNull.Value || gridView1.GetDataRow(i)["status"].ToString() == "0") { continue; } sData = BuildData1HD(MT32ID); string result = sync.EditInvoice(sData, gridView1.GetDataRow(i)["Sohoadon"].ToString()); result = result.Replace("\n", ""); if (result.Contains("ERR")) { } else if (result.Contains("OK")) { string sohoadon = ""; Result r = JsonConvert.DeserializeObject <Result>(result); if (r == null) { continue; } string reString = r.result; string[] lPara = reString.Split("_".ToCharArray()); if (lPara.Length != 2) { continue; } sohoadon = "0000000".Substring(0, 7 - lPara[1].Length) + lPara[1]; string sql = "update MT32 set Status=1, sohoadon='" + sohoadon + "' where MT32ID='" + MT32ID + "'"; db.UpdateByNonQuery(sql); } } catch (Exception ex) { } } }