public void DoUpdates(LPSClientShared.LPSServer.ChangeInfo[] changes) { using(Log.Scope("{0} - Thd{1}: DoUpdates", DateTime.Now, Thread.CurrentThread.ManagedThreadId)) lock(this) { foreach(LPSClientShared.LPSServer.ChangeInfo change in changes) { Log.Debug(" * Modify DT: {0}: table {1} {2}", change.ModifyDateTime, change.TableName, change.HasDeletedRows?"was updated and some rows deleted":"was updated"); List<DataSet> dslist; if(datasets.TryGetValue(change.TableName, out dslist)) { foreach(DataSet ds in dslist) { DateTime last_dt = change.ModifyDateTime; //(DateTime)ds.ExtendedProperties["DATETIME"]; string tablename = change.TableName; using(DataSet alllist = GetDataSetAllChangesList(tablename, last_dt, change.HasDeletedRows)) using(DataSet updates = GetDataSetUpdates(ds, ref last_dt)) { UpdateTableRows(ds.Tables[0], updates.Tables[0], alllist.Tables[0]); ds.ExtendedProperties["DATETIME"] = last_dt; } } } } } }
public static ServerException Create(LPSClientShared.LPSServer.ExceptionInfo exceptionInfo) { ServerException result; if(exceptionInfo.InnerException != null) result = new ServerException(exceptionInfo.Message, ServerException.Create(exceptionInfo.InnerException)); else result = new ServerException(exceptionInfo.Message); result.ExceptionInfo = exceptionInfo; return result; }
private void CheckServerResult(LPSClientShared.LPSServer.ServerCallResult result) { using(Log.Scope()) { if(result == null) return; if(result.Changes != null && result.Changes.Length > 0 && updater != null) updater.DoUpdates(result.Changes); if(result.Exception != null) throw ServerException.Create(result.Exception); } }