private void butDown_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length == 0) { MessageBox.Show(Lans.g(this, "Please select a connection, first.")); return; } if (gridMain.SelectedIndices.Length > 1) { MessageBox.Show(Lans.g(this, "Please only select one connection.")); return; } int idx = gridMain.SelectedIndices[0]; if (_listConnsShowing.Count < 2 || idx == _listConnsShowing.Count - 1) { return; //nothing to do } _listConnsShowing[idx].ItemOrder++; CentralConnections.Update(_listConnsShowing[idx]); _listConnsShowing[idx + 1].ItemOrder--; CentralConnections.Update(_listConnsShowing[idx + 1]); _listConnsAll = CentralConnections.GetConnections(); FillGrid(); gridMain.SetSelected(idx + 1, true); }
private void button1_Click(object sender, EventArgs e) { //test code string server = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWServer"); //this property will not exist if using Oracle, eCW will never use Oracle string port = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWPort"); //this property will not exist if using Oracle, eCW will never use Oracle string username = "******"; //"ecwUser"; string password = ""; //"l69Rr4Rmj4CjiCTLxrIblg==";//encrypted CentralConnections.GetConnections(); string connString = "Server=" + server + ";" + "Port=" + port + ";" //although this does seem to cause a bug in Mono. We will revisit this bug if needed to exclude the port option only for Mono. + "Database=mobiledoc;" //ecwMaster;" //+"Connect Timeout=20;" + "User ID=" + username + ";" + "Password="******";" + "CharSet=utf8;" + "Treat Tiny As Boolean=false;" + "Allow User Variables=true;" + "Default Command Timeout=300;"//default is 30seconds + "Pooling=false" ; string command = "select Description from account;"; string result = MySql.Data.MySqlClient.MySqlHelper.ExecuteDataRow(connString, command)["Description"].ToString(); MessageBox.Show(result); }
private void butAlphabetize_Click(object sender, EventArgs e) { _listConnsShowing.Sort(delegate(CentralConnection x, CentralConnection y){ return(x.Note.CompareTo(y.Note)); }); for (int i = 0; i < _listConnsShowing.Count; i++) { _listConnsShowing[i].ItemOrder = i; CentralConnections.Update(_listConnsShowing[i]); } _listConnsAll = CentralConnections.GetConnections(); FillGrid(); }
private void butAdd_Click(object sender, EventArgs e) { CentralConnection conn = new CentralConnection(); conn.IsNew = true; FormCentralConnectionEdit FormCCS = new FormCentralConnectionEdit(); FormCCS.CentralConnectionCur = conn; if (FormCCS.ShowDialog() == DialogResult.OK) //Will insert conn on OK. { _listConns = CentralConnections.GetConnections(); FillGrid(); } }
private void butEdit_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length == 0) { MsgBox.Show(this, "Please select a connection to edit first."); return; } FormCentralConnectionEdit FormCCE = new FormCentralConnectionEdit(); FormCCE.CentralConnectionCur = (CentralConnection)gridMain.Rows[gridMain.SelectedIndices[0]].Tag; //No support for editing multiple. if (FormCCE.ShowDialog() == DialogResult.OK) { _listConns = CentralConnections.GetConnections(); FillGrid(); } }
private void menuItemSecurity_Click(object sender, EventArgs e) { if (!Security.IsAuthorized(Permissions.SecurityAdmin)) { return; } FormCentralSecurity FormCUS = new FormCentralSecurity(); foreach (CentralConnection conn in _listConns) { FormCUS.ListConns.Add(conn.Copy()); } FormCUS.ShowDialog(); _listConns = CentralConnections.GetConnections(); //List may have changed when syncing security settings. FillGrid(); }
private void menuConnSetup_Click(object sender, EventArgs e) { FormCentralConnections FormCC = new FormCentralConnections(); foreach (CentralConnection conn in _listConns) { FormCC.ListConns.Add(conn.Copy()); } FormCC.LabelText.Text = Lans.g("FormCentralConnections", "Double click an existing connection to edit or click the 'Add' button to add a new connection."); FormCC.Text = Lans.g("FormCentralConnections", "Connection Setup"); if (FormCC.ShowDialog() == DialogResult.OK) { _listConns = CentralConnections.GetConnections(); FillGrid(); } }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { if (IsSelectionMode) { ListConnsSelected = new List <CentralConnection>(); ListConnsSelected.Add(_listConnsShowing[e.Row]); DialogResult = DialogResult.OK; return; } FormCentralConnectionEdit FormCCE = new FormCentralConnectionEdit(); FormCCE.CentralConnectionCur = _listConnsShowing[e.Row]; FormCCE.ShowDialog(); _listConnsAll = CentralConnections.GetConnections(); FillGrid(); }
private void butAdd_Click(object sender, EventArgs e) { CentralConnection conn = new CentralConnection(); conn.IsNew = true; FormCentralConnectionEdit FormCCE = new FormCentralConnectionEdit(); FormCCE.CentralConnectionCur = conn; FormCCE.LastItemOrder = 0; if (_listConnsAll.Count > 0) { FormCCE.LastItemOrder = _listConnsAll[_listConnsAll.Count - 1].ItemOrder; } FormCCE.ShowDialog(); _listConnsAll = CentralConnections.GetConnections(); FillGrid(); }
private void FormCentralConnectionGroupEdit_Load(object sender, EventArgs e) { _listConns = CentralConnections.GetConnections(); _listConnsCur = new List <CentralConnection>(); if (IsNew) { _listConnGroupAttaches = new List <ConnGroupAttach>(); } else //Take full list and filter out { _listConnGroupAttaches = ConnGroupAttaches.GetForGroup(ConnectionGroupCur.ConnectionGroupNum); //Grab all the connections associated to the corresponding connection group from the list of all connections. _listConnsCur = _listConns.FindAll(x => _listConnGroupAttaches.Exists(y => y.CentralConnectionNum == x.CentralConnectionNum)); } textDescription.Text = ConnectionGroupCur.Description; FillGrid(); }
private void FormCentralManager_Load(object sender, EventArgs e) { if (!GetConfigAndConnect()) { return; } Version storedVersion = new Version(PrefC.GetString(PrefName.ProgramVersion)); Version currentVersion = Assembly.GetAssembly(typeof(Db)).GetName().Version; string syncCodePref = PrefC.GetString(PrefName.CentralManagerSyncCode); if (syncCodePref == "") { //Generate new sync code of 10 alphanumeric characters. Random rand = new Random(); string allowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for (int i = 0; i < 10; i++) { syncCodePref += allowedChars[rand.Next(allowedChars.Length)]; } Prefs.UpdateString(PrefName.CentralManagerSyncCode, syncCodePref); } if (storedVersion.CompareTo(currentVersion) != 0) { MessageBox.Show(Lan.g(this, "Program version") + ": " + currentVersion.ToString() + "\r\n" + Lan.g(this, "Database version") + ": " + storedVersion.ToString() + "\r\n" + Lan.g(this, "Versions must match. Please manually connect to the database through the main program in order to update the version.")); _hasFatalError = true; Application.Exit(); return; } if (CultureInfo.CurrentCulture.Name == "en-US") { CultureInfo cInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone(); cInfo.DateTimeFormat.ShortDatePattern = "MM/dd/yyyy"; Application.CurrentCulture = cInfo; } this.Text += " - " + Security.CurUser.UserName; FillComboGroups(PrefC.GetLong(PrefName.ConnGroupCEMT)); _listConns = CentralConnections.GetConnections(); _progVersion = PrefC.GetString(PrefName.ProgramVersion); labelVersion.Text = "Version: " + _progVersion; FillGrid(); }
private void FormCentralConnections_Load(object sender, EventArgs e) { checkIsAutoLogon.Checked = PrefC.GetBool(PrefName.CentralManagerIsAutoLogon); checkUseDynamicMode.Checked = PrefC.GetBool(PrefName.CentralManagerUseDynamicMode); _listConnectionGroups = ConnectionGroups.GetAll(); comboConnectionGroups.Items.Add("All"); comboConnectionGroups.Items.AddRange(_listConnectionGroups.Select(x => x.Description).ToArray()); comboConnectionGroups.SelectedIndex = 0; //Default to all. if (IsSelectionMode) { groupPrefs.Visible = false; butAdd.Visible = false; groupOrdering.Visible = false; } else { butOK.Visible = false; butCancel.Text = "Close"; } _listConnsAll = CentralConnections.GetConnections(); //fix any bad item orders bool foundBad = false; for (int i = 0; i < _listConnsAll.Count; i++) { if (_listConnsAll[i].ItemOrder != i) { foundBad = true; _listConnsAll[i].ItemOrder = i; CentralConnections.Update(_listConnsAll[i]); } } if (foundBad) { _listConnsAll = CentralConnections.GetConnections(); } FillGrid(); }