📄 query.cs
字号:
using System;
using System.Collections;
using System.Web.UI.WebControls;
using BugNET.DataAccessLayer;
using System.Collections.Generic;
namespace BugNET.BusinessLogicLayer {
/// <summary>
/// Represents a query issued against the issue database.
/// </summary>
public class Query {
#region Private Fields
private int _Id;
private string _Name;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="Query"/> class.
/// </summary>
/// <param name="id">The id.</param>
/// <param name="name">The name.</param>
public Query(int id, string name) {
_Id = id;
_Name = name;
}
#endregion
#region Properties
/// <summary>
/// Gets the id.
/// </summary>
/// <value>The id.</value>
public int Id {
get {return _Id;}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name {
get { return _Name; }
}
#endregion
/// <summary>
/// Saves the query.
/// </summary>
/// <param name="username">The username.</param>
/// <param name="projectId">The project id.</param>
/// <param name="queryName">Name of the query.</param>
/// <param name="queryClauses">The query clauses.</param>
/// <returns></returns>
public static bool SaveQuery(string username, int projectId, string queryName, bool isPublic, List<QueryClause> queryClauses)
{
//if (username == null || username.Length == 0)
// throw new ArgumentOutOfRangeException("username");
//if username is null then query is global for all users on a project
if (projectId <= Globals.NewId)
throw new ArgumentOutOfRangeException("projectId");
if (queryName == null || queryName.Length == 0)
throw new ArgumentOutOfRangeException("queryName");
if (queryClauses.Count == 0)
throw new ArgumentOutOfRangeException("queryClauses");
return DataProviderManager.Provider.SaveQuery(username, projectId, queryName,isPublic, queryClauses);
}
/// <summary>
/// Deletes the query.
/// </summary>
/// <param name="queryId">The query id.</param>
/// <returns></returns>
public static bool DeleteQuery(int queryId) {
if (queryId <= Globals.NewId)
throw new ArgumentOutOfRangeException("queryId");
return DataProviderManager.Provider.DeleteQuery(queryId);
}
/// <summary>
/// Gets the queries by username.
/// </summary>
/// <param name="username">The username.</param>
/// <param name="projectId">The project id.</param>
/// <returns></returns>
public static List<Query> GetQueriesByUsername(string username, int projectId)
{
if (projectId <= Globals.NewId)
throw new ArgumentOutOfRangeException("projectId");
return DataProviderManager.Provider.GetQueriesByUserName(username, projectId);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -