public static ProjectsEntity CreateProject(int createUserID, ISystemDateTime datetimeProvider) { ProjectsEntity model = new ProjectsEntity(); model.ID = 0; model.CreatedBy = createUserID; model.CreatedOn = datetimeProvider.Now; model.ModifiedBy = createUserID; model.ModifiedOn = datetimeProvider.Now; model.Billable = false; model.BugNeedApproved = false; model.CompanyID = 0; model.Description = string.Empty; model.EndDate = datetimeProvider.Now; model.FreeHour = 0; model.IsOverFreeTime = false; model.PMID = 0; model.Priority = string.Empty; model.ProjectCode = string.Empty; model.ProjectID = 0; model.RequestNeedApproved = false; model.StartDate = datetimeProvider.Now; model.Status = ProjectStatus.Open; model.TestLinkURL = string.Empty; model.TestPassword = string.Empty; model.TestUserName = string.Empty; model.Title = string.Empty; return(model); }
/// <summary> /// Bind IDataReader to Entity /// </summary> public static ProjectsEntity ReaderBind(IDataReader dataReader) { ProjectsEntity model = new ProjectsEntity(); object ojb; ojb = dataReader["ProjectID"]; if (ojb != null && ojb != DBNull.Value) { model.ProjectID = (int)ojb; model.ID = model.ProjectID; } ojb = dataReader["CompanyID"]; if (ojb != null && ojb != DBNull.Value) { model.CompanyID = (int)ojb; } model.ProjectCode = dataReader["ProjectCode"].ToString(); model.Title = dataReader["Title"].ToString(); model.Description = dataReader["Description"].ToString(); ojb = dataReader["StartDate"]; if (ojb != null && ojb != DBNull.Value) { model.StartDate = (DateTime)ojb; } ojb = dataReader["EndDate"]; if (ojb != null && ojb != DBNull.Value) { model.EndDate = (DateTime)ojb; } ojb = dataReader["Status"]; if (ojb != null && ojb != DBNull.Value) { model.Status = (ProjectStatus)ojb; } ojb = dataReader["CreatedBy"]; if (ojb != null && ojb != DBNull.Value) { model.CreatedBy = (int)ojb; } ojb = dataReader["CreatedOn"]; if (ojb != null && ojb != DBNull.Value) { model.CreatedOn = (DateTime)ojb; } ojb = dataReader["ModifiedBy"]; if (ojb != null && ojb != DBNull.Value) { model.ModifiedBy = (int)ojb; } ojb = dataReader["ModifiedOn"]; if (ojb != null && ojb != DBNull.Value) { model.ModifiedOn = (DateTime)ojb; } ojb = dataReader["PMID"]; if (ojb != null && ojb != DBNull.Value) { model.PMID = (int)ojb; } model.Priority = dataReader["Priority"].ToString(); ojb = dataReader["Billable"]; if (ojb != null && ojb != DBNull.Value) { model.Billable = (bool)ojb; } model.TestLinkURL = dataReader["TestLinkURL"].ToString(); model.TestUserName = dataReader["TestUserName"].ToString(); model.TestPassword = dataReader["TestPassword"].ToString(); ojb = dataReader["FreeHour"]; if (ojb != null && ojb != DBNull.Value) { model.FreeHour = (int)ojb; } ojb = dataReader["BugNeedApproved"]; if (ojb != null && ojb != DBNull.Value) { model.BugNeedApproved = (bool)ojb; } ojb = dataReader["RequestNeedApproved"]; if (ojb != null && ojb != DBNull.Value) { model.RequestNeedApproved = (bool)ojb; } ojb = dataReader["IsOverFreeTime"]; if (ojb != null && ojb != DBNull.Value) { model.IsOverFreeTime = (bool)ojb; } ojb = dataReader["TotalHours"]; if (ojb != null && ojb != DBNull.Value) { model.TotalHours = float.Parse(ojb.ToString()); } ojb = dataReader["MaintenancePlanOption"]; if (ojb != null && ojb != DBNull.Value) { model.MaintenancePlanOption = (string)ojb; } return(model); }