示例#1
0
/// <summary>
/// If SavedListUo is defined just return otherwise check in default folder for ListName
/// </summary>

        string ResolveSavedListUo()
        {
            if (SavedListUo != null)
            {
                return("CNLIST_" + SavedListUo.Id);
            }
            if (ListName.Text == "")
            {
                return("");
            }

            UserObject uo = new UserObject(UserObjectType.CnList, SS.I.UserName, ListName.Text);

            UserObjectTree.AssignDefaultObjectFolder(uo, UserObjectType.CnList);
            SavedListUo = UserObjectDao.ReadHeader(uo);
            if (SavedListUo != null)
            {
                return("CNLIST_" + SavedListUo.Id);
            }

            string errMsg = "List " + ListName.Text + " does not exist";

            MessageBoxMx.Show(errMsg, UmlautMobius.String, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            return(null);            // return null if nonexistant list
        }
示例#2
0
        internal void ZoomMenuItem_Click(object sender, EventArgs e)
        {
            ActivateZooming();

            string msg =
                @"To zoom in:
  - Hold down the Shift key and then click on the point to zoom in to or
  - Hold down the Shift key and then draw a rectangle around the 
    area to zoom in to or
  - Hold down the Ctrl key and click the plus (+) key or
  - Use the mouse wheel

To zoom out:
  - Hold down the Alt key and then click in the region to be zoomed out or
  - Hold down the Ctrl key and click the minus (-) key or
  - Use the mouse wheel

To scroll:
  - Use the scroll bars or
  - Hold down the Space key and then press and drag with the mouse or
  - Hold down the Ctrl key and then use the cursor (arrow) keys";

            MessageBoxMx.Show(msg);
            return;
        }
示例#3
0
        private void BrowseQueries_Click(object sender, EventArgs e)
        {
            string     prompt = "Select Query";
            UserObject uo     = UserObjectOpenDialog.ShowDialog(UserObjectType.Query, prompt, QueryUo);

            if (uo == null)
            {
                return;
            }
            Alert existingAlert = Alert.GetAlertByQueryId(uo.Id);

            if (existingAlert != null)                              // only 1 alert per query per user is allowed
            {
                if (Alert.Id <= 0 ||                                // if this is a new alert or
                    (Alert.Id > 0 && Alert.Id != existingAlert.Id)) // another alert exists for the query
                {
                    MessageBoxMx.Show("You already an existing alert for query " + Lex.Dq(uo.Name),
                                      "Mobius", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            Query q = QbUtil.ReadQuery(uo.Id);

            if (!Alert.QueryValidForAlert(q))
            {
                return;
            }

            QueryUo        = uo;
            QueryName.Text = QueryUo.Name;
        }
示例#4
0
/// <summary>
/// See if valid advanced calculated field
/// </summary>
/// <returns></returns>

        private bool IsValidAdvancedCalcField()
        {
            List <MetaColumn> mcList;

            string advExpr;

            if (Lex.IsNullOrEmpty(AdvancedExpr.Text))
            {
                MessageBoxMx.Show(
                    "The calculated field expression is blank", UmlautMobius.String);
                return(false);
            }

            try { advExpr = ParseAdvancedExpr(AdvancedExpr.Text, out mcList); }
            catch (Exception ex)
            {
                MessageBoxMx.Show(ex.Message, UmlautMobius.String);
                return(false);
            }

            string errmsg = QueryEngine.ValidateCalculatedFieldExpression(advExpr);

            if (!Lex.IsNullOrEmpty(errmsg))
            {
                MessageBoxMx.Show(
                    "Invalid calculated field expression:\r\n\r\n" + errmsg, UmlautMobius.String);
                return(false);
            }

            return(true);
        }
示例#5
0
/// <summary>
/// Run alert in background
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void RunAlert_Click(object sender, EventArgs e)
        {
            int    row, alertId;
            string msg = "";

            row = V.GetFocusedDataSourceRowIndex();
            if (row < 0)
            {
                return;
            }
            alertId = (int)DataTable.Rows[row]["AlertId"];

            string command = "Check Alert " + alertId + " forceEmail";

            try
            {
                CommandLine.StartBackgroundSession(command);
                msg =
                    "The Alert has been started in the background.\n" +
                    "You will receive an email when it completes.";
            }
            catch (Exception ex)
            {
                msg = "Failed to start background alert: " + ex.Message;
            }

            MessageBoxMx.Show(msg);

            return;
        }
示例#6
0
/// <summary>
/// See if valid basic calculated field
/// </summary>
/// <returns></returns>

        private bool IsValidBasicCalcField()
        {
            for (int cfcci = 0; cfcci < CfColCtls.Count; cfcci++)
            {
                CalcFieldColumnControl cfcc = CfColCtls[cfcci];

                bool validate = false;                 // decide if we should validate this field

                if (cfcci == 0)
                {
                    validate = true;                             // always validate 1st field
                }
                else if (cfcci == 1 && !Lex.StartsWith(Operation.Text, "none"))
                {
                    validate = true;                                                                             // validate 2nd field if operator is not "none"
                }
                else if (cfcc.FieldSelectorControl.MetaColumn != null)
                {
                    validate = true;
                }

                if (validate && !ValidateField(cfcc))
                {
                    return(false);
                }
            }

            if (!CondFormatRulesCtl.AreValid())             // are any rules valid
            {
                Tabs.SelectedTabPageIndex = 1;
                return(false);
            }

            CondFormatRules rules = CondFormatRulesCtl.GetRules();

            if (CalcField.SourceColumnType == MetaColumnType.Structure && rules.Count == 0)
            {
                Tabs.SelectedTabPageIndex = 1;
                MessageBoxMx.Show(
                    "Calculated fields on chemical structures must use classification\r\n" +
                    "for the calculated field value", UmlautMobius.String);
                return(false);
            }

            if (rules.Count > 0)             // must have at least one rule

            {
                foreach (CondFormatRule rule in rules)         // must have name for each rule
                {
                    if (String.IsNullOrEmpty(rule.Name))
                    {
                        Tabs.SelectedTabPageIndex = 1;
                        MessageBoxMx.Show("A name must be defined for each rule if using rule names the as calculated value", UmlautMobius.String);
                        return(false);
                    }
                }
            }

            return(true);
        }
示例#7
0
        private void DeleteDatabase_Click(object sender, EventArgs e)
        {
            DataRow      dr;
            UcdbDatabase ucdb;
            int          ri;

            ri = GridView.FocusedRowHandle;
            if (ri < 0)
            {
                MessageBoxMx.ShowError("You must select the user compound database first");
                return;
            }

            dr   = DataTable.Rows[ri];
            ucdb = (UcdbDatabase)dr["Ucdb"];

            DialogResult dR = MessageBoxMx.Show("Are you sure you want to delete user compound database: \"" +
                                                ucdb.Name + "\"?", UmlautMobius.String, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dR != DialogResult.Yes)
            {
                return;
            }

            ucdb.RowState = UcdbRowState.Deleted;  // mark for deletion
            Udbs.UpdateDatabase(ucdb);             // mark data for deletion

            DataTable.Rows.RemoveAt(ri);
            RenumberRows();
        }
示例#8
0
        private void MoveColumnDown_Click(object sender, EventArgs e)
        {
            if (!AllowColumnModifications())
            {
                return;
            }

            int r = View.FocusedRowHandle;

            if (r < 0)
            {
                return;
            }
            if ((AnnotationTable && r <= 0) || (UserDatabase && r <= 1) ||             // keep initial col position(s) as is
                r >= View.RowCount - 1)
            {
                MessageBoxMx.Show("This column can't be moved down.");
                return;
            }

            DataRow dr = ColGridDataTable.NewRow();

            dr.ItemArray = ColGridDataTable.Rows[r].ItemArray;
            ColGridDataTable.Rows.RemoveAt(r);
            ColGridDataTable.Rows.InsertAt(dr, r + 1);
            View.FocusedRowHandle = r + 1;
            return;
        }
示例#9
0
        private void DeleteFavoriteMenuItem_Click(object sender, EventArgs e)
        {
            SessionManager.LogCommandUsage("ContentsFavoritesDelete");

            MetaTreeNode node = QbContentsTree.CurrentContentsMetaTreeNode;

            if (node == null)
            {
                return;
            }
            if (String.IsNullOrEmpty(node.Target))
            {
                return;
            }

            DialogResult dr = MessageBoxMx.Show(
                "Are you sure you want to delete: '" + node.Label + "' ?",
                "Confirm Delete", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr != DialogResult.Yes)
            {
                return;
            }

            SessionManager.Instance.MainMenuControl.DeleteFavorite(node);
        }
示例#10
0
        /// <summary>
        /// If the file is a UNC name check to see if the services can write to it
        /// </summary>
        /// <param name="fileName"></param>

        public static DialogResult CanWriteFileFromServiceAccount(
            string fileName)
        {
            //if (DisplayedUncWarningMessage) return DialogResult.OK;

            if (!fileName.StartsWith(@"\\"))
            {
                return(DialogResult.OK);
            }
            ;

            Progress.Show("Checking Mobius background write privileges...", UmlautMobius.String, false);
            bool canWrite = ServerFile.CanWriteFileFromServiceAccount(fileName);

            Progress.Hide();
            //canWrite = false; // debug
            if (canWrite)
            {
                return(DialogResult.OK);
            }

            DialogResult dr = MessageBoxMx.Show(
                "The specified file is in a shared Windows network folder.\n" +
                "Mobius can't currently perform a background export directly to this file.\n" +
                "However, if write access to this shared folder is granted to the <mobiusAccount>\n" +
                "account then Mobius will be able to export directly to the specified file.",
                "Mobius", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            DisplayedUncWarningMessage = true;
            return(dr);
        }
示例#11
0
        public bool ValidateData()
        {
            bool dayChecked =
                checkBoxSunday.Checked ||
                checkBoxMonday.Checked ||
                checkBoxTuesday.Checked ||
                checkBoxWednesday.Checked ||
                checkBoxThursday.Checked ||
                checkBoxFriday.Checked ||
                checkBoxSaturday.Checked;

            if (!dayChecked)
            {
                MessageBoxMx.Show("You must select a day of the week.");
                return(false);
            }

            if (textEditNumWeeks.EditValue == null || int.Parse(textEditNumWeeks.EditValue.ToString()) < 1)
            {
                MessageBoxMx.Show("You must enter the weekly interval.");
                return(false);
            }

            return(true);
        }
示例#12
0
/// <summary>
/// Change owner
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void ChangeOwnerMenuItem_Click(object sender, EventArgs e)
        {
            {
                List <string> users    = SecurityUtil.GetAllUsers();
                string        prompt   = "Enter the user name of the person to transfer ownership of " + Lex.AddDoubleQuotes(Uo.Name) + " to:";
                string        newOwner = InputBoxMx.Show(prompt, "Change Owner", "", users, -1, -1);
                if (Lex.IsNullOrEmpty(newOwner))
                {
                    return;
                }

                string newUserName = SecurityUtil.GetInternalUserName(newOwner);
                if (Lex.IsNullOrEmpty(newUserName))
                {
                    return;
                }

                string result = UserObjectUtil.ChangeOwner(Uo.Id, newUserName);
                if (!Lex.IsNullOrEmpty(result))
                {
                    MessageBoxMx.Show(result);
                    DialogResult = DialogResult.Cancel;                     // close the dialog
                }
                return;
            }
        }
示例#13
0
        /// <summary>
        /// See if saving this query would have an acceptable effect
        /// on any persisted alert results.
        /// </summary>
        /// <param name="q"></param>
        /// <returns>True if ok to save</returns>

        public static bool QuerySaveOkForAlertResults(
            Query q)
        {
            Alert alert = GetAlertByQueryId(q.UserObject.Id);

            if (alert == null)
            {
                return(true);                                  // no alert so ok
            }
            if (alert.LastCheck != DateTime.MinValue &&        // has alert been checked?
                q.AlertQueryState != GetAlertQueryCriteria(q)) // have criteria changed?
            {
                DialogResult dr = MessageBoxMx.Show(
                    "Since the search criteria for this new-data alerting query have changed the \n" +
                    "alert state will be \"reset\" which means that the next time the alert runs it will\n" +
                    "not mail out any detected data changes but will simply record the current state of\n" +
                    "the data with respect to the new search criteria. Subsequent alert runs will then\n" +
                    "check for new data changes.\n\n" +
                    "Do you still want to continue to save the query?",
                    UmlautMobius.String, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (dr != DialogResult.Yes)
                {
                    return(false);
                }

                alert.LastCheck   = DateTime.MinValue;    // reset the alert
                alert.LastResults = null;                 // (should already be null)
                alert.Write();
            }

            return(true);
        }
示例#14
0
        /// <summary>
        /// Return true if query is ok for alert or there is no alert associated with query
        /// </summary>
        /// <param name="q"></param>
        /// <returns></returns>

        public static bool QueryValidForAlert(Query q)
        {
            int criteriaCount = q.GetCriteriaCount(true, false);             // count simple criteria

            if (q.LogicType == QueryLogicType.Complex && !String.IsNullOrEmpty(q.ComplexCriteria))
            {
                criteriaCount = 1;
            }

            if (criteriaCount == 0)
            {
                MessageBoxMx.Show(
                    "An alert cannot be defined on this query because it does not contain any search criteria.\n" +
                    "You may want to use the \"Where data exists\" criteria on one of the fields in the query.",
                    UmlautMobius.String, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            if (q.KeyCriteria.ToLower().IndexOf("in list current") >= 0 || Lex.Contains(q.KeyCriteria, "in list " + UserObject.TempFolderNameQualified))
            {
                MessageBoxMx.Show(
                    "An alert cannot be defined on this query because it uses a volatile temporary list criteria.\n" +
                    "If you save the temporary list and then use this saved list as the criteria then you can define an alert on the query.",
                    UmlautMobius.String, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            return(true);
        }
示例#15
0
        /// <summary>
        /// Run Query & return any error message
        /// </summary>
        /// <param name="query"></param>
        /// <param name="queryDest"></param>
        /// <param name="outputFormContext"></param>
        /// <param name="browseExistingResults">If true browse existing results</param>
        /// <param name="suppressNoDataMessage"></param>
        /// <returns>Command command or an error message</command></returns>

        public static string RunQuery(
            Query query,
            OutputDest outputDest,
            OutputFormContext outputFormContext,
            ExitingQueryResultsDelegate exitingQueryResultsCallBack = null,
            bool browseExistingResults = false,
            bool suppressNoDataMessage = false
            )
        {
            ResultsFormat rf = new ResultsFormat();

            rf.OutputDestination = outputDest;
            rf.OutputFormContext = outputFormContext;
            rf.CustomExitingQueryResultsCallback = exitingQueryResultsCallBack;
            rf.SuppressNoDataMessage             = suppressNoDataMessage;

            string response = RunQuery2(query, rf, browseExistingResults);

            query.UseResultKeys = false;             // turn off use of keys

            if (response != "" && !response.ToLower().StartsWith("command") && !suppressNoDataMessage)
            {
                MessageBoxMx.Show(
                    response, UmlautMobius.String,
                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                response = "Command EditQuery";
            }

            return(response);
        }
示例#16
0
        /// <summary>
        /// Show MessageBox
        /// </summary>
        /// <param name="text"></param>
        /// <param name="caption"></param>
        /// <param name="buttons"></param>
        /// <param name="icon"></param>
        /// <returns></returns>

        public DialogResult MessageBoxEx_Show(
            string text,
            string caption,
            MessageBoxButtons buttons,
            MessageBoxIcon icon)
        {
            return(MessageBoxMx.Show(text, caption, buttons, icon));
        }
示例#17
0
 private void OK_Click(object sender, EventArgs e)
 {
     if (this.Serialize() == "")
     {
         MessageBoxMx.Show("At least one item must be selected", UmlautMobius.String);
         return;
     }
     this.DialogResult = DialogResult.OK;
 }
示例#18
0
 public bool ValidateData()
 {
     if (textBoxEveryDay.EditValue == null || int.Parse(textBoxEveryDay.EditValue.ToString()) < 1)
     {
         MessageBoxMx.Show("You must select a valid number of days.");
         return(false);
     }
     return(true);
 }
示例#19
0
        /// <summary>
        /// Change the owner of a UserObject
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>

        public static string ChangeOwner(
            int objId,
            string newOwner)
        {
            newOwner = newOwner.ToUpper();

            UserObject uo = UserObjectDao.ReadHeader(objId);

            if (uo == null)
            {
                return("User object not found: " + objId);
            }
            if (uo.Owner == newOwner)
            {
                return("This user object is already owned by " + newOwner);
            }
            if (!Security.IsAdministrator(SS.I.UserName) && Lex.Ne(uo.Owner, SS.I.UserName))
            {
                return("You're not authorized to change the owner of this user object");
            }

            if (!Security.CanLogon(newOwner))
            {
                return("Not a valid userId: " + newOwner);
            }

            UserInfo ui  = Security.GetUserInfo(newOwner);
            string   msg = "Are you sure you want to transfer ownership of " + Lex.AddDoubleQuotes(uo.Name) + "\n" +
                           "to " + ui.FullName + "?";
            DialogResult dr = MessageBoxMx.Show(msg, "Change Owner", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr != DialogResult.Yes)
            {
                return("");
            }

            UserObject uo2 = uo.Clone();

            uo2.Owner = newOwner;
            UserObjectTree.GetValidUserObjectTypeFolder(uo2);          // set valid parent folder
            Permissions.UpdateAclForNewOwner(uo2, uo.Owner, newOwner); // Set the ACL to give us r/w access
            uo2.Content = "ChangeOwner";                               // indicate changing owner
            if (UserObjectDao.ReadHeader(uo2) != null)
            {
                return("A user object with that name already exists for the specified new user");
            }
            UserObjectDao.UpdateHeader(uo2, false, false);

            if (Data.InterfaceRefs.IUserObjectIUD != null)
            {
                Data.InterfaceRefs.IUserObjectIUD.UserObjectDeleted(uo);                                                        // remove from view
            }
            string newOwnerName = SecurityUtil.GetPersonNameReversed(newOwner);

            return("Ownership of \"" + uo2.Name + "\" has been changed to " + newOwnerName);
        }
示例#20
0
        private void DeleteAllMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBoxMx.Show(
                "Are you sure you want to delete all rows?", "Delete All Rows",
                MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                ItemGridDataTable.Clear();
            }
        }
示例#21
0
        /// <summary>
        /// See if valid Spotfire link
        /// </summary>
        /// <returns></returns>

        private bool IsValidSpotfireLink()
        {
            if (Lex.IsUndefined(LibraryPath.Text))
            {
                LibraryPath.Focus();
                MessageBoxMx.Show("You must define the Library Path for the linked analysis");
                return(false);
            }

            return(true);
        }
示例#22
0
        private void EditExportSetup_Click(object sender, EventArgs e)
        {
            DialogResult dr;

            string exportFormat = ExportFileFormat.Text;

            if (Lex.Eq(exportFormat, "None"))
            {
                MessageBoxMx.Show("You must select a format first", UmlautMobius.String);
                return;
            }

            bool useExistingOptionValues = true;

            if (ExportParms == null)
            {
                ExportParms             = new ResultsFormat();
                useExistingOptionValues = false;
            }

            ExportParms.RunInBackground = true;             // alerts are always run in the background

            if (Lex.Eq(exportFormat, "CSV / Text File"))
            {
                dr = SetupTextFile.ShowDialog(ExportParms, useExistingOptionValues);
            }

            else if (Lex.Eq(exportFormat, "Excel Worksheet"))
            {
                dr = SetupExcel.ShowDialog(ExportParms, useExistingOptionValues);
            }

            else if (Lex.Eq(exportFormat, "MS Word Table"))
            {
                dr = SetupWord.ShowDialog(ExportParms, useExistingOptionValues);
            }

            else if (Lex.Eq(exportFormat, "SDFile"))
            {
                dr = SetupSdFile.ShowDialog(ExportParms, useExistingOptionValues);
            }

            else if (Lex.StartsWith(exportFormat, "Mobius"))
            {
                MessageBoxMx.Show(                 // just give a message
                    "When a full result set is exported in the Native Mobius Format\n" +
                    "the exported data will be automatically displayed when the\n" +
                    "associated query is opened. There is no need to supply any\n" +
                    "additional export parameters.");
            }

            ExportParms.RunInBackground = true;             // reset in case cleared in dialog
            return;
        }
示例#23
0
/// <summary>
/// Columns can be modified only if data has not been modified since last save
/// </summary>
/// <returns></returns>
        bool AllowColumnModifications()
        {
            if (!Dtm.DataModified || !PersistedDataExists)
            {
                return(true);
            }
            else
            {
                MessageBoxMx.Show("You must save the current changes before you can modify the table definition");
                return(false);
            }
        }
示例#24
0
 bool AllowDataViewing()
 {
     if (!ColumnsModified || !PersistedDataExists)
     {
         return(true);
     }
     else
     {
         MessageBoxMx.Show("You must save the current changes to the table definition before you can view data");
         return(false);
     }
 }
示例#25
0
        public DialogResult ShowDialog2(
            UserObject uo,
            UserDataImportParms importParms,
            string title,
            string filter,
            string ext,
            bool setForm)
        {
            if (setForm)
            {
                FileName.Text               = importParms.FileName;
                HeaderLine.Checked          = importParms.FirstLineHeaders;
                HeaderLine.Enabled          = Lex.Ne(ext, ".sdf");
                DeleteExistingData.Checked  = importParms.DeleteExisting;
                ImportInBackground.Checked  = importParms.ImportInBackground;
                CheckForFileUpdates.Checked = importParms.CheckForFileUpdates;
                Text       = title;
                FileFilter = filter;
                DefaultExt = ext;
            }

GetInput:
            DialogResult dr = ShowDialog(SessionManager.ActiveForm);

            if (dr == DialogResult.Cancel)
            {
                return(dr);
            }

            importParms.FileName           = FileName.Text;
            importParms.ClientFileModified = FileUtil.GetFileLastWriteTime(importParms.FileName);

            importParms.FirstLineHeaders = HeaderLine.Checked;

            importParms.DeleteExisting = DeleteExistingData.Checked;
            if (importParms.DeleteExisting && uo.Id > 0)
            {
                dr = MessageBoxMx.Show(
                    "Are you sure you want to delete all existing data?", UmlautMobius.String,
                    MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (dr != DialogResult.Yes)
                {
                    goto GetInput;
                }
            }

            importParms.ImportInBackground  = ImportInBackground.Checked;
            importParms.CheckForFileUpdates = CheckForFileUpdates.Checked;

            DialogResult = DialogResult.OK;
            return(dr);
        }
示例#26
0
/// <summary>
/// Disable user
/// </summary>
/// <param name="commandLine"></param>
/// <returns></returns>

        public static string DisableUser(
            string commandLine)
        {
            string tok, msg;

            UserInfo ui  = new UserInfo();
            Lex      lex = new Lex();

            lex.OpenString(commandLine);
            string userName    = lex.Get();
            bool   interactive = Lex.IsNullOrEmpty(userName);

            while (true)
            {
                if (interactive)
                {
                    userName = InputBoxMx.Show("Enter the Username of the user to disable:", "Disable User", userName);
                    if (Lex.IsNullOrEmpty(userName))
                    {
                        return("");
                    }
                }

                userName = userName.ToUpper();
                if (Security.ReadUserInfo(userName) == null)
                {
                    msg = "User doesn't exist: " + userName;
                    if (!interactive)
                    {
                        return(msg);
                    }
                    MessageBoxMx.ShowError(msg);
                    continue;
                }

                try
                {
                    Security.RevokePrivilege(userName, "Logon");
                    msg = "User disabled: " + userName;
                }
                catch (Exception ex) { msg = "Disable user failed for: " + userName; }
                if (!interactive)
                {
                    return(msg);
                }

                MessageBoxMx.Show(msg);
                userName = "";
                continue;
            }
        }
示例#27
0
        private void ClearListMenuItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DialogResult dr = MessageBoxMx.Show(
                "Are you sure you want to clear the list?", "Clear List",
                MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                CidListCtl.Text = "";
                CidCtl.Text     = HeavyAtoms.Text = Weight.Text = Formula.Text = "";
                MolCtl.ClearMolecule();
                DisplayFrame.Text = "Item 1 of 1";
            }
            CidListCtl.Focus();
        }
示例#28
0
        /// <summary>
        /// Build a Spotfire view for the QueryTable in the current query
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>

        public static string StoreSpotfireQueryTableSql()
        {
            string sqlStmtName = QbUtil.Query.UserObject.Name;

            if (Lex.StartsWith(sqlStmtName, "SF_"))             // trim the sf prefix
            {
                sqlStmtName = sqlStmtName.Substring(3);
            }

            while (true)
            {
                sqlStmtName = InputBoxMx.Show("Name to assign to stored SQL:", "Store Mobius QueryTable SQL for Use by Spotfire", sqlStmtName);
                if (Lex.IsUndefined(sqlStmtName))
                {
                    return("");
                }

                string existingSql = QueryEngine.ReadSpotfireSql(sqlStmtName, 0);
                if (Lex.IsDefined(existingSql))
                {
                    DialogResult dr = MessageBoxMx.Show(
                        "Sql statement " + sqlStmtName + " already exists.\r\n" +
                        "Do you want to overwrite it?",
                        "Confirm Overwrite", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                    if (dr == DialogResult.No)
                    {
                        continue;                                            // allow name reentry
                    }
                    else if (dr == DialogResult.Cancel)
                    {
                        return("");
                    }
                }

                break;
            }

            Progress.Show("Saving SQL...");
            int id = QueryEngine.SaveSpotfireSql(sqlStmtName, QbUtil.Query);

            Progress.Hide();

            string msg = "Sql statement " + sqlStmtName + " has been stored.";

            return(msg);
        }
示例#29
0
        /// <summary>
        /// AddToFavoritesList
        /// </summary>
        /// <param name="molEditorCtl"></param>
        /// <param name="searchType"></param>

        public static void AddToFavoritesList(
            MoleculeControl molEditorCtl,
            StructureSearchType searchType)
        {
            MoleculeListItem sli = null;
            DialogResult     dr;

            MoleculeMx mol = molEditorCtl.Molecule;

            if (MoleculeMx.IsUndefined(mol))
            {
                return;
            }

            mol = mol.Clone();             // make a copy for the list

            sli = FindStructure(mol, GetFavoriteStructuresList());
            if (sli != null)
            {
                dr = MessageBoxMx.Show("The current molecule already exists in Favorites list under the name: " + sli.Name + "\r\n" +
                                       "Do you still want the add the current query molecule to the Favorites list?", "Molecule already in Favorites", MessageBoxButtons.YesNoCancel);

                if (dr != DialogResult.Yes)
                {
                    return;
                }
            }

            string name = molEditorCtl.GetTemporaryStructureTag();

            name = InputBoxMx.Show("Enter the name that you want to assign to the molecule", "Enter Name", name);
            if (Lex.IsUndefined(name))
            {
                return;
            }

            sli              = new MoleculeListItem();
            sli.Name         = name;
            sli.Molecule     = mol;
            sli.UpdateDate   = DateTime.Now;
            sli.MoleculeType = StructureSearchTypeUtil.StructureSearchTypeToExternalName(searchType);
            FavoritesList.ItemList.Insert(0, sli);

            SaveStructureList(FavoritesList, FavoritesPreferencesParmName);
            return;
        }
示例#30
0
/// <summary>
/// Copy the structure associated with the specified compound id to the clipboard
/// </summary>
/// <param name="cn"></param>
/// <param name="mt"></param>
/// <returns></returns>

        public static bool CopyCompoundIdStructureToClipBoard(
            string cn,
            MetaTable mt)
        {
            MoleculeMx mol = MoleculeUtil.SelectMoleculeForCid(cn, mt);

            if (mol != null)
            {
                MoleculeControl.CopyMoleculeToClipboard(mol);
                return(true);
            }
            else
            {
                MessageBoxMx.Show("Unable to retrieve structure");
                return(false);
            }
        }