public IControl GetEditForm() { var form = new Form(); form.Style = "padding-left: 11px; padding-top: 5px;"; var idHidden = new MiniHidden("ID"); form.AddControl(idHidden); var parentIDHidden = new MiniHidden("ParentID"); form.AddControl(parentIDHidden); foreach (var attr in this.S_DOC_NodeAttr.Where(d => d.Visible == "False").ToList()) { var hidden = new MiniHidden(attr.AttrField); form.AddControl(hidden); } var table = ControlGenrator.CreateDefaultFormTable(); bool changeRow = true; foreach (var attr in this.S_DOC_NodeAttr.Where(d => d.Visible == "True").OrderBy(d => d.AttrSort).ToList()) { if (attr.IsFullRow) { var row = new TableRow(); var cell = new TableCell(); cell.InnerText = attr.AttrName; row.AddControl(cell); var ctrlCell = new TableCell(); ctrlCell.ColSpan = 3; ctrlCell.Style = "padding-right:40px;"; var control = attr.GetCtontrol(); ctrlCell.AddControl(control); row.AddControl(ctrlCell); table.AddControl(row); changeRow = true; } else { var cell = new TableCell(); cell.InnerText = attr.AttrName; var ctrlCell = new TableCell(); ctrlCell.Style = "padding-right:40px;"; var control = attr.GetCtontrol(); ctrlCell.AddControl(control); if (changeRow) { var row = new TableRow(); row.AddControl(cell); row.AddControl(ctrlCell); table.AddControl(row); changeRow = false; } else { var row = table.Rows.LastOrDefault(); row.AddControl(cell); row.AddControl(ctrlCell); changeRow = true; } } } form.AddControl(table); return(form); }
public IControl GetEditForm(bool showAttachment = true, bool isUpVersion = false) { var form = new Form(); form.Style = "padding-left: 11px; padding-top: 5px;"; var idHidden = new MiniHidden("ID"); form.AddControl(idHidden); var nodeIDHidden = new MiniHidden("NodeID"); form.AddControl(nodeIDHidden); foreach (var attr in this.S_DOC_FileAttr.Where(d => d.Visible == "False").ToList()) { var hidden = new MiniHidden(attr.FileAttrField); form.AddControl(hidden); } var AllType = new string[] { "MainFile", "PdfFile", "PlotFile", "XrefFile", "DwfFile", "TiffFile", "SignPdfFile", "Attachments" }; var archiveType = System.Configuration.ConfigurationManager.AppSettings["ArchiveType"]; var ArchiveType = (string.IsNullOrEmpty(archiveType) ? "PdfFile" : archiveType).Split(',').ToList(); var ShowType = new List <string>(); foreach (var type in AllType) { if (showAttachment && (type == "MainFile" || type == "Attachments" || ArchiveType.Contains(type))) { ShowType.Add(type); } else { var hidden = new MiniHidden(type); form.AddControl(hidden); } } var table = ControlGenrator.CreateDefaultFormTable(); bool changeRow = true; foreach (var attr in this.S_DOC_FileAttr.Where(d => d.Visible == "True").OrderBy(d => d.AttrSort).ToList()) { if (attr.IsFullRow) { var row = new TableRow(); var cell = new TableCell(); cell.InnerText = attr.FileAttrName; row.AddControl(cell); var ctrlCell = new TableCell(); ctrlCell.ColSpan = 3; ctrlCell.Style = "padding-right:40px;"; var control = attr.GetCtontrol(isUpVersion); ctrlCell.AddControl(control); row.AddControl(ctrlCell); table.AddControl(row); changeRow = true; } else { var cell = new TableCell(); cell.InnerText = attr.FileAttrName; var ctrlCell = new TableCell(); var control = attr.GetCtontrol(isUpVersion); ctrlCell.Style = "padding-right:40px;"; ctrlCell.AddControl(control); if (changeRow) { var row = new TableRow(); row.AddControl(cell); row.AddControl(ctrlCell); table.AddControl(row); changeRow = false; } else { var row = table.Rows.LastOrDefault(); row.AddControl(cell); row.AddControl(ctrlCell); changeRow = true; } } } if (showAttachment) { AddAttachmentsControl(table, ShowType); } form.AddControl(table); return(form); }