本文整理汇总了C#中acUI.acUI.PutCloudAccountsInSession方法的典型用法代码示例。如果您正苦于以下问题:C# acUI.acUI.PutCloudAccountsInSession方法的具体用法?C# acUI.acUI.PutCloudAccountsInSession怎么用?C# acUI.acUI.PutCloudAccountsInSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类acUI.acUI
的用法示例。
在下文中一共展示了acUI.acUI.PutCloudAccountsInSession方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteClouds
public static string DeleteClouds(string sDeleteArray)
{
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
string sSql = null;
string sErr = "";
if (sDeleteArray.Length < 36)
return "";
sDeleteArray = ui.QuoteUp(sDeleteArray);
DataTable dt = new DataTable();
// get a list of ids that will be deleted for the log
sSql = "select cloud_id, cloud_name, provider from clouds where cloud_id in (" + sDeleteArray + ")";
if (!dc.sqlGetDataTable(ref dt, sSql, ref sErr))
throw new Exception(sErr);
try
{
dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);
sSql = "delete from clouds where cloud_id in (" + sDeleteArray + ")";
oTrans.Command.CommandText = sSql;
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception(sErr);
//refresh the cloud account list in the session
if (!ui.PutCloudAccountsInSession(ref sErr))
throw new Exception(sErr);
oTrans.Commit();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
//reget the cloud providers class in the session
ui.SetCloudProviders(ref sErr);
if (!string.IsNullOrEmpty(sErr))
throw new Exception("Error: Unable to load Cloud Providers XML." + sErr);
// if we made it here, so save the logs
foreach (DataRow dr in dt.Rows)
{
ui.WriteObjectDeleteLog(Globals.acObjectTypes.Cloud, dr["cloud_id"].ToString(), dr["cloud_name"].ToString(), dr["provider"].ToString() + " Cloud Deleted.");
}
return sErr;
}
示例2: DeleteAccounts
public static string DeleteAccounts(string sDeleteArray)
{
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
string sSql = null;
string sErr = "";
if (sDeleteArray.Length < 36)
return "";
sDeleteArray = ui.QuoteUp(sDeleteArray);
DataTable dt = new DataTable();
// get a list of ids that will be deleted for the log
sSql = "select account_id, account_name, provider, login_id from cloud_account where account_id in (" + sDeleteArray + ")";
if (!dc.sqlGetDataTable(ref dt, sSql, ref sErr))
throw new Exception(sErr);
try
{
dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);
sSql = "delete from cloud_account where account_id in (" + sDeleteArray + ")";
oTrans.Command.CommandText = sSql;
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception(sErr);
//refresh the cloud account list in the session
if (!ui.PutCloudAccountsInSession(ref sErr))
throw new Exception(sErr);
oTrans.Commit();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
// if we made it here, so save the logs
foreach (DataRow dr in dt.Rows)
{
ui.WriteObjectDeleteLog(Globals.acObjectTypes.CloudAccount, dr["account_id"].ToString(), dr["account_name"].ToString(), dr["provider"].ToString() + " Account for LoginID [" + dr["login_id"].ToString() + "] Deleted");
}
return sErr;
}
示例3: SaveAccount
//.........这里部分代码省略.........
dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);
// update the user fields.
if (sMode == "edit")
{
sSql = "select account_name from cloud_account " +
"where account_id = '" + sAccountID + "'";
if (!dc.sqlGetSingleString(ref sOriginalName, sSql, ref sErr))
throw new Exception("Error getting original account name:" + sErr);
// only update the passwword if it has changed
string sNewPassword = "";
if (sLoginPassword != "($%#[email protected]!&")
{
sNewPassword = ", login_password = '" + dc.EnCrypt(sLoginPassword) + "'";
}
sSql = "update cloud_account set" +
" account_name = '" + sAccountName + "'," +
" account_number = '" + sAccountNumber + "'," +
" provider = '" + sProvider + "'," +
" is_default = '" + sIsDefault + "'," +
" auto_manage_security = '" + sAutoManageSecurity + "'," +
" login_id = '" + sLoginID + "'" +
sNewPassword +
" where account_id = '" + sAccountID + "'";
oTrans.Command.CommandText = sSql;
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception("Error updating account: " + sErr);
ui.WriteObjectChangeLog(Globals.acObjectTypes.CloudAccount, sAccountID, sAccountName, sOriginalName, sAccountName);}
else
{
//now, for some reason we were having issues with the initial startup of apache
//not able to perform the very first database hit.
//this line serves as an inital db hit, but we aren't trapping it or showing the error
dc.TestDBConnection(ref sErr);
//if there are no rows yet, make this one the default even if the box isn't checked.
if (sIsDefault == "0")
{
int iExists = -1;
sSql = "select count(*) as cnt from cloud_account";
if (!dc.sqlGetSingleInteger(ref iExists, sSql, ref sErr))
{
System.Threading.Thread.Sleep(300);
if (!dc.sqlGetSingleInteger(ref iExists, sSql, ref sErr))
{
System.Threading.Thread.Sleep(300);
if (!dc.sqlGetSingleInteger(ref iExists, sSql, ref sErr))
throw new Exception("Unable to count Cloud Accounts: " + sErr);
}
}
if (iExists == 0)
sIsDefault = "1";
}
sAccountID = ui.NewGUID();
sSql = "insert into cloud_account (account_id, account_name, account_number, provider, is_default, login_id, login_password, auto_manage_security)" +
" values ('" + sAccountID + "'," +
"'" + sAccountName + "'," +
"'" + sAccountNumber + "'," +
"'" + sProvider + "'," +
"'" + sIsDefault + "'," +
"'" + sLoginID + "'," +
"'" + dc.EnCrypt(sLoginPassword) + "'," +
"'" + sAutoManageSecurity + "')";
oTrans.Command.CommandText = sSql;
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception("Error creating account: " + sErr);
ui.WriteObjectAddLog(Globals.acObjectTypes.CloudAccount, sAccountID, sAccountName, "Account Created");
}
//if "default" was selected, unset all the others
if (dc.IsTrue(sIsDefault))
{
oTrans.Command.CommandText = "update cloud_account set is_default = 0 where account_id <> '" + sAccountID + "'";
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception("Error updating defaults: " + sErr);
}
oTrans.Commit();
//refresh the cloud account list in the session
if (!ui.PutCloudAccountsInSession(ref sErr))
throw new Exception("Error refreshing accounts in session: " + sErr);
}
catch (Exception ex)
{
throw new Exception("Error: General Exception: " + ex.Message);
}
// no errors to here, so return an empty string
return "{'account_id':'" + sAccountID + "', 'account_name':'" + sAccountName + "', 'provider':'" + sProvider + "'}";
}