/// <summary> /// Populate OH Reason with core attributes (ID, Code, & Description) /// Called by all Find overloads and from LoadJobFromWorkOrder in WIS /// </summary> /// <param name="dtResults"></param> /// <returns></returns> public static CommentAuditRecordCollection Populate(DataTable dtResults) { CommentAuditRecordCollection colMembers = null; CommentAuditRecord commentRecord = null; if (dtResults != null && dtResults.Rows.Count > 0) { colMembers = new CommentAuditRecordCollection(); foreach (DataRow drMember in dtResults.Rows) { commentRecord = new CommentAuditRecord(); commentRecord.ChangeDate = (DateTime)drMember["ChangeDate"]; commentRecord.ChangeUser = drMember["ChangeUser"].ToString(); commentRecord.IsEngineerComment = (bool)drMember["IsEngineerComment"]; // ----------------------------------------------------- commentRecord.Text = drMember["CommentText"].ToString(); if (!drMember["CommentType"].Equals(DBNull.Value)) { commentRecord.Type = (eCommentType)Enum.Parse(typeof(eCommentType), drMember["CommentType"].ToString()); } if (!drMember["SortExpression"].Equals(DBNull.Value)) { commentRecord.SortExpression = drMember["SortExpression"].ToString(); } colMembers.Add(commentRecord); } } return colMembers; }
public static string FormatCommentToString(CommentAuditRecord comment) { string commentsString = string.Empty; if (comment.ChangeDate == DateTime.MinValue) { commentsString = "[Unspec time]"; } else { commentsString = comment.ChangeDate.ToShortDateString(); commentsString += " " + comment.ChangeDate.ToLongTimeString(); } if (comment.ChangeUser != null) { if (comment.ChangeUser.IndexOf(@"\") > -1) { commentsString += " " + comment.ChangeUser.Substring(comment.ChangeUser.IndexOf(@"\") + 1); } else { commentsString += " " + comment.ChangeUser; } } commentsString += " " + comment.Text; return commentsString; }
public static CommentAuditRecord Populate(DataRow drMember) { CommentAuditRecord commentRecord = new CommentAuditRecord(); commentRecord.ChangeDate = (DateTime)drMember["ChangeDate"]; commentRecord.ChangeUser = drMember["ChangeUser"].ToString(); commentRecord.IsEngineerComment = (bool)drMember["IsEngineerComment"]; //CR : 2396 , IsCommentsCritical is used for filtering whether comments are critical / normal // Changed to IsCritical as per review comments commentRecord.IsCritical = (bool)drMember["IsCritical"]; commentRecord.Text = drMember["CommentText"].ToString(); if (!drMember["CommentType"].Equals(DBNull.Value)) { commentRecord.Type = (eCommentType)Enum.Parse(typeof(eCommentType), drMember["CommentType"].ToString()); } if (!drMember["SortExpression"].Equals(DBNull.Value)) { commentRecord.SortExpression = drMember["SortExpression"].ToString(); } return commentRecord; }