📄 project.cs
字号:
using System;
using System.Data;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using BugNET.DataAccessLayer;
using System.IO;
using System.Web;
using System.Xml.Serialization;
namespace BugNET.BusinessLogicLayer
{
/// <summary>
/// Summary description for Project.
/// </summary>
public class Project
{
private string _Description;
private int _Id;
private string _Name;
private string _Code;
private Guid _ManagerId;
private string _ManagerUserName;
private DateTime _DateCreated;
private string _CreatorUserName;
private string _UploadPath;
private bool _Disabled;
private Globals.ProjectAccessType _AccessType;
private bool _AllowAttachments;
private IssueAttachmentStorageType _AttachmentStorageType;
private string _SvnRepositoryUrl;
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="Project"/> class.
/// </summary>
/// <param name="projectId">The project id.</param>
/// <param name="name">The name.</param>
/// <param name="code">The code.</param>
/// <param name="description">The description.</param>
/// <param name="managerUserName">Name of the manager user.</param>
/// <param name="creatorUserName">Name of the creator user.</param>
/// <param name="uploadPath">The upload path.</param>
/// <param name="accessType">Type of the access.</param>
/// <param name="active">The active.</param>
/// <param name="allowAttachments">if set to <c>true</c> [allow attachments].</param>
public Project(int projectId, string name, string code, string description, string managerUserName, string creatorUserName, string uploadPath, Globals.ProjectAccessType accessType, bool disabled, bool allowAttachments, IssueAttachmentStorageType attachmentStorageType, string svnRepositoryUrl)
: this(projectId, name, code, description, managerUserName, creatorUserName, uploadPath, DateTime.Now, accessType, disabled, allowAttachments, Guid.Empty, attachmentStorageType, svnRepositoryUrl)
{}
/// <summary>
/// Initializes a new instance of the <see cref="Project"/> class.
/// </summary>
/// <param name="projectId">The project id.</param>
/// <param name="name">The name.</param>
/// <param name="code">The code.</param>
/// <param name="description">The description.</param>
/// <param name="managerUserName">Name of the manager user.</param>
/// <param name="creatorUserName">Name of the creator user.</param>
/// <param name="uploadPath">The upload path.</param>
/// <param name="dateCreated">The date created.</param>
/// <param name="accessType">Type of the access.</param>
/// <param name="active">The active.</param>
/// <param name="allowAttachments">if set to <c>true</c> [allow attachments].</param>
public Project(int projectId,string name,string code, string description,string managerUserName,
string creatorUserName, string uploadPath, DateTime dateCreated, Globals.ProjectAccessType accessType, bool disabled, bool allowAttachments, Guid managerId, IssueAttachmentStorageType attachmentStorageType, string svnRepositoryUrl)
{
// Validate Mandatory Fields//
if (name == null ||name.Length==0 )
throw (new ArgumentOutOfRangeException("name"));
_Id = projectId;
_Description = description;
_Name = name;
_Code = code;
_ManagerUserName = managerUserName;
_ManagerId = managerId;
_CreatorUserName = creatorUserName;
_DateCreated = dateCreated;
_UploadPath = uploadPath;
_Disabled = disabled;
_AccessType = accessType;
_AllowAttachments = allowAttachments;
_AttachmentStorageType = attachmentStorageType;
_SvnRepositoryUrl = svnRepositoryUrl;
}
/// <summary>
/// Initializes a new instance of the <see cref="Project"/> class.
/// </summary>
public Project(){}
#endregion
#region Properties
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
public int Id
{
get {return _Id;}
set {throw new Exception("Cannot set readonly property Id");}
}
/// <summary>
/// Gets or sets the type of the attachment storage.
/// </summary>
/// <value>The type of the attachment storage.</value>
public IssueAttachmentStorageType AttachmentStorageType
{
get { return _AttachmentStorageType; }
set { _AttachmentStorageType = value; }
}
/// <summary>
/// Gets or sets the code.
/// </summary>
/// <value>The code.</value>
public string Code
{
get{return _Code;}
set{_Code = value;}
}
/// <summary>
/// Gets or sets the manager id.
/// </summary>
/// <value>The manager id.</value>
public Guid ManagerId
{
get { return _ManagerId; }
set { _ManagerId = value; }
}
/// <summary>
/// Gets or sets the name of the creator user.
/// </summary>
/// <value>The name of the creator user.</value>
public string CreatorUserName
{
get {return _CreatorUserName;}
set { _CreatorUserName = value; }
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Project"/> is disabled.
/// </summary>
/// <value><c>true</c> if disabled; otherwise, <c>false</c>.</value>
public bool Disabled
{
get {return _Disabled;}
set { _Disabled = value; }
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
if (_Name == null ||_Name.Length==0)
return string.Empty;
else
return _Name;
}
set {_Name = value;}
}
/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>The description.</value>
public string Description
{
get
{
if (_Description == null ||_Description.Length==0)
return string.Empty;
else
return _Description;
}
set
{ _Description = value;}
}
/// <summary>
/// Gets or sets the date created.
/// </summary>
/// <value>The date created.</value>
public DateTime DateCreated
{
get {return _DateCreated;}
set{throw new Exception("Cannot set readonly property DateCreated");}
}
/// <summary>
/// Gets or sets the name of the manager user.
/// </summary>
/// <value>The name of the manager user.</value>
public string ManagerUserName
{
get {return _ManagerUserName;}
set { _ManagerUserName = value; }
}
/// <summary>
/// Gets or sets the upload path.
/// </summary>
/// <value>The upload path.</value>
public string UploadPath
{
get
{
if (_UploadPath == null || _UploadPath.Length==0)
return string.Empty;
else
return _UploadPath;
}
set {_UploadPath = value;}
}
/// <summary>
/// Gets or sets the type of the access.
/// </summary>
/// <value>The type of the access.</value>
public Globals.ProjectAccessType AccessType
{
get
{
return _AccessType;
}
set
{
_AccessType = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether [allow attachments].
/// </summary>
/// <value><c>true</c> if [allow attachments]; otherwise, <c>false</c>.</value>
public bool AllowAttachments
{
get
{
return _AllowAttachments;
}
set
{
_AllowAttachments = value;
}
}
/// <summary>
/// Gets or sets the SVN repository URL.
/// </summary>
/// <value>The SVN repository URL.</value>
public string SvnRepositoryUrl
{
get { return _SvnRepositoryUrl; }
set { _SvnRepositoryUrl = value; }
}
#endregion
#region Public Methods
/// <summary>
/// Saves this instance.
/// </summary>
/// <returns></returns>
public bool Save ()
{
if (_Id <= 0)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -