private void Button_SyncNow_Click(object sender, EventArgs e) { if (ClientConnectionStringExists() && ProviderConnectionStringExists()) { foreach (string tableName in Provisioning.GetProvisionedTables(ClientConnectionString)) { if (Provisioning.GetProvisionedTables(ProviderConnectionString).Contains(tableName.ToString())) { try { txtStatus.Text += Sync.Synchronise(tableName + "Scope", ProviderConnectionString, ClientConnectionString); } catch { MessageBox.Show(string.Format("There was an error whilst syncing the \"{0}\" table. Please check the log.", tableName.ToString()), "Sync Error", MessageBoxButtons.OK); } } else { MessageBox.Show(string.Format("The \"{0}\" table did not exist on the provider database anymore.", tableName.ToString()), "Sync Error", MessageBoxButtons.OK); } } } }
private void Button_ProvisionTables_Click(object sender, EventArgs e) { if (ClientConnectionStringExists() && ProviderConnectionStringExists()) { ProvisionTablesOnProvider(); ProvisionTablesOnClient(); } UpdateAllLists(); void ProvisionTablesOnClient() { if (ClientConnectionStringExists() && ProviderConnectionStringExists()) { foreach (var itemChecked in CheckedListBox_UnprovisionedProviderTables.CheckedItems) { if (Provisioning.GetProvisionedTables(ProviderConnectionString).Contains(itemChecked.ToString())) { try { Provisioning.ProvisionTableOnClient(itemChecked.ToString() + "Scope", ProviderConnectionString, ClientConnectionString); } catch { MessageBox.Show(string.Format("There was an error whilst provisioning the \"{0}\" table on the client database. Please check the log.", itemChecked.ToString()), "Provisioning Error", MessageBoxButtons.OK); } } else { MessageBox.Show(string.Format("Could not provision the table on the client. The \"{0}\" table did not exist on the provider database anymore.", itemChecked.ToString()), "Provisioning Error", MessageBoxButtons.OK); } } //MessageBox.Show("All tables were successfully provisioned on the client database.", "Success", MessageBoxButtons.OK); } } void ProvisionTablesOnProvider() { if (ProviderConnectionStringExists()) { foreach (var itemChecked in CheckedListBox_UnprovisionedProviderTables.CheckedItems) { if (Provisioning.GetUnprovisionedTables(ProviderConnectionString).Contains(itemChecked.ToString())) { try { Provisioning.ProvisionTableOnProvider(itemChecked.ToString() + "Scope", itemChecked.ToString(), ProviderConnectionString); } catch { MessageBox.Show(string.Format("There was an error whilst provisioning the \"{0}\" table on the provider database. Please check the log.", itemChecked.ToString()), "Provisioning Error", MessageBoxButtons.OK); } } else { //MessageBox.Show(string.Format("The \"{0}\" table has already been provisioned on the provider!", itemChecked.ToString()), "Provisioning Error", MessageBoxButtons.OK); } //MessageBox.Show("All tables were successfully provisioned on the provider database.", "Success", MessageBoxButtons.OK); } } } }