public static FilesEntity CreateFileEntity(int createUserID, ISystemDateTime datetimeProvider) { FilesEntity model = new FilesEntity(); model.ID = 0; model.CreatedBy = createUserID; model.CreatedOn = datetimeProvider.Now; model.ModifiedBy = createUserID; model.ModifiedOn = datetimeProvider.Now; model.ContentType = string.Empty; model.FilePath = string.Empty; model.FileID = 0; model.FileSize = 0; model.FileTitle = string.Empty; model.IsDelete = false; model.IsPublic = false; model.FeedbackId = 0; model.TicketId = 0; model.ProjectId = 0; model.SourceType = 0; model.ThumbPath = string.Empty; return(model); }
/// <summary> /// Bind IDataReader to Entity /// </summary> public static FilesEntity ReaderBind(IDataReader dataReader) { FilesEntity model = new FilesEntity(); object ojb; ojb = dataReader["FileID"]; if (ojb != null && ojb != DBNull.Value) { model.FileID = (int)ojb; } ojb = dataReader["CompanyID"]; if (ojb != null && ojb != DBNull.Value) { model.CompanyID = (int)ojb; } ojb = dataReader["ProjectId"]; if (ojb != null && ojb != DBNull.Value) { model.ProjectId = (int)ojb; } ojb = dataReader["TicketId"]; if (ojb != null && ojb != DBNull.Value) { model.TicketId = (int)ojb; } ojb = dataReader["FeedbackId"]; if (ojb != null && ojb != DBNull.Value) { model.FeedbackId = (int)ojb; } ojb = dataReader["SourceType"]; if (ojb != null && ojb != DBNull.Value) { model.SourceType = (int)ojb; } model.FileTitle = dataReader["FileTitle"].ToString(); model.ContentType = dataReader["ContentType"].ToString(); ojb = dataReader["FileSize"]; if (ojb != null && ojb != DBNull.Value) { model.FileSize = (decimal)ojb; } model.FilePath = dataReader["FilePath"].ToString(); model.ThumbPath = dataReader["ThumbPath"].ToString(); ojb = dataReader["CreatedOn"]; if (ojb != null && ojb != DBNull.Value) { model.CreatedOn = (DateTime)ojb; } ojb = dataReader["CreatedBy"]; if (ojb != null && ojb != DBNull.Value) { model.CreatedBy = (int)ojb; } ojb = dataReader["IsDelete"]; if (ojb != null && ojb != DBNull.Value) { model.IsDelete = (bool)ojb; } ojb = dataReader["IsPublic"]; if (ojb != null && ojb != DBNull.Value) { model.IsPublic = (bool)ojb; } model.Tags = dataReader["Tags"].ToString(); ojb = dataReader["WorkRequestId"]; if (ojb != null && ojb != DBNull.Value) { model.ProposalTrackerId = (int)ojb; } return(model); }