public static Category GetCategoryByCategoryId(int Id) { if (Id <= DefaultValues.GetCategoryIdMinValue()) { return(null); } DataAccess DALLayer = DataAccessHelper.GetDataAccess(); return(DALLayer.GetCategoryByCategoryId(Id)); }
/*** METHOD STATIC ***/ public static List <UserReport> GetUserReportsByCategoryId(int CategoryId) { if (CategoryId <= DefaultValues.GetCategoryIdMinValue()) { return(new List <UserReport>()); } DataAccess DALLayer = DataAccessHelper.GetDataAccess(); return(DALLayer.GetUserReportsByCategoryId(CategoryId)); }
/*** METHOD STATIC ***/ public static bool DeleteCategory(int id, int original_Id) { if (original_Id <= DefaultValues.GetCategoryIdMinValue()) { throw (new ArgumentOutOfRangeException("original_Id")); } DataAccess DALLayer = DataAccessHelper.GetDataAccess(); return(DALLayer.DeleteCategory(original_Id)); }
/*** METHODS ***/ public bool Delete() { if (this.Id > DefaultValues.GetCategoryIdMinValue()) { DataAccess DALLayer = DataAccessHelper.GetDataAccess(); return(DALLayer.DeleteCategory(this.Id)); } else { return(false); } }
/*** CONSTRUCTOR ***/ public UserReport(decimal actualDuration, int categoryId, string userName) { if (categoryId <= DefaultValues.GetCategoryIdMinValue()) { throw (new ArgumentOutOfRangeException("categoryId")); } if (String.IsNullOrEmpty(userName)) { throw (new NullReferenceException("userName")); } _ActualDuration = actualDuration; _CategoryId = categoryId; _UserName = userName; }
public bool Save() { DataAccess DALLayer = DataAccessHelper.GetDataAccess(); if (Id <= DefaultValues.GetCategoryIdMinValue()) { int TempId = DALLayer.CreateNewCategory(this); if (TempId > DefaultValues.GetCategoryIdMinValue()) { _Id = TempId; return(true); } else { return(false); } } else { return(DALLayer.UpdateCategory(this)); } }
public TimeEntry(string creatorUserName, int categoryId, DateTime dateCreated, string description, decimal duration, int id, DateTime reportedDate, string userName) { if (String.IsNullOrEmpty(creatorUserName)) { throw (new NullReferenceException("creatorUserName")); } if (categoryId <= DefaultValues.GetCategoryIdMinValue()) { throw (new ArgumentOutOfRangeException("categoryId")); } if (duration <= DefaultValues.GetDurationMinValue()) { throw (new ArgumentOutOfRangeException("duration")); } if (reportedDate <= DefaultValues.GetDateTimeMinValue()) { throw (new ArgumentOutOfRangeException("reportedDate")); } if (String.IsNullOrEmpty(userName)) { throw (new NullReferenceException("userName")); } _CreatorUserName = creatorUserName; _CategoryId = categoryId; _DateCreated = dateCreated; _Description = description; _Duration = duration; _Id = id; _ReportedDate = reportedDate; _UserName = userName; }
public Category(string abbreviation, decimal estimateDuration, string name, int projectId) : this(abbreviation, DefaultValues.GetDurationMinValue(), DefaultValues.GetCategoryIdMinValue(), estimateDuration, name, projectId) { }
/*** CONSTRUCTOR ***/ public Category(string name, int projectId) : this(string.Empty, DefaultValues.GetDurationMinValue(), DefaultValues.GetCategoryIdMinValue(), DefaultValues.GetDurationMinValue(), name, projectId) { }