本文整理汇总了C#中acUI.acUI.UpdateCloudProviders方法的典型用法代码示例。如果您正苦于以下问题:C# acUI.acUI.UpdateCloudProviders方法的具体用法?C# acUI.acUI.UpdateCloudProviders怎么用?C# acUI.acUI.UpdateCloudProviders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类acUI.acUI
的用法示例。
在下文中一共展示了acUI.acUI.UpdateCloudProviders方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveCloud
public static string SaveCloud(string sMode, string sCloudID, string sCloudName, string sProvider, string sAPIUrl)
{
// for logging
string sOriginalName = null;
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
string sSql = null;
string sErr = null;
//if we are editing get the original values
if (sMode == "edit")
{
}
try
{
dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);
// update the user fields.
if (sMode == "edit")
{
sSql = "select cloud_name from clouds " +
"where cloud_id = '" + sCloudID + "'";
if (!dc.sqlGetSingleString(ref sOriginalName, sSql, ref sErr))
throw new Exception("Error getting original cloud name:" + sErr);
sSql = "update clouds set" +
" cloud_name = '" + sCloudName + "'," +
" provider = '" + sProvider + "'," +
" api_url = '" + sAPIUrl + "'" +
" where cloud_id = '" + sCloudID + "'";
oTrans.Command.CommandText = sSql;
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception("Error updating cloud: " + sErr);
ui.WriteObjectChangeLog(Globals.acObjectTypes.Cloud, sCloudID, sCloudName, sOriginalName, sCloudName);}
else
{
sCloudID = ui.NewGUID();
sSql = "insert into clouds (cloud_id, cloud_name, provider, api_url)" +
" values ('" + sCloudID + "'," +
"'" + sCloudName + "'," +
"'" + sProvider + "'," +
"'" + sAPIUrl + "')";
oTrans.Command.CommandText = sSql;
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception("Error creating cloud: " + sErr);
ui.WriteObjectAddLog(Globals.acObjectTypes.Cloud, sCloudID, sCloudName, "Cloud Created");
}
oTrans.Commit();
//update the cloud providers class in the session
CloudProviders cp = ui.GetCloudProviders();
cp[sProvider].RefreshClouds();
ui.UpdateCloudProviders(cp);
}
catch (Exception ex)
{
throw new Exception("Error: General Exception: " + ex.Message);
}
// no errors to here, so return an empty string
return "{'cloud_id':'" + sCloudID + "'}";
}