public string NNTupdate() { StringBuilder sb = new StringBuilder(); var dt = NNT; var request = new NNTproxy(); string rs = ""; // Unchanged disindakileri gonder, deleted disindakileri reply ile guncelle, hata yoksa her rec icin AcceptChanges for (int i = 0; i < dt.Rows.Count; i++) { // States: Added, Modified, Deletede, Unchanged rs = dt.Rows[i].RowState.ToString().Substring(0, 1); if (rs == "A" || rs == "M" || rs == "D") { dt.Rows[i].ClearErrors(); request.RowSte = rs; request.RowUsr = Program.ObjUsr; if (rs == "D") { request.RowKey = (ulong)dt.Rows[i]["RowKey", DataRowVersion.Original]; } else { ProxyHelper.RowToProxy(dt, dt.Rows[i], request); } var reply = grpcService.ClientCRUDs.NNTupdate(request); // ---------> if (string.IsNullOrEmpty(reply.RowErr)) { if (rs != "D") { ProxyHelper.ProxyToRow(dt, dt.Rows[i], reply); } dt.Rows[i].AcceptChanges(); } else { dt.Rows[i].RowError = reply.RowErr; sb.AppendLine(reply.RowErr); //dt.Rows[i].RejectChanges(); ProxyHelper.ProxyToRow(dt, dt.Rows[i], reply); dt.Rows[i].AcceptChanges(); } } } return(sb.ToString()); }
private void button4_Click(object sender, EventArgs e) { var dt = dataSet1.Tables[1]; string rs = ""; Channel channel = new Channel($"127.0.0.1:50051", ChannelCredentials.Insecure); //Channel channel = new Channel($"217.160.13.102:50051", ChannelCredentials.Insecure); var client = new CRUDs.CRUDsClient(channel); var request = new AHPproxy(); // Unchanged disindakileri gonder, deleted disindakileri reply ile guncelle, hata yoksa her rec icin AcceptChanges for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i].ClearErrors(); // States: Added, Modified, Deletede, Unchanged rs = dt.Rows[i].RowState.ToString().Substring(0, 1); if (rs == "A" || rs == "M") { request.RowSte = rs; ProxyHelper.RowToProxy(dt, dt.Rows[i], request); var reply = client.AHPupdate(request); if (string.IsNullOrEmpty(reply.RowErr)) { ProxyHelper.ProxyToRow(dt, dt.Rows[i], reply); dt.Rows[i].AcceptChanges(); } else { dt.Rows[i].RowError = reply.RowErr; dt.Rows[i].RejectChanges(); } } } channel.ShutdownAsync().Wait(); }