?? sqldataprovider.cs
字號:
SqlCommand sqlCmd = new SqlCommand();
AddParamToSQLCmd(sqlCmd, "@IssueId", SqlDbType.Int, 0, ParameterDirection.Input, issueId);
AddParamToSQLCmd(sqlCmd, "@RelationType", SqlDbType.Int, 0, ParameterDirection.Input, IssueRelationType.ParentChild);
SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_RELATEDISSUE_GETCHILDISSUES);
List<RelatedIssue> relatedIssueList = new List<RelatedIssue>();
TExecuteReaderCmd<RelatedIssue>(sqlCmd, TGenerateRelatedIssueListFromReader<RelatedIssue>, ref relatedIssueList);
return relatedIssueList;
}
/// <summary>
/// Gets the parent issues.
/// </summary>
/// <param name="issueId">The issue id.</param>
/// <returns></returns>
public override System.Collections.Generic.List<BugNET.BusinessLogicLayer.RelatedIssue> GetParentIssues(int issueId)
{
if (issueId <= 0)
throw (new ArgumentOutOfRangeException("issueId"));
SqlCommand sqlCmd = new SqlCommand();
AddParamToSQLCmd(sqlCmd, "@IssueId", SqlDbType.Int, 0, ParameterDirection.Input, issueId);
AddParamToSQLCmd(sqlCmd, "@RelationType", SqlDbType.Int, 0, ParameterDirection.Input, IssueRelationType.ParentChild);
SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_RELATEDISSUE_GETPARENTISSUES);
List<RelatedIssue> relatedIssueList = new List<RelatedIssue>();
TExecuteReaderCmd<RelatedIssue>(sqlCmd, TGenerateRelatedIssueListFromReader<RelatedIssue>, ref relatedIssueList);
return relatedIssueList;
}
/// <summary>
/// Gets the related issues.
/// </summary>
/// <param name="IssueId">The issue id.</param>
/// <returns></returns>
public override System.Collections.Generic.List<BugNET.BusinessLogicLayer.RelatedIssue> GetRelatedIssues(int issueId)
{
if (issueId <= 0)
throw (new ArgumentOutOfRangeException("issueId"));
try
{
SqlCommand sqlCmd = new SqlCommand();
AddParamToSQLCmd(sqlCmd, "@IssueId", SqlDbType.Int, 0, ParameterDirection.Input, issueId);
AddParamToSQLCmd(sqlCmd, "@RelationType", SqlDbType.Int, 0, ParameterDirection.Input, IssueRelationType.Related);
SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_RELATEDISSUE_GETRELATEDISSUES);
List<RelatedIssue> relatedIssueList = new List<RelatedIssue>();
TExecuteReaderCmd<RelatedIssue>(sqlCmd, TGenerateRelatedIssueListFromReader<RelatedIssue>, ref relatedIssueList);
return relatedIssueList;
}
catch (Exception ex)
{
throw ProcessException(ex);
}
}
/// <summary>
/// Creates the new child issue.
/// </summary>
/// <param name="primaryIssueId">The primary issue id.</param>
/// <param name="secondaryIssueId">The secondary issue id.</param>
/// <returns></returns>
public override int CreateNewChildIssue(int primaryIssueId, int secondaryIssueId)
{
// Validate Parameters
if (primaryIssueId <= Globals.NewId)
throw (new ArgumentOutOfRangeException("primaryIssueId"));
if (secondaryIssueId <= Globals.NewId)
throw (new ArgumentOutOfRangeException("secondaryIssueId"));
try
{
// Execute SQL Command
SqlCommand sqlCmd = new SqlCommand();
AddParamToSQLCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
AddParamToSQLCmd(sqlCmd, "@PrimaryIssueId", SqlDbType.Int, 0, ParameterDirection.Input, primaryIssueId);
AddParamToSQLCmd(sqlCmd, "@SecondaryIssueId", SqlDbType.Int, 0, ParameterDirection.Input, secondaryIssueId);
AddParamToSQLCmd(sqlCmd, "@RelationType", SqlDbType.Int, 0, ParameterDirection.Input, IssueRelationType.ParentChild);
SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_RELATEDISSUE_CREATENEWCHILDISSUE);
ExecuteScalarCmd(sqlCmd);
return ((int)sqlCmd.Parameters["@ReturnValue"].Value);
}
catch (Exception ex)
{
throw ProcessException(ex);
}
}
/// <summary>
/// Deletes the child issue.
/// </summary>
/// <param name="primaryIssueId">The primary issue id.</param>
/// <param name="secondaryIssueId">The secondary issue id.</param>
/// <returns></returns>
public override bool DeleteChildIssue(int primaryIssueId, int secondaryIssueId)
{
// Validate Parameters
if (primaryIssueId <= Globals.NewId)
throw (new ArgumentOutOfRangeException("primaryIssueId"));
if (secondaryIssueId <= Globals.NewId)
throw (new ArgumentOutOfRangeException("secondaryIssueId"));
try
{
// Execute SQL Command
SqlCommand sqlCmd = new SqlCommand();
AddParamToSQLCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
AddParamToSQLCmd(sqlCmd, "@PrimaryIssueId", SqlDbType.Int, 0, ParameterDirection.Input, primaryIssueId);
AddParamToSQLCmd(sqlCmd, "@SecondaryIssueId", SqlDbType.Int, 0, ParameterDirection.Input, secondaryIssueId);
AddParamToSQLCmd(sqlCmd, "@RelationType", SqlDbType.Int, 0, ParameterDirection.Input, IssueRelationType.ParentChild);
SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_RELATEDISSUE_DELETECHILDISSUE);
ExecuteScalarCmd(sqlCmd);
int returnValue = (int)sqlCmd.Parameters["@ReturnValue"].Value;
return (returnValue == 0 ? true : false);
}
catch (Exception ex)
{
throw ProcessException(ex);
}
}
/// <summary>
/// Creates the new parent issue.
/// </summary>
/// <param name="primaryIssueId">The primary issue id.</param>
/// <param name="secondaryIssueId">The secondary issue id.</param>
/// <returns></returns>
public override int CreateNewParentIssue(int primaryIssueId, int secondaryIssueId)
{
// Validate Parameters
if (primaryIssueId <= Globals.NewId)
throw (new ArgumentOutOfRangeException("primaryIssueId"));
if (secondaryIssueId <= Globals.NewId)
throw (new ArgumentOutOfRangeException("secondaryIssueId"));
try
{
// Execute SQL Command
SqlCommand sqlCmd = new SqlCommand();
AddParamToSQLCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
AddParamToSQLCmd(sqlCmd, "@PrimaryIssueId", SqlDbType.Int, 0, ParameterDirection.Input, primaryIssueId);
AddParamToSQLCmd(sqlCmd, "@SecondaryIssueId", SqlDbType.Int, 0, ParameterDirection.Input, secondaryIssueId);
AddParamToSQLCmd(sqlCmd, "@RelationType", SqlDbType.Int, 0, ParameterDirection.Input, IssueRelationType.ParentChild);
SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_RELATEDISSUE_CREATENEWPARENTISSUE);
ExecuteScalarCmd(sqlCmd);
return ((int)sqlCmd.Parameters["@ReturnValue"].Value);
}
catch (Exception ex)
{
throw ProcessException(ex);
}
}
/// <summary>
/// Deletes the parent issue.
/// </summary>
/// <param name="primaryIssueId">The primary issue id.</param>
/// <param name="secondaryIssueId">The secondary issue id.</param>
/// <returns></returns>
public override bool DeleteParentIssue(int primaryIssueId, int secondaryIssueId)
{
// Validate Parameters
if (primaryIssueId <= Globals.NewId)
throw (new ArgumentOutOfRangeException("primaryIssueId"));
if (secondaryIssueId <= Globals.NewId)
throw (new ArgumentOutOfRangeException("secondaryIssueId"));
try
{
// Execute SQL Command
SqlCommand sqlCmd = new SqlCommand();
AddParamToSQLCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
AddParamToSQLCmd(sqlCmd, "@PrimaryIssueId", SqlDbType.Int, 0, ParameterDirection.Input, primaryIssueId);
AddParamToSQLCmd(sqlCmd, "@SecondaryIssueId", SqlDbType.Int, 0, ParameterDirection.Input, secondaryIssueId);
AddParamToSQLCmd(sqlCmd, "@RelationType", SqlDbType.Int, 0, ParameterDirection.Input, IssueRelationType.ParentChild);
SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_RELATEDISSUE_DELETEPARENTISSUE);
ExecuteScalarCmd(sqlCmd);
int returnValue = (int)sqlCmd.Parameters["@ReturnValue"].Value;
return (returnValue == 0 ? true : false);
}
catch (Exception ex)
{
throw ProcessException(ex);
}
}
/// <summary>
/// Creates the new related issue.
/// </summary>
/// <param name="primaryIssueId">The primary issue id.</param>
/// <param name="secondaryIssueId">The secondary issue id.</param>
/// <returns></returns>
public override int CreateNewRelatedIssue(int primaryIssueId, int secondaryIssueId)
{
// Validate Parameters
if (primaryIssueId <= Globals.NewId)
throw (new ArgumentOutOfRangeException("primaryIssueId"));
if (secondaryIssueId <= Globals.NewId)
throw (new ArgumentOutOfRangeException("secondaryIssueId"));
try
{
// Execute SQL Command
SqlCommand sqlCmd = new SqlCommand();
AddParamToSQLCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
AddParamToSQLCmd(sqlCmd, "@PrimaryIssueId", SqlDbType.Int, 0, ParameterDirection.Input, primaryIssueId);
AddParamToSQLCmd(sqlCmd, "@SecondaryIssueId", SqlDbType.Int, 0, ParameterDirection.Input, secondaryIssueId);
AddParamToSQLCmd(sqlCmd, "@RelationType", SqlDbType.Int, 0, ParameterDirection.Input, IssueRelationType.Related);
SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_RELATEDISSUE_CREATENEWRELATEDISSUE);
ExecuteScalarCmd(sqlCmd);
return ((int)sqlCmd.Parameters["@ReturnValue"].Value);
}
catch (Exception ex)
{
throw ProcessException(ex);
}
}
/// <summary>
/// Deletes the related issue.
/// </summary>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -