private void butOK_Click(object sender, EventArgs e)
 {
     try {
         int.Parse(textItemOrder.Text);
     }
     catch {
         MessageBox.Show("Item Order invalid");
     }
     CentralConnectionCur.ServerName      = textServerName.Text;
     CentralConnectionCur.DatabaseName    = textDatabaseName.Text;
     CentralConnectionCur.MySqlUser       = textMySqlUser.Text;
     CentralConnectionCur.MySqlPassword   = CentralConnections.Encrypt(textMySqlPassword.Text, FormCentralManager.EncryptionKey);
     CentralConnectionCur.ServiceURI      = textServiceURI.Text;
     CentralConnectionCur.WebServiceIsEcw = checkWebServiceIsEcw.Checked;
     CentralConnectionCur.ItemOrder       = int.Parse(textItemOrder.Text);
     CentralConnectionCur.Note            = textNote.Text;
     if (CentralConnectionCur.IsNew)
     {
         CentralConnections.Insert(CentralConnectionCur);
         CentralConnectionCur.IsNew = false;              //so a double-click immediately in FormCentralConnections doesn't insert again
     }
     else
     {
         CentralConnections.Update(CentralConnectionCur);
     }
     DialogResult = DialogResult.OK;
 }
Пример #2
0
        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);
        }
Пример #3
0
 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 butOK_Click(object sender, EventArgs e)
 {
     try {
         int.Parse(textItemOrder.Text);
     }
     catch {
         MessageBox.Show("Item Order invalid");
     }
     //if(textServiceURI.Text=="") {
     //	MessageBox.Show("Please enter a remote URI.");
     //	return;
     //}
     //if(textUserName.Text=="") {
     //	MessageBox.Show("Please enter a username.");
     //	return;
     //}
     //if(textPassword.Text=="") {
     //if(!MessageBox.Show(this,MsgBoxButtons.OKCancel,"Do you want to save with no password?")) {
     //	return;
     //}
     //}
     CentralConnectionCur.ServerName      = textServerName.Text;
     CentralConnectionCur.DatabaseName    = textDatabaseName.Text;
     CentralConnectionCur.MySqlUser       = textMySqlUser.Text;
     CentralConnectionCur.MySqlPassword   = CentralConnections.Encrypt(textMySqlPassword.Text, FormCentralManager.EncryptionKey);
     CentralConnectionCur.ServiceURI      = textServiceURI.Text;
     CentralConnectionCur.WebServiceIsEcw = checkWebServiceIsEcw.Checked;
     CentralConnectionCur.OdUser          = textOdUser.Text;
     CentralConnectionCur.OdPassword      = CentralConnections.Encrypt(textOdPassword.Text, FormCentralManager.EncryptionKey);
     CentralConnectionCur.ItemOrder       = int.Parse(textItemOrder.Text);
     CentralConnectionCur.Note            = textNote.Text;
     if (CentralConnectionCur.IsNew)
     {
         CentralConnections.Insert(CentralConnectionCur);
     }
     else
     {
         CentralConnections.Update(CentralConnectionCur);
     }
     DialogResult = DialogResult.OK;
 }
Пример #5
0
 private void butOK_Click(object sender, EventArgs e)
 {
     CentralConnectionCur.ServerName                = textServerName.Text;
     CentralConnectionCur.DatabaseName              = textDatabaseName.Text;
     CentralConnectionCur.MySqlUser                 = textMySqlUser.Text;
     CentralConnectionCur.MySqlPassword             = CentralConnections.Encrypt(textMySqlPassword.Text, FormCentralManager.EncryptionKey);
     CentralConnectionCur.ServiceURI                = textServiceURI.Text;
     CentralConnectionCur.WebServiceIsEcw           = checkWebServiceIsEcw.Checked;
     CentralConnectionCur.Note                      = textNote.Text;
     CentralConnectionCur.HasClinicBreakdownReports = checkClinicBreakdown.Checked;
     if (CentralConnectionCur.IsNew)
     {
         CentralConnectionCur.ItemOrder = LastItemOrder + 1;
         CentralConnections.Insert(CentralConnectionCur);
         CentralConnectionCur.IsNew = false;              //so a double-click immediately in FormCentralConnections doesn't insert again
     }
     else
     {
         CentralConnections.Update(CentralConnectionCur);
     }
     DialogResult = DialogResult.OK;
 }
Пример #6
0
        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();
        }