本文整理汇总了C#中acUI.acUI.GetSessionUserID方法的典型用法代码示例。如果您正苦于以下问题:C# acUI.acUI.GetSessionUserID方法的具体用法?C# acUI.acUI.GetSessionUserID怎么用?C# acUI.acUI.GetSessionUserID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类acUI.acUI
的用法示例。
在下文中一共展示了acUI.acUI.GetSessionUserID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: wmRemoveFromClipboard
public void wmRemoveFromClipboard(string sStepID)
{
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
try
{
string sUserID = ui.GetSessionUserID();
string sErr = "";
//if the sStepID is a guid, we are removing just one
//otherwise, if it's "ALL" we are whacking them all
if (ui.IsGUID(sStepID))
{
string sSQL = "delete from task_step_clipboard" +
" where user_id = '" + sUserID + "'" +
" and root_step_id = '" + sStepID + "'";
if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
throw new Exception("Unable to remove step [" + sStepID + "] from clipboard." + sErr);
return;
}
else if (sStepID == "ALL")
{
string sSQL = "delete from task_step_clipboard where user_id = '" + sUserID + "'";
if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
throw new Exception("Unable to remove step [" + sStepID + "] from clipboard." + sErr);
return;
}
}
catch (Exception ex)
{
throw ex;
}
}
示例2: 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 "";
}
示例3: 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," +
//.........这里部分代码省略.........
示例4: wmAssetSearch
public string wmAssetSearch(string sSearchText, bool bAllowMultiSelect)
{
try
{
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
string sErr = "";
string sWhereString = " where 1=1 and a.asset_status ='Active'";
if (sSearchText.Length > 0)
{
sSearchText = sSearchText.Replace("'", "''").Trim();
//split on spaces
int i = 0;
string[] aSearchTerms = sSearchText.Split(' ');
for (i = 0; i <= aSearchTerms.Length - 1; i++)
{
//if the value is a guid, it's an existing task.
//otherwise it's a new task.
if (aSearchTerms[i].Length > 0)
{
sWhereString += " and (a.asset_name like '%" + aSearchTerms[i] + "%' " +
"or a.port like '%" + aSearchTerms[i] + "%' " +
"or a.address like '%" + aSearchTerms[i] + "%' " +
"or a.connection_type like '%" + aSearchTerms[i] + "%' " +
"or a.db_name like '%" + aSearchTerms[i] + "%') ";
}
}
}
//limit the results to the users 'tags' unless they are a super user
if (!ui.UserIsInRole("Developer") && !ui.UserIsInRole("Administrator"))
{
sWhereString += " and a.asset_id in (" +
"select distinct at.object_id" +
" from object_tags ut" +
" join object_tags at on ut.tag_name = at.tag_name" +
" and ut.object_type = 1 and at.object_type = 2" +
" where ut.object_id = '" + ui.GetSessionUserID() + "'" +
")";
}
string sSQL = "select a.asset_id, a.asset_name, a.port, a.address, a.db_name, a.connection_type, ac.username, " +
" case when a.is_connection_system = '1' then 'Yes' else 'No' end as is_connection_system " +
" from asset a " +
" left outer join asset_credential ac " +
" on ac.credential_id = a.credential_id " +
sWhereString +
" order by a.asset_name";
DataTable dt = new DataTable();
if (!dc.sqlGetDataTable(ref dt, sSQL, ref sErr))
{
throw new Exception(sErr);
}
string sHTML = "";
if (dt.Rows.Count == 0)
{
sHTML += "No results found";
}
else
{
int iRowsToGet = dt.Rows.Count;
if (iRowsToGet >= 100)
{
sHTML += "<div>Search found " + dt.Rows.Count + " results. Displaying the first 100.</div>";
iRowsToGet = 99;
}
sHTML += "<ul id=\"search_asset_ul\" class=\"search_dialog_ul\">";
for (int i = 0; i < iRowsToGet; i++)
{
sHTML += "<li class=\"search_dialog_value\" tag=\"asset_picker_row\" asset_id=\"" + dt.Rows[i]["asset_id"].ToString() + "\" asset_name=\"" + dt.Rows[i]["asset_name"].ToString() + "\">";
sHTML += "<div class=\"search_dialog_value_name\">";
if (bAllowMultiSelect)
sHTML += "<input type='checkbox' name='assetcheckboxes' id='assetchk_" + dt.Rows[i]["asset_id"].ToString() + "' value='assetchk_" + dt.Rows[i]["asset_id"].ToString() + "'>";
sHTML += "<span>" + dt.Rows[i]["asset_name"].ToString() + "</span>";
sHTML += "</div>";
sHTML += "<span class=\"search_dialog_value_inline_item\">Address: " + dt.Rows[i]["address"].ToString() + "</span>";
sHTML += "<span class=\"search_dialog_value_inline_item\"> Connection Type: " + dt.Rows[i]["connection_type"].ToString() + "</span>";
sHTML += "</li>";
}
}
sHTML += "</ul>";
return sHTML;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例5: 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;
}
}
示例6: 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); };
//.........这里部分代码省略.........
示例7: wmSetSystemCondition
public string wmSetSystemCondition(string sSetToStatus)
{
acUI.acUI ui = new acUI.acUI();
if (!ui.UserIsInRole("Administrator"))
{
return "Only an Administrator can perform this action.";
}
else
{
if (sSetToStatus == "")
{
return "Unable to set System condition - 'up' or 'down' status argument is required.";
}
dataAccess dc = new dataAccess();
string sErr = null;
if (sSetToStatus == "down")
{
wmKickAllUsers();
wmSetAllPollers("off");
wmSetScheduler("off");
//kill all running tasks
if (!dc.sqlExecuteUpdate("update task_instance set task_status = 'Aborting' where task_status = 'Processing'", ref sErr))
{ throw new Exception(sErr); }
//lock out users
if (!dc.sqlExecuteUpdate("update login_security_settings set allow_login = 0", ref sErr))
{ throw new Exception(sErr); }
}
else
{
wmSetAllPollers("on");
wmSetScheduler("on");
//allow login
if (!dc.sqlExecuteUpdate("update login_security_settings set allow_login = 1", ref sErr))
{ throw new Exception(sErr); }
}
// add security log
dc.addSecurityLog(ui.GetSessionUserID(), SecurityLogTypes.Security, SecurityLogActions.ConfigChange, acObjectTypes.None, "", "System Condition set to [" + sSetToStatus + "]", ref sErr);
// no errors to here, so return an empty string
return "";
}
}
示例8: 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;
}
}
示例9: wmSaveActionParameterXML
public void wmSaveActionParameterXML(string sActionID, string sActionDefaultsXML)
{
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
taskMethods tm = new taskMethods();
try
{
string sUserID = ui.GetSessionUserID();
if (ui.IsGUID(sActionID) && 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.)
sActionDefaultsXML = ui.unpackJSON(sActionDefaultsXML);
//we gotta peek into the XML and encrypt any newly keyed values
PrepareAndEncryptParameterXML(ref sActionDefaultsXML);
//so, like when we read it, we gotta spin and compare, and build an XML that only represents *changes*
//to the defaults on the task.
//what is the task associated with this action?
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 = '" + sActionID + "'";
string 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 Action.");
string sOverrideXML = "";
XDocument xTPDoc = new XDocument();
XDocument xADDoc = 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 had the ACTION defaults handed to us
if (!string.IsNullOrEmpty(sActionDefaultsXML))
{
xADDoc = XDocument.Parse(sActionDefaultsXML);
if (xADDoc == null)
throw new Exception("Action Defaults XML data is invalid.");
XElement xADParams = xADDoc.XPathSelectElement("/parameters");
if (xADParams == null)
throw new Exception("Action Defaults XML data does not contain 'parameters' root node.");
}
//spin the nodes in the ACTION 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 action XML)
//and action "values" take precedence over task values.
//this does a regular loop because we can't remove from an IEnumerable
int x = xADDoc.XPathSelectElements("//parameter").Count();
for (int i = (x-1); i>=0; i--)
{
XElement xDefault = xADDoc.XPathSelectElements("//parameter").ElementAt(i);
//look it up in the task param xml
XElement xADName = xDefault.XPathSelectElement("name");
string sADName = (xADName == null ? "" : xADName.Value);
XElement xADValues = xDefault.XPathSelectElement("values");
//string sValues = (xValues == null ? "" : xValues.ToString());
//now we have the name of the parameter, go find it in the TASK param XML
XElement xTaskParam = xTPDoc.XPathSelectElement("//parameter/name[. = '" + sADName + "']/.."); //NOTE! the /.. gets the parent of the name node!
//if it doesn't exist in the task params, remove it from this document
if (xTaskParam == null)
{
xDefault.Remove();
continue;
}
//and the "values" collection will be the 'next' node
XElement xTaskParamValues = xTaskParam.XPathSelectElement("values");
//so... it might be
//.........这里部分代码省略.........
示例10: wmSetScheduler
public string wmSetScheduler(string sSetToStatus)
{
acUI.acUI ui = new acUI.acUI();
if (!ui.UserIsInRole("Administrator"))
{
return "Only an Administrator can perform this action.";
}
else
{
if (sSetToStatus == "")
{
return "Unable to set Scheduler - 'on' or 'off' status argument is required.";
}
dataAccess dc = new dataAccess();
string sErr = null;
/*
Simply flips the switch on all pollers and logservers to either on or off based on the argument.
*/
string sStatus = (dc.IsTrue(sSetToStatus) ? "on" : "off");
try
{
if (!dc.sqlExecuteUpdate("update scheduler_settings set mode_off_on = '" + sStatus + "'", ref sErr)) { throw new Exception(sErr); }
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
// add security log
dc.addSecurityLog(ui.GetSessionUserID(), SecurityLogTypes.Security, SecurityLogActions.ConfigChange, acObjectTypes.None, "", "Scheduler set to [" + sStatus + "]", ref sErr);
// no errors to here, so return an empty string
return "";
}
}
示例11: wmLogout
public bool wmLogout()
{
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
try
{
string sUserID = ui.GetSessionUserID();
string sUserName = ui.GetSessionUsername();
string sErr = "";
dc.addSecurityLog(sUserID, Globals.SecurityLogTypes.Security, Globals.SecurityLogActions.UserLogout, Globals.acObjectTypes.None, sUserName, "Manual Log Out", ref sErr);
System.Web.Security.FormsAuthentication.SignOut();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return true;
}
示例12: wmKickAllUsers
public string wmKickAllUsers()
{
acUI.acUI ui = new acUI.acUI();
if (!ui.UserIsInRole("Administrator"))
{
return "Only an Administrator can perform this action.";
}
else
{
dataAccess dc = new dataAccess();
string sErr = null;
/*
Gives all users a one minute warning, then kicks them.
*/
try
{
if (!dc.sqlExecuteUpdate("update user_session set kick=1 where user_id in " +
" (select user_id from users where user_role <> 'Administrator')"
, ref sErr)) { throw new Exception(sErr); }
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
// add security log
dc.addSecurityLog(ui.GetSessionUserID(), SecurityLogTypes.Security, SecurityLogActions.ConfigChange, acObjectTypes.None, "", "All Users were just kicked by [" + ui.GetSessionUsername() + "]", ref sErr);
// no errors to here, so return an empty string
return "";
}
}
示例13: wmImportSelected
public string wmImportSelected(string sTaskList)
{
acUI.acUI ui = new acUI.acUI();
ImportExport.ImportExportClass ie = new ImportExport.ImportExportClass();
string sErr = "";
try
{
string sUserID = ui.GetSessionUserID();
if (!ie.Import(sUserID, sTaskList, ref sErr))
throw new Exception("Unable to import Items.<br />" + sErr);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return sErr;
}
示例14: 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;
}
}
示例15: 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 "";
}