private void butSyncManual_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length == 0) { MsgBox.Show(this, "Please select at least one middle tier connection."); return; } List <Tuple <Userod, string> > listUsers = new List <Tuple <Userod, string> >(); //Middle tier requires Userod and PasswordTyped listUsers.Add(Tuple.Create(Security.CurUser, Security.PasswordTyped)); for (int i = 0; i < gridMain.SelectedIndices.Length; i++) { if (((CentralConnection)gridMain.Rows[gridMain.SelectedIndices[i]].Tag).ServiceURI == "") { continue; } bool isSynced = false; for (int j = 0; j < listUsers.Count; j++) { Security.CurUser = listUsers[j].Item1; Security.PasswordTyped = listUsers[j].Item2; CentralSyncHelper.SyncAll(new List <CentralConnection>() { (CentralConnection)gridMain.Rows[gridMain.SelectedIndices[i]].Tag }); if (CentralSyncHelper.ListSyncErrors.Count == 0) { isSynced = true; } else { FormCentralLogOn FormCLO = new FormCentralLogOn(); FormCLO.IsMiddleTierSync = true; if (FormCLO.ShowDialog() == DialogResult.OK) { listUsers.Add(Tuple.Create(Security.CurUser, Security.PasswordTyped)); CentralSyncHelper.SyncAll(new List <CentralConnection>() { (CentralConnection)gridMain.Rows[gridMain.SelectedIndices[i]].Tag }); //Try again if (CentralSyncHelper.ListSyncErrors.Count == 0) { isSynced = true; } } } if (isSynced) { break; } } //Set user and password back to what it was originally Security.CurUser = listUsers[0].Item1; Security.PasswordTyped = listUsers[0].Item2; } }
private void butSecurity_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length == 0) { MsgBox.Show(this, "Please select at least one connection."); return; } List <CentralConnection> listSelectedConns = new List <CentralConnection>(); for (int i = 0; i < gridMain.SelectedIndices.Length; i++) { if (((CentralConnection)gridMain.Rows[gridMain.SelectedIndices[i]].Tag).ConnectionStatus != "OK") { continue; } listSelectedConns.Add((CentralConnection)gridMain.Rows[gridMain.SelectedIndices[i]].Tag); } MsgBoxCopyPaste MsgBoxCopyPaste = new MsgBoxCopyPaste(CentralSyncHelper.SyncAll(listSelectedConns)); MsgBoxCopyPaste.ShowDialog(); FillGrid(); }
private void butSync_Click(object sender, EventArgs e) { if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix error first."); return; } //Enter info into local DB before pushing out to others so we save it. int days = PIn.Int(textDays.Text); DateTime date = PIn.Date(textDate.Text); Prefs.UpdateString(PrefName.SecurityLockDate, POut.Date(date, false)); Prefs.UpdateInt(PrefName.SecurityLockDays, days); Prefs.UpdateBool(PrefName.SecurityLockIncludesAdmin, checkAdmin.Checked); Prefs.UpdateBool(PrefName.CentralManagerSecurityLock, checkEnable.Checked); FormCentralConnections FormCC = new FormCentralConnections(); FormCC.LabelText.Text = Lans.g("CentralSecurity", "Sync will create or update the Central Management users, passwords, and user groups to all selected databases."); FormCC.Text = Lans.g("CentralSecurity", "Sync Security"); foreach (CentralConnection conn in ListConns) { FormCC.ListConns.Add(conn.Copy()); } List <CentralConnection> listSelectedConns = new List <CentralConnection>(); if (FormCC.ShowDialog() == DialogResult.OK) { listSelectedConns = FormCC.ListConns; } else { return; } MsgBoxCopyPaste MsgBoxCopyPaste = new MsgBoxCopyPaste(CentralSyncHelper.SyncAll(listSelectedConns)); MsgBoxCopyPaste.ShowDialog(); }