protected override void OnReceive(object message) { switch (message) { case Sync_Document_Message sync_document_message: var sync_document = new mmria.server.util.c_sync_document(sync_document_message.document_id, sync_document_message.document_json, sync_document_message.method); try { sync_document.executeAsync().Wait(); } catch (Exception ex) { Console.WriteLine($"Synchronize_Case exception: {ex}"); } break; case Sync_All_Documents_Message sync_all_documents_message: mmria.server.util.c_document_sync_all sync_all = new mmria.server.util.c_document_sync_all( Program.config_couchdb_url, Program.config_timer_user_name, Program.config_timer_password ); sync_all.executeAsync().Wait(); break; } }
public string Get ( string uid, string pwd ) { string result = null; if ( !string.IsNullOrWhiteSpace(uid) && !string.IsNullOrWhiteSpace(pwd) && uid == "mmria" && pwd == "sync" ) { System.Threading.Tasks.Task.Run ( new Action(() => { try { mmria.server.util.c_document_sync_all sync_all = new mmria.server.util.c_document_sync_all( Program.config_couchdb_url, Program.config_timer_user_name, Program.config_timer_password ); sync_all.executeAsync(); } catch (Exception ex) { System.Console.WriteLine($"syncController. error sync_all.execute\n{ex}"); } }) ); } return(result); }