当前位置: 首页>>代码示例>>C#>>正文


C# acUI.acUI.IsGUID方法代码示例

本文整理汇总了C#中acUI.acUI.IsGUID方法的典型用法代码示例。如果您正苦于以下问题:C# acUI.acUI.IsGUID方法的具体用法?C# acUI.acUI.IsGUID怎么用?C# acUI.acUI.IsGUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在acUI.acUI的用法示例。


在下文中一共展示了acUI.acUI.IsGUID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: wmApproveTask

        public string wmApproveTask(string sTaskID, string sMakeDefault)
        {
            dataAccess dc = new dataAccess();

            acUI.acUI ui = new acUI.acUI();

            try
            {
                string sUserID = ui.GetSessionUserID();

                if (ui.IsGUID(sTaskID) && ui.IsGUID(sUserID))
                {
                    string sErr = "";
                    string sSQL = "";

                    //check to see if this is the first task to be approved.
                    //if it is, we will make it default.
                    sSQL = "select count(*) from task" +
                        " where original_task_id = " +
                        " (select original_task_id from task where task_id = '" + sTaskID + "')" +
                        " and task_status = 'Approved'";

                    int iCount = 0;
                    if (!dc.sqlGetSingleInteger(ref iCount, sSQL, ref sErr))
                    {
                        throw new Exception("Unable to count Tasks in this family.." + sErr);
                    }

                    if (iCount == 0)
                        sMakeDefault = "1";

                    dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);

                    //flag all the other tasks as not default if this one is meant to be
                    if (sMakeDefault == "1")
                    {
                        sSQL = "update task set" +
                            " default_version = 0" +
                            " where original_task_id =" +
                            " (select original_task_id from (select original_task_id from task where task_id = '" + sTaskID + "') as x)";
                        oTrans.Command.CommandText = sSQL;
                        if (!oTrans.ExecUpdate(ref sErr))
                        {
                            throw new Exception("Unable to update task [" + sTaskID + "]." + sErr);
                        }
                        sSQL = "update task set" +
                        " task_status = 'Approved'," +
                        " default_version = 1" +
                        " where task_id = '" + sTaskID + "';";
                    }
                    else
                    {
                        sSQL = "update task set" +
                            " task_status = 'Approved'" +
                            " where task_id = '" + sTaskID + "'";
                    }

                    oTrans.Command.CommandText = sSQL;
                    if (!oTrans.ExecUpdate(ref sErr))
                    {
                        throw new Exception("Unable to update task [" + sTaskID + "]." + sErr);
                    }

                    oTrans.Commit();

                    ui.WriteObjectChangeLog(Globals.acObjectTypes.Task, sTaskID, "Status", "Development", "Approved");
                    if (sMakeDefault == "1")
                        ui.WriteObjectChangeLog(Globals.acObjectTypes.Task, sTaskID, "Default", "Set as Default Version.");

                }
                else
                {
                    throw new Exception("Unable to update task. Missing or invalid task id. [" + sTaskID + "]");
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            return "";
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:82,代码来源:taskMethods.asmx.cs

示例2: wmUpdateEcoTemplateDetail

        public string wmUpdateEcoTemplateDetail(string sEcoTemplateID, string sColumn, string sValue)
        {
            dataAccess dc = new dataAccess();

            acUI.acUI ui = new acUI.acUI();

            try
            {
                string sUserID = ui.GetSessionUserID();

                if (ui.IsGUID(sEcoTemplateID) && ui.IsGUID(sUserID))
                {
                    string sErr = "";
                    string sSQL = "";

                    //we encoded this in javascript before the ajax call.
                    //the safest way to unencode it is to use the same javascript lib.
                    //(sometimes the javascript and .net libs don't translate exactly, google it.)
                    sValue = ui.unpackJSON(sValue);

                    // check for existing name
                    if (sColumn == "ecotemplate_name")
                    {
                        sSQL = "select ecotemplate_id from ecotemplate where " +
                                " ecotemplate_name = '" + sValue.Replace("'", "''") + "'" +
                                " and ecotemplate_id <> '" + sEcoTemplateID + "'";

                        string sValueExists = "";
                        if (!dc.sqlGetSingleString(ref sValueExists, sSQL, ref sErr))
                            throw new Exception("Unable to check for existing names [" + sEcoTemplateID + "]." + sErr);

                        if (!string.IsNullOrEmpty(sValueExists))
                            return sValue + " exists, please choose another value.";
                    }

                    string sSetClause = sColumn + "='" + sValue.Replace("'", "''") + "'";

                    //some columns on this table allow nulls... in their case an empty sValue is a null
                    if (sColumn == "ecotemplate_desc")
                    {
                        if (sValue.Replace(" ", "").Length == 0)
                            sSetClause = sColumn + " = null";
                        else
                            sSetClause = sColumn + "='" + sValue.Replace("'", "''") + "'";
                    }

                    sSQL = "update ecotemplate set " + sSetClause + " where ecotemplate_id = '" + sEcoTemplateID + "'";
                    //}

                    if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
                        throw new Exception("Unable to update Eco Template [" + sEcoTemplateID + "]." + sErr);

                    ui.WriteObjectChangeLog(Globals.acObjectTypes.EcoTemplate, sEcoTemplateID, sColumn, sValue);
                }
                else
                {
                    throw new Exception("Unable to update Eco Template. Missing or invalid id [" + sEcoTemplateID + "].");
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            return "";
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:66,代码来源:uiMethods.asmx.cs

示例3: wmRenameCodeblock

        public string wmRenameCodeblock(string sTaskID, string sOldCodeblockName, string sNewCodeblockName)
        {
            dataAccess dc = new dataAccess();

            acUI.acUI ui = new acUI.acUI();
            FunctionTemplates.HTMLTemplates ft = new FunctionTemplates.HTMLTemplates();

            try
            {
                if (ui.IsGUID(sTaskID))
                {

                    // first make sure we are not trying to rename it something that already exists.
                    string sErr = "";
                    string sSQL = "select count(*) from task_codeblock where task_id = '" + sTaskID + "'" +
                        " and codeblock_name = '" + sNewCodeblockName + "'";
                    int iCount = 0;

                    if (!dc.sqlGetSingleInteger(ref iCount, sSQL, ref sErr))
                    {
                        throw new Exception("Unable to check codeblock names for task." + sErr);
                    }
                    if (iCount != 0)
                    {
                        return ("Codeblock Name already in use, choose another.");
                    }

                    // do it
                    dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);

                    //update the codeblock table
                    sSQL = "update task_codeblock set codeblock_name = '" + sNewCodeblockName +
                        "' where codeblock_name = '" + sOldCodeblockName +
                        "' and task_id = '" + sTaskID + "'";

                    oTrans.Command.CommandText = sSQL;
                    if (!oTrans.ExecUpdate(ref sErr))
                    {
                        throw new Exception(sErr);
                    }

                    //and any steps in that codeblock
                    sSQL = "update task_step set codeblock_name = '" + sNewCodeblockName +
                        "' where codeblock_name = '" + sOldCodeblockName +
                        "' and task_id = '" + sTaskID + "'";

                    oTrans.Command.CommandText = sSQL;
                    if (!oTrans.ExecUpdate(ref sErr))
                    {
                        throw new Exception(sErr);
                    }

                    //the fun part... rename it where it exists in any steps
                    //but this must be in a loop of only the steps where that codeblock reference exists.
                    sSQL = "select step_id from task_step" +
                        " where task_id = '" + sTaskID + "'" +
                        " and ExtractValue(function_xml, '//codeblock[1]') = '" + sOldCodeblockName + "'";
                    oTrans.Command.CommandText = sSQL;
                    DataTable dtSteps = new DataTable();
                    if (!oTrans.ExecGetDataTable(ref dtSteps, ref sErr))
                    {
                        throw new Exception("Unable to get steps referencing the Codeblock." + sErr);
                    }

                    foreach (DataRow dr in dtSteps.Rows)
                    {
                        ft.SetNodeValueinXMLColumn("task_step", "function_xml", "step_id = '" + dr["step_id"].ToString() + "'", "//codeblock[. = '" + sOldCodeblockName + "']", sNewCodeblockName);
                    }

                    //all done
                    oTrans.Commit();

                    return sErr;

                }
                else
                {
                    throw new Exception("Unable to get codeblocks for task. Missing or invalid task_id.");
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:86,代码来源:taskMethods.asmx.cs

示例4: wmUpdateTaskParam

        public string wmUpdateTaskParam(string sType, string sID, string sParamID,
            string sName, string sDesc,
            string sRequired, string sPrompt, string sEncrypt, string sPresentAs, string sValues)
        {
            dataAccess dc = new dataAccess();

            acUI.acUI ui = new acUI.acUI();
            FunctionTemplates.HTMLTemplates ft = new FunctionTemplates.HTMLTemplates();

            if (!ui.IsGUID(sID))
                throw new Exception("Invalid or missing ID.");

            string sErr = "";
            string sSQL = "";

            //we encoded this in javascript before the ajax call.
            //the safest way to unencode it is to use the same javascript lib.
            //(sometimes the javascript and .net libs don't translate exactly, google it.)
            sDesc = ui.unpackJSON(sDesc).Trim();

            //normalize and clean the values
            sRequired = (dc.IsTrue(sRequired) ? "true" : "false");
            sPrompt = (dc.IsTrue(sPrompt) ? "true" : "false");
            sEncrypt = (dc.IsTrue(sEncrypt) ? "true" : "false");
            sName = sName.Trim().Replace("'", "''");

            string sTable = "";
            string sXML = "";
            string sParameterXPath = "//parameter[@id = \"" + sParamID + "\"]";  //using this to keep the code below cleaner.

            if (sType == "ecosystem")
                sTable = "ecosystem";
            else if (sType == "task")
                sTable = "task";

            bool bParamAdd = false;
            //bool bParamUpdate = false;

            //if sParamID is empty, we are adding
            if (string.IsNullOrEmpty(sParamID))
            {
                sParamID = "p_" + ui.NewGUID();
                sParameterXPath = "//parameter[@id = \"" + sParamID + "\"]";  //reset this if we had to get a new id

                //does the task already have parameters?
                sSQL = "select parameter_xml from " + sTable + " where " + sType + "_id = '" + sID + "'";
                if (!dc.sqlGetSingleString(ref sXML, sSQL, ref sErr))
                    throw new Exception(sErr);

                string sAddXML = "<parameter id=\"" + sParamID + "\" required=\"" + sRequired + "\" prompt=\"" + sPrompt + "\" encrypt=\"" + sEncrypt + "\">" +
                    "<name>" + sName + "</name>" +
                    "<desc>" + sDesc + "</desc>" +
                    "</parameter>";

                if (string.IsNullOrEmpty(sXML))
                {
                    //XML doesn't exist at all, add it to the record
                    sAddXML = "<parameters>" + sAddXML + "</parameters>";

                    sSQL = "update " + sTable + " set " +
                        " parameter_xml = '" + sAddXML + "'" +
                        " where " + sType + "_id = '" + sID + "'";

                    if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
                        throw new Exception(sErr);

                    bParamAdd = true;
                }
                else
                {
                    //XML exists, add the node to it
                    ft.AddNodeToXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", "//parameters", sAddXML);
                    bParamAdd = true;
                }
            }
            else
            {
                //update the node values
                ft.SetNodeValueinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath + "/name", sName);
                ft.SetNodeValueinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath + "/desc", sDesc);
                //and the attributes
                ft.SetNodeAttributeinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath, "required", sRequired);
                ft.SetNodeAttributeinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath, "prompt", sPrompt);
                ft.SetNodeAttributeinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath, "encrypt", sEncrypt);

                bParamAdd = false;
            }

            // not clean at all handling both tasks and ecosystems in the same method, but whatever.
            if (bParamAdd)
            {
                if (sType == "task") { ui.WriteObjectAddLog(Globals.acObjectTypes.Task, sID, "Parameter", "Added Parameter:" + sName ); };
                if (sType == "ecosystem") { ui.WriteObjectAddLog(Globals.acObjectTypes.Ecosystem, sID, "Parameter", "Added Parameter:" + sName); };
            }
            else
            {
                // would be a lot of trouble to add the from to, why is it needed you have each value in the log, just scroll back
                // so just add a changed message to the log
                if (sType == "task") { dc.addSecurityLog(ui.GetSessionUserID(), Globals.SecurityLogTypes.Object, Globals.SecurityLogActions.ObjectModify, Globals.acObjectTypes.Task, sID, "Parameter Changed:[" + sName + "]", ref sErr); };
                if (sType == "ecosystem") { dc.addSecurityLog(ui.GetSessionUserID(), Globals.SecurityLogTypes.Object, Globals.SecurityLogActions.ObjectModify, Globals.acObjectTypes.Ecosystem, sID, "Parameter Changed:[" + sName + "]", ref sErr); };
//.........这里部分代码省略.........
开发者ID:remotesyssupport,项目名称:cato,代码行数:101,代码来源:taskMethods.asmx.cs

示例5: wmAddStep

        public string wmAddStep(string sTaskID, string sCodeblockName, string sItem)
        {
            dataAccess dc = new dataAccess();
            FunctionTemplates.HTMLTemplates ft = new FunctionTemplates.HTMLTemplates();
            acUI.acUI ui = new acUI.acUI();

            try
            {
                string sUserID = ui.GetSessionUserID();

                string sStepHTML = "";
                string sErr = "";
                string sSQL = "";
                string sNewStepID = "";

                if (!ui.IsGUID(sTaskID))
                    throw new Exception("Unable to add step. Invalid or missing Task ID. [" + sTaskID + "]" + sErr);

                //now, the sItem variable may have a function name (if it's a new command)
                //or it may have a guid (if it's from the clipboard)

                //so, if it's a guid after stripping off the prefix, it's from the clipboard

                //the function has a fn_ or clip_ prefix on it from the HTML.  Strip it off.
                //FIX... test the string to see if it BEGINS with fn_ or clip_
                //IF SO... cut off the beginning... NOT a replace operation.
                if (sItem.StartsWith("fn_")) sItem = sItem.Remove(0, 3);
                if (sItem.StartsWith("clip_")) sItem = sItem.Remove(0, 5);

                //NOTE: !! yes we are adding the step with an order of -1
                //the update event on the client does not know the index at which it was dropped.
                //so, we have to insert it first to get the HTML... but the very next step
                //will serialize and update the entire sortable...
                //immediately replacing this -1 with the correct position

                if (ui.IsGUID(sItem))
                {
                    sNewStepID = sItem;

                    //copy from the clipboard (using the root_step_id to get ALL associated steps)
                    sSQL = "insert into task_step (step_id, task_id, codeblock_name, step_order, step_desc," +
                        " commented, locked, output_parse_type, output_row_delimiter, output_column_delimiter," +
                        " function_name, function_xml, variable_xml)" +
                        " select step_id, '" + sTaskID + "'," +
                        " case when codeblock_name is null then '" + sCodeblockName + "' else codeblock_name end," +
                        "-1,step_desc," +
                        "0,0,output_parse_type,output_row_delimiter,output_column_delimiter," +
                        "function_name,function_xml,variable_xml" +
                        " from task_step_clipboard" +
                        " where user_id = '" + sUserID + "'" +
                        " and root_step_id = '" + sItem + "'";

                    if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
                        throw new Exception("Unable to add step." + sErr);

                    ui.WriteObjectChangeLog(Globals.acObjectTypes.Task, sTaskID, sItem,
                        "Added Command from Clipboard to Codeblock:" + sCodeblockName);
                }
                else
                {
                    //add a new command
                    sNewStepID = ui.NewGUID();

                    //NOTE: !! yes we are doing some command specific logic here.
                    //Certain commands have different 'default' values for delimiters, etc.
                    //sOPM: 0=none, 1=delimited, 2=parsed
                    string sOPM = "0";

                    switch (sItem)
                    {
                        case "sql_exec":
                            sOPM = "1";
                            break;
                        case "win_cmd":
                            sOPM = "1";
                            break;
                        case "dos_cmd":
                            sOPM = "2";
                            break;
                        case "cmd_line":
                            sOPM = "2";
                            break;
                        case "http":
                            sOPM = "2";
                            break;
                        case "parse_text":
                            sOPM = "2";
                            break;
                        case "read_file":
                            sOPM = "2";
                            break;
                    }

                    sSQL = "insert into task_step (step_id, task_id, codeblock_name, step_order," +
                        " commented, locked, output_parse_type, output_row_delimiter, output_column_delimiter," +
                        " function_name, function_xml)" +
                           " select '" + sNewStepID + "'," +
                           "'" + sTaskID + "'," +
                           (string.IsNullOrEmpty(sCodeblockName) ? "NULL" : "'" + sCodeblockName + "'") + "," +
                           "-1," +
//.........这里部分代码省略.........
开发者ID:remotesyssupport,项目名称:cato,代码行数:101,代码来源:taskMethods.asmx.cs

示例6: wmSaveTaskUserSetting

        public void wmSaveTaskUserSetting(string sTaskID, string sSettingKey, string sSettingValue)
        {
            dataAccess dc = new dataAccess();

            acUI.acUI ui = new acUI.acUI();

            try
            {
                string sUserID = ui.GetSessionUserID();

                if (ui.IsGUID(sTaskID) && ui.IsGUID(sUserID))
                {
                    //1) get the settings
                    //2) update/add the appropriate value
                    //3) update the settings to the db

                    string sSettingXML = "";
                    string sErr = "";
                    string sSQL = "select settings_xml from users where user_id = '" + sUserID + "'";

                    if (!dc.sqlGetSingleString(ref sSettingXML, sSQL, ref sErr))
                    {
                        throw new Exception("Unable to get settings for user." + sErr);
                    }

                    if (sSettingXML == "")
                        sSettingXML = "<settings><debug><tasks></tasks></debug></settings>";

                    XDocument xDoc = XDocument.Parse(sSettingXML);
                    if (xDoc == null) throw new Exception("XML settings data for user is invalid.");

                    //we have to analyze the doc and see if the appropriate section exists.
                    //if not, we need to construct it
                    if (xDoc.Element("settings").Descendants("debug").Count() == 0)
                        xDoc.Element("settings").Add(new XElement("debug"));

                    if (xDoc.Element("settings").Element("debug").Descendants("tasks").Count() == 0)
                        xDoc.Element("settings").Element("debug").Add(new XElement("tasks"));

                    XElement xTasks = xDoc.Element("settings").Element("debug").Element("tasks");

                    //to search by attribute we must get back an array and we shouldn't have an array anyway
                    //so to be safe and clean, delete all matches and just add back the one we want
                    xTasks.Descendants("task").Where(
                        x => (string)x.Attribute("task_id") == sTaskID).Remove();

                    //add it
                    XElement xTask = new XElement("task");
                    xTask.Add(new XAttribute("task_id", sTaskID));
                    xTask.Add(new XAttribute(sSettingKey, sSettingValue));

                    xTasks.Add(xTask);

                    sSQL = "update users set settings_xml = '" + xDoc.ToString(SaveOptions.DisableFormatting) + "'" +
                        " where user_id = '" + sUserID + "'";
                    if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
                    {
                        throw new Exception("Unable to save Task User Setting." + sErr);
                    }

                    return;
                }
                else
                {
                    throw new Exception("Unable to run task. Missing or invalid task [" + sTaskID + "] or unable to get current user.");
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:73,代码来源:taskMethods.asmx.cs

示例7: wmToggleStepCommonSection

        public void wmToggleStepCommonSection(string sStepID, string sButton)
        {
            dataAccess dc = new dataAccess();

            acUI.acUI ui = new acUI.acUI();

            try
            {
                if (ui.IsGUID(sStepID))
                {
                    string sUserID = ui.GetSessionUserID();

                    sButton = (sButton == "" ? "null" : "'" + sButton + "'");

                    string sErr = "";

                    //is there a row?
                    int iRowCount = 0;
                    dc.sqlGetSingleInteger(ref iRowCount, "select count(*) from task_step_user_settings" +
                                " where user_id = '" + sUserID + "'" +
                                " and step_id = '" + sStepID + "'", ref sErr);

                    if (iRowCount == 0)
                    {
                        string sSQL = "insert into task_step_user_settings" +
                            " (user_id, step_id, visible, breakpoint, skip, button)" +
                            " values ('" + sUserID + "','" + sStepID + "', 1, 0, 0, " + sButton + ")";
                        if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
                            throw new Exception("Unable to toggle step button (0) [" + sStepID + "]." + sErr);
                    }
                    else
                    {
                        string sSQL = " update task_step_user_settings set button = " + sButton +
                            " where step_id = '" + sStepID + "';";
                        if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
                            throw new Exception("Unable to toggle step button (1) [" + sStepID + "]." + sErr);
                    }

                    return;
                }
                else
                {
                    throw new Exception("Unable to toggle step button. Missing or invalid step_id or button.");
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:51,代码来源:taskMethods.asmx.cs

示例8: wmGetStep

        public string wmGetStep(string sStepID)
        {
            FunctionTemplates.HTMLTemplates ft = new FunctionTemplates.HTMLTemplates();
            acUI.acUI ui = new acUI.acUI();

            try
            {

                string sStepHTML = "";
                string sErr = "";

                if (!ui.IsGUID(sStepID))
                    throw new Exception("Unable to get step. Invalid or missing Step ID. [" + sStepID + "]" + sErr);

                string sUserID = ui.GetSessionUserID();

                DataRow dr = ft.GetSingleStep(sStepID, sUserID, ref sErr);
                if (dr != null && sErr == "")
                {
                    //embedded steps...
                    //if the step_order is -1 and the codeblock_name is a guid, this step is embedded
                    //within another step
                    if (dr["step_order"].ToString() == "-1" && ui.IsGUID(dr["codeblock_name"].ToString()))
                        sStepHTML += ft.DrawEmbeddedStep(dr);
                    else
                        sStepHTML += ft.DrawFullStep(dr);
                }
                else
                    sStepHTML += "<span class=\"red_text\">" + sErr + "</span>";

                //return the html
                return sStepHTML;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:38,代码来源:taskMethods.asmx.cs

示例9: wmGetTaskCodeblocks

        public string wmGetTaskCodeblocks(string sTaskID, string sStepID)
        {
            dataAccess dc = new dataAccess();

            acUI.acUI ui = new acUI.acUI();

            try
            {
                if (ui.IsGUID(sTaskID))
                {
                    string sErr = "";
                    string sSQL = "select codeblock_name from task_codeblock where task_id = '" + sTaskID + "'" +
                        " and codeblock_name not in (select codeblock_name from task_step where step_id = '" + sStepID + "')" +
                        " order by codeblock_name";

                    DataTable dt = new DataTable();
                    if (!dc.sqlGetDataTable(ref dt, sSQL, ref sErr))
                    {
                        throw new Exception("Unable to get codeblocks for task." + sErr);
                    }

                    string sHTML = "";

                    foreach (DataRow dr in dt.Rows)
                    {
                        sHTML += "<div class=\"ui-widget-content ui-corner-all value_picker_value\">" + dr["codeblock_name"].ToString() + "</div>";
                    }

                    return sHTML;
                }
                else
                {
                    throw new Exception("Unable to get codeblocks for task. Missing or invalid task_id.");
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:41,代码来源:taskMethods.asmx.cs

示例10: wmGetMergedParameterXML

        public string wmGetMergedParameterXML(string sType, string sID, string sEcosystemID)
        {
            dataAccess dc = new dataAccess();
            acUI.acUI ui = new acUI.acUI();
            taskMethods tm = new taskMethods();
            FunctionTemplates.HTMLTemplates ft = new FunctionTemplates.HTMLTemplates();

            if (string.IsNullOrEmpty(sID))
                throw new Exception("ID required to look up default Parameter values.");

            string sErr = "";

            //what is the task associated with this action?
            //and get the XML for it
            string sSQL = "";
            string sDefaultsXML = "";
            string sTaskID = "";

            if (sType == "action")
            {
                sDefaultsXML = tm.wmGetObjectParameterXML(sType, sID, "");

                sSQL = "select t.task_id" +
                     " from ecotemplate_action ea" +
                     " join task t on ea.original_task_id = t.original_task_id" +
                     " and t.default_version = 1" +
                     " where ea.action_id = '" + sID + "'";
            }
            else if (sType == "instance")
            {
                sDefaultsXML = tm.wmGetObjectParameterXML(sType, sID, sEcosystemID);

                //IMPORTANT!!! if the ID is not a guid, it's a specific instance ID, and we'll need to get the task_id
                //but if it is a GUID, but the type is "instance", taht means the most recent INSTANCE for this TASK_ID
                if (ui.IsGUID(sID))
                    sTaskID = sID;
                else
                    sSQL = "select task_id" +
                         " from task_instance" +
                         " where task_instance = '" + sID + "'";
            }
            else if (sType == "plan")
            {
                sDefaultsXML = tm.wmGetObjectParameterXML(sType, sID, "");

                sSQL = "select task_id" +
                    " from action_plan" +
                    " where plan_id = '" + sID + "'";
            }
            else if (sType == "schedule")
            {
                sDefaultsXML = tm.wmGetObjectParameterXML(sType, sID, "");

                sSQL = "select task_id" +
                    " from action_schedule" +
                    " where schedule_id = '" + sID + "'";
            }

            //if we didn't get a task id directly, use the SQL to look it up
            if (string.IsNullOrEmpty(sTaskID))
                if (!dc.sqlGetSingleString(ref sTaskID, sSQL, ref sErr))
                    throw new Exception(sErr);

            if (!ui.IsGUID(sTaskID))
                throw new Exception("Unable to find Task ID for record.");

            XDocument xTPDoc = new XDocument();
            XDocument xDefDoc = new XDocument();

            //get the parameter XML from the TASK
            string sTaskParamXML = tm.wmGetParameterXML("task", sTaskID, "");
            if (!string.IsNullOrEmpty(sTaskParamXML))
            {
                xTPDoc = XDocument.Parse(sTaskParamXML);
                if (xTPDoc == null)
                    throw new Exception("Task Parameter XML data is invalid.");

                XElement xTPParams = xTPDoc.XPathSelectElement("/parameters");
                if (xTPParams == null)
                    throw new Exception("Task Parameter XML data does not contain 'parameters' root node.");
            }

            //we populated this up above too
            if (!string.IsNullOrEmpty(sDefaultsXML))
            {
                xDefDoc = XDocument.Parse(sDefaultsXML);
                if (xDefDoc == null)
                    throw new Exception("Defaults XML data is invalid.");

                XElement xDefParams = xDefDoc.XPathSelectElement("/parameters");
                if (xDefParams == null)
                    throw new Exception("Defaults XML data does not contain 'parameters' root node.");
            }

            //spin the nodes in the DEFAULTS xml, then dig in to the task XML and UPDATE the value if found.
            //(if the node no longer exists, delete the node from the defaults xml IF IT WAS AN ACTION)
            //and default "values" take precedence over task values.
            foreach (XElement xDefault in xDefDoc.XPathSelectElements("//parameter"))
            {
                //nothing to do if it's empty
//.........这里部分代码省略.........
开发者ID:remotesyssupport,项目名称:cato,代码行数:101,代码来源:taskMethods.asmx.cs

示例11: wmGetObjectParameterXML

        public string wmGetObjectParameterXML(string sType, string sID, string sFilterByEcosystemID)
        {
            dataAccess dc = new dataAccess();

            acUI.acUI ui = new acUI.acUI();

            try
            {
                string sErr = "";
                string sParameterXML = "";
                string sSQL = "";

                if (sType == "instance")
                {
                    //if sID is a guid, it's a task_id ... get the most recent run
                    //otherwise assume it's a task_instance and try that.
                    if (ui.IsGUID(sID))
                        sSQL = "select parameter_xml from task_instance_parameter where task_instance = " +
                            "(select max(task_instance) from task_instance where task_id = '" + sID + "')";
                    else if (ui.IsGUID(sFilterByEcosystemID))  //but if there's an ecosystem_id, limit it to that
                        sSQL = "select parameter_xml from task_instance_parameter where task_instance = " +
                            "(select max(task_instance) from task_instance where task_id = '" + sID + "')" +
                            " and ecosystem_id = '" + sFilterByEcosystemID + "'";
                    else
                        sSQL = "select parameter_xml from task_instance_parameter where task_instance = '" + sID + "'";
                }
                else if (sType == "action")
                {
                    sSQL = "select parameter_defaults from ecotemplate_action where action_id = '" + sID + "'";
                }
                else if (sType == "plan")
                {
                    sSQL = "select parameter_xml from action_plan where plan_id = " + sID;
                }
                else if (sType == "schedule")
                {
                    sSQL = "select parameter_xml from action_schedule where schedule_id = '" + sID + "'";
                }
                else if (sType == "task")
                {
                    sSQL = "select parameter_xml from task where task_id = '" + sID + "'";
                }

                if (!dc.sqlGetSingleString(ref sParameterXML, sSQL, ref sErr))
                {
                    throw new Exception(sErr);
                }

                if (!string.IsNullOrEmpty(sParameterXML))
                {
                    XDocument xDoc = XDocument.Parse(sParameterXML);
                    if (xDoc == null)
                        throw new Exception("Parameter XML data for [" + sType + ":" + sID + "] is invalid.");

                    XElement xParams = xDoc.XPathSelectElement("/parameters");
                    if (xParams == null)
                        throw new Exception("Parameter XML data for[" + sType + ":" + sID + "] does not contain 'parameters' root node.");

                    //NOTE: some values on this document may have a "encrypt" attribute.
                    //If so, we will:
                    // 1) obscure the ENCRYPTED value and make it safe to be an html attribute
                    // 2) return some stars so the user will know a value is there.
                    foreach (XElement xEncryptedValue in xDoc.XPathSelectElements("//parameter[@encrypt='true']/values/value"))
                    {
                        //if the value is empty, it still gets an oev attribute
                        string sVal = (string.IsNullOrEmpty(xEncryptedValue.Value) ? "" : ui.packJSON(xEncryptedValue.Value));
                        xEncryptedValue.SetAttributeValue("oev", sVal);
                        //but it only gets stars if it has a value
                        if (!string.IsNullOrEmpty(sVal))
                            xEncryptedValue.Value = "********";
                    }

                    return xDoc.ToString(SaveOptions.DisableFormatting);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            //it may just be there are no parameters
            return "";
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:83,代码来源:taskMethods.asmx.cs

示例12: wmFnIfRemoveSection

        public void wmFnIfRemoveSection(string sStepID, int iIndex)
        {
            FunctionTemplates.HTMLTemplates ft = new FunctionTemplates.HTMLTemplates();
            acUI.acUI ui = new acUI.acUI();

            try
            {
                if (!ui.IsGUID(sStepID))
                    throw new Exception("Unable to remove section from step. Invalid or missing Step ID. [" + sStepID + "]");

                string sEmbStepID = "";

                if (iIndex > 0)
                {
                    //is there an embedded step?
                    sEmbStepID = ft.GetNodeValueFromCommandXML(sStepID, "//function/tests/test[" + iIndex.ToString() + "]/action[1]");

                    if (ui.IsGUID(sEmbStepID))
                        wmDeleteStep(sEmbStepID); //whack it

                    //now adjust the XML
                    ft.RemoveFromCommandXML(sStepID, "//function/tests/test[" + iIndex.ToString() + "]");
                }
                else if (iIndex == -1)
                {
                    //is there an embedded step?
                    sEmbStepID = ft.GetNodeValueFromCommandXML(sStepID, "//function/else[1]");

                    if (ui.IsGUID(sEmbStepID))
                        wmDeleteStep(sEmbStepID); //whack it

                    //now adjust the XML
                    ft.RemoveFromCommandXML(sStepID, "//function/else[1]");
                }
                else
                {
                    throw new Exception("Unable to modify step. Invalid index.");
                }

                return;

            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:48,代码来源:taskMethods.asmx.cs

示例13: GetRegistry

        public XDocument GetRegistry(string sObjectID, ref string sErr)
        {
            dataAccess dc = new dataAccess();
            acUI.acUI ui = new acUI.acUI();

            try
            {
                string sXML = "";

                string sSQL = "select registry_xml from object_registry where object_id = '" + sObjectID + "'";
                if (!dc.sqlGetSingleString(ref sXML, sSQL, ref sErr))
                    throw new Exception("Error: Could not look up Registry XML." + sErr);

               if (!string.IsNullOrEmpty(sXML))
                {
                    XDocument xd = XDocument.Parse(sXML);
                    if (xd == null)
                    {
                        throw new Exception("Error: Unable to parse XML.");
                    }

                    return xd;
                }
                else
                {
                    //if the object_id is a guid, it's an object registry... add one if it's not there.
                    if (ui.IsGUID(sObjectID))
                    {
                        sSQL = "insert into object_registry values ('" + sObjectID + "', '<registry />')";
                        if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
                            throw new Exception("Error: Could not create Registry." + sErr);

                        XDocument xd = XDocument.Parse("<registry />");
                        return xd;
                    }
                    else
                        throw new Exception("Error: Could not look up Registry XML.");

                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:45,代码来源:uiMethods.asmx.cs

示例14: DrawEcotemplateAction

        /*And these are for populating the Action LIST on the EcoTemplate Edit page.*/
        private string DrawEcotemplateAction(DataRow dr)
        {
            acUI.acUI ui = new acUI.acUI();
            dataAccess dc = new dataAccess();

            string sSQL = null;
            string sErr = null;

            string sHTML = "";

            //string sActionID = dr["action_id"].ToString();
            string sActionName = dr["action_name"].ToString();
            string sCategory = dr["category"].ToString();
            string sDesc = (string.IsNullOrEmpty(dr["action_desc"].ToString()) ? "" : dr["action_desc"].ToString());
            string sOriginalTaskID = dr["original_task_id"].ToString();
            string sTaskID = dr["task_id"].ToString();
            string sTaskName = dr["task_name"].ToString();
            string sVersion = (string.IsNullOrEmpty(dr["task_version"].ToString()) ? "" : dr["task_version"].ToString());
            string sTaskParameterXML = (string.IsNullOrEmpty(dr["task_param_xml"].ToString()) ? "" : dr["task_param_xml"].ToString());
            //string sActionParameterXML = (string.IsNullOrEmpty(dr["action_param_xml"].ToString()) ? "" : dr["action_param_xml"].ToString());

            sHTML += "<div class=\"ui-state-default step_header\">";

            sHTML += "<div class=\"step_header_title\">";
            sHTML += "<span class=\"action_category_lbl\">" + (sCategory != "" ? sCategory + " - " : "") + "</span>";
            sHTML += "<span class=\"action_name_lbl\">" + sActionName + "</span>";
            sHTML += "</div>";

            sHTML += "<div class=\"step_header_icons\">";
            sHTML += "<img class=\"action_remove_btn\" remove_id=\"" + sActionName + "\"" +
                " src=\"../images/icons/fileclose.png\" alt=\"\" style=\"width: 12px; height: 12px;\"" +
                " title=\"Delete\" />";
            sHTML += "</div>";

            sHTML += "</div>";

            //gotta clear the floats
            sHTML += "<div class=\"ui-widget-content step_detail\">";

            //Action Name
            sHTML += "Action: " + Environment.NewLine;
            sHTML += "<input type=\"text\" " +
                " column=\"action_name\"" +
                " class=\"code\"" +
                " value=\"" + sActionName + "\" />"
                + Environment.NewLine;

            //Category
            sHTML += "Category: " + Environment.NewLine;
            sHTML += "<input type=\"text\" " +
                " column=\"category\"" +
                " class=\"code\"" +
                " value=\"" + sCategory + "\" />"
                + Environment.NewLine;

            sHTML += "<br />";

            //Description
            sHTML += "Description:<br />" + Environment.NewLine;
            sHTML += "<textarea rows=\"4\"" +
                " column=\"action_desc\"" +
                " class=\"code\"" +
                ">" + sDesc + "</textarea>" + Environment.NewLine;

            sHTML += "<br />";

            //Task
            //hidden field
            sHTML += "<input type=\"hidden\" " +
                " column=\"original_task_id\"" +
                " value=\"" + sOriginalTaskID + "\" />"
                + Environment.NewLine;

            //visible stuff
            sHTML += "Task: " + Environment.NewLine;
            sHTML += "<input type=\"text\"" +
                " onkeydown=\"return false;\"" +
                " onkeypress=\"return false;\"" +
                " is_required=\"true\"" +
                " class=\"code w75pct task_name\"" +
                " value=\"" + sTaskName + "\" />" + Environment.NewLine;
            if (sTaskID != "")
            {
                sHTML += "<img class=\"task_open_btn pointer\" alt=\"Edit Task\"" +
                    " task_id=\"" + sTaskID + "\"" +
                    " src=\"../images/icons/kedit_16.png\" />" + Environment.NewLine;
                sHTML += "<img class=\"task_print_btn pointer\" alt=\"View Task\"" +
                    " task_id=\"" + sTaskID + "\"" +
                    " src=\"../images/icons/printer.png\" />" + Environment.NewLine;
            }

            //NOT SURE if this is a requirement.  The looping actually slows things down quite a bit
            //so I don't mind not doing it.

            //versions
            if (ui.IsGUID(sOriginalTaskID))
            {
                sHTML += "<br />";
                sHTML += "Version: " + Environment.NewLine;
//.........这里部分代码省略.........
开发者ID:remotesyssupport,项目名称:cato,代码行数:101,代码来源:uiMethods.asmx.cs

示例15: wmRerunTask

        public string wmRerunTask(int iInstanceID, string sClearLog)
        {
            dataAccess dc = new dataAccess();

            acUI.acUI ui = new acUI.acUI();

            try
            {
                string sUserID = ui.GetSessionUserID();

                if (iInstanceID > 0 && ui.IsGUID(sUserID))
                {

                    string sInstance = "";
                    string sErr = "";
                    string sSQL = "";

                    if (dc.IsTrue(sClearLog))
                    {
                        sSQL = "delete from task_instance_log" +
                            " where task_instance = '" + iInstanceID.ToString() + "'";

                        if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
                        {
                            throw new Exception("Unable to clear task instance log for [" + iInstanceID.ToString() + "]." + sErr);
                        }
                    }
                    sSQL = "update task_instance set task_status = 'Submitted'," +
                        " submitted_by = '" + sUserID + "'" +
                        " where task_instance = '" + iInstanceID.ToString() + "'";

                    if (!dc.sqlGetSingleString(ref sInstance, sSQL, ref sErr))
                    {
                        throw new Exception("Unable to rerun task instance [" + iInstanceID.ToString() + "]." + sErr);
                    }

                    return sInstance;
                }
                else
                {
                    throw new Exception("Unable to run task. Missing or invalid task instance [" + iInstanceID.ToString() + "]");
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:49,代码来源:taskMethods.asmx.cs


注:本文中的acUI.acUI.IsGUID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。