private void InitAttachmentsList() { // init attachments list by Email mode - for Central Office or for SME revision: var _page = new PageBase(); var ds = Document.GetDocumentAttachments(Convert.ToInt32(_page.DocNumber), _page.LoadID.ToString()); string field_to_search; if (EmailMode == MODE_SAMPLE_CO) { field_to_search = "IncludeInEmail"; } else if (EmailMode == MODE_SAMPLE_SME) { field_to_search = "IncludeRevisionEmail"; } else { return; } var docs_array = ","; var doc_in_arr = ""; var sb = new StringBuilder(); var tr = new HtmlTableRow(); HtmlTableCell td; if (ds != null && ds.Tables[0].Rows.Count > 0) { tblAtt.Rows.Add(tr); foreach (DataRow dr in ds.Tables[0].Rows) { doc_in_arr = dr["DocID"].ToString() + ","; if ((bool)dr[field_to_search] && docs_array.IndexOf("," + doc_in_arr) == -1) { //add new file: docs_array = docs_array + doc_in_arr; tr = new HtmlTableRow(); tblAtt.Rows.Add(tr); td = new HtmlTableCell(); td.AddBldGreyText(); td.InnerText = dr["FileName"].ToString(); tr.Cells.Add(td); sb.Append("File: "); sb.Append(dr["FileName"].ToString()); sb.AppendLine(); sb.Append("Documents included: "); var document = new Document((int)dr["DocID"]); sb.Append(String.Join(",", document.DocumentTypeName)); sb.AppendLine(); sb.Append("Associated Lines (ItemLNum) : "); sb.Append(dr["LinesInfo"].ToString()); sb.AppendLine(); sb.Append("Comment: "); sb.Append(dr["Comment"].ToString()); sb.AppendLine(); } } if (docs_array.Length > 1) { docs_array = docs_array.Substring(1, docs_array.Length - 2); } else { docs_array = ""; } DocsArray = docs_array; txtComments.Value = sb.ToString(); } else { trCheckbox.Visible = false; DocsArray = ""; } }