本文整理汇总了C#中dataAccess.csvGetList方法的典型用法代码示例。如果您正苦于以下问题:C# dataAccess.csvGetList方法的具体用法?C# dataAccess.csvGetList怎么用?C# dataAccess.csvGetList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataAccess
的用法示例。
在下文中一共展示了dataAccess.csvGetList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: wmDeleteTasks
public string wmDeleteTasks(string sDeleteArray)
{
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
string sSql = null;
string sErr = "";
string sTaskNames = "";
if (sDeleteArray.Length < 36)
return "";
sDeleteArray = ui.QuoteUp(sDeleteArray);
//NOTE: right now this plows ALL versions. There is an enhancement to possibly 'retire' a task, or
//only delete certain versions.
try
{
// what about the instance tables?????
// bugzilla 1290 Tasks that have history (task_instance table) can not be deleted
// exclude them from the list and return a message noting the task(s) that could not be deleted
// first we need a list of tasks that will not be deleted
sSql = "select task_name from task t " +
"where t.original_task_id in (" + sDeleteArray.ToString() + ") " +
"and t.task_id in (select ti.task_id from tv_task_instance ti where ti.task_id = t.task_id)";
if (!dc.csvGetList(ref sTaskNames, sSql, ref sErr, true))
throw new Exception(sErr);
// list of tasks that will be deleted
//we have an array of 'original_task_id'.
//we need an array or task_id
//build one.
sSql = "select t.task_id from task t " +
"where t.original_task_id in (" + sDeleteArray.ToString() + ") " +
"and t.task_id not in (select ti.task_id from tv_task_instance ti where ti.task_id = t.task_id)";
string sTaskIDs = "";
if (!dc.csvGetList(ref sTaskIDs, sSql, ref sErr, true))
throw new Exception(sErr);
// if any tasks can be deleted
if (sTaskIDs.Length > 1)
{
dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);
//oTrans.Command.CommandText = "delete from task_asset_attribute where task_id in (" + sTaskIDs + ")";
//if (!oTrans.ExecUpdate(ref sErr))
// throw new Exception(sErr);
oTrans.Command.CommandText = "delete from task_step_user_settings" +
" where step_id in" +
" (select step_id from task_step where task_id in (" + sTaskIDs + "))";
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception(sErr);
oTrans.Command.CommandText = "delete from task_step where task_id in (" + sTaskIDs + ")";
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception(sErr);
oTrans.Command.CommandText = "delete from task_codeblock where task_id in (" + sTaskIDs + ")";
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception(sErr);
oTrans.Command.CommandText = "delete from task where task_id in (" + sTaskIDs + ")";
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception(sErr);
oTrans.Commit();
ui.WriteObjectDeleteLog(Globals.acObjectTypes.Task, "Multiple", "Original Task IDs", sDeleteArray.ToString());
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
// if the sTaskNames contains any names, then send back a message that these were not deleted because of history records.
if (sTaskNames.Length > 0)
{
return "Task(s) (" + sTaskNames + ") have history rows and could not be deleted.";
}
else
{
return sErr;
}
}
示例2: DeleteAssets
public static string DeleteAssets(string sDeleteArray)
{
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
string sSql = null;
string sErr = "";
ArrayList arrList = new ArrayList();
arrList.AddRange(sDeleteArray.Split(','));
if (sDeleteArray.Length < 36)
return "";
StringBuilder sbAssetIDString = new StringBuilder();
StringBuilder sbAssetsCantDelete = new StringBuilder();
foreach (string sAssetID in arrList)
{
if (sAssetID.Length == 36)
{
// what about the instance tables?????
// bugzilla 1290 Assets that have history (task_instance table) can not be deleted
// exclude them from the list and return a message noting the asset(s) that could not be deleted
// check if this asset has any history rows.
sSql = "select count(*) from tv_task_instance where asset_id = '" + sAssetID + "'";
int iHistory = 0;
if (!dc.sqlGetSingleInteger(ref iHistory, sSql, ref sErr))
throw new Exception(sErr);
// if there is no history add this to the delete list,
// otherwise add the task id to the non delete list
if (iHistory == 0)
{
sbAssetIDString.Append("'" + sAssetID + "',");
}
else
{
sbAssetsCantDelete.Append("'" + sAssetID + "',");
};
}
}
// trim the trailing ,
if (sbAssetsCantDelete.ToString().Length > 2) { sbAssetsCantDelete.Remove(sbAssetsCantDelete.Length - 1, 1); };
if (sbAssetIDString.ToString().Length > 2)
{
// delete from these tables:
// asset, asset_credential (if the credential is local).
// trim the trailing ,
sbAssetIDString.Remove(sbAssetIDString.Length - 1, 1);
try
{
dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);
// delete asset_credential
sSql = "delete from asset_credential" +
" where shared_or_local = 1" +
" and credential_id in (select credential_id from asset where asset_id in (" + sbAssetIDString.ToString() + "))";
oTrans.Command.CommandText = sSql;
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception(sErr);
// delete asset
sSql = "delete from asset where asset_id in (" + sbAssetIDString.ToString() + ")";
oTrans.Command.CommandText = sSql;
if (!oTrans.ExecUpdate(ref sErr))
throw new Exception(sErr);
oTrans.Commit();
// add security log
ui.WriteObjectDeleteLog(Globals.acObjectTypes.Asset, sbAssetIDString.ToString(), "Batch Asset Delete", "Deleted Assets in batch mode");
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
};
// if some did not get deleted return a message.
if (sbAssetsCantDelete.Length > 2)
{
string sTaskNames = "";
sSql = "select asset_name from asset where asset_id in (" + sbAssetsCantDelete.ToString() + ")";
if (!dc.csvGetList(ref sTaskNames, sSql, ref sErr, true))
throw new Exception(sErr);
return "Asset deletion completed. Asset(s) (" + sTaskNames + ") could not be deleted because history rows exist.";
}
else
{
return sErr;
}
}