public IControl GetQueryForm() { var form = new Form(); form.ID = "queryForm"; var queryList = this.S_DOC_Space.S_DOC_ListConfig.FirstOrDefault(d => d.RelationID == this.ID).S_DOC_QueryParam.OrderBy(d => d.QuerySort).ToList(); var table = ControlGenrator.CreateDefaultQueryFormTable(); for (int i = 0; i < queryList.Count; i++) { var query = queryList[i]; if (i % 3 == 0) { var row = new TableRow(); table.AddControl(row); } var currentRow = table.Rows.LastOrDefault(); var cell = new TableCell(); cell.InnerText = query.AttrName; cell.Style = " text-align: center; "; var contronCell = new TableCell(); contronCell.AddControl(query.GetCtontrol()); currentRow.AddControl(cell); currentRow.AddControl(contronCell); } form.AddControl(table); return(form); }
public IControl GetCtontrol(bool isUpVersion = false, bool fromQuery = false) { IControl control = ControlGenrator.GenrateMiniControl(this.InputType); control.Name = this.FileAttrField; if (this.InputType.IndexOf(ControlType.ButtonEdit.ToString()) >= 0) { control.SetAttribute("textName", this.FileAttrField + "Name"); if (fromQuery) { control = ControlGenrator.GenrateMiniControl(ControlType.TextBox.ToString()); control.Name = this.FileAttrField + "Name"; } else if (this.MultiSelect == "True") { control.SetAttribute("multiSelect", "true"); } } if (this.IsEnum == TrueOrFalse.True.ToString()) { string enumKey = this.EnumKey; if (enumKey.Split('.').Length > 1) { enumKey = enumKey.Split('.')[1]; } control.SetAttribute("data", enumKey); if (this.MultiSelect == "True") { control.SetAttribute("multiSelect", "true"); } if (!String.IsNullOrEmpty(this.TextFieldName)) { control.SetAttribute("textName", this.TextFieldName); } } if (!fromQuery) { if (!String.IsNullOrEmpty(this.VType)) { control.SetAttribute("vtype", this.VType); } if (this.Required == TrueOrFalse.True.ToString()) { control.SetAttribute("required", "true"); } if (this.Disabled == TrueOrFalse.True.ToString()) { control.SetAttribute("enabled", "false"); } } if (isUpVersion) { control.SetAttribute("enabled", "false"); } return(control); }
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); }
public IControl GetCtontrol() { IControl control; if (this.S_DOC_ListConfig.Type == ListConfigType.Node.ToString()) { var space = DocConfigHelper.CreateConfigSpaceByID(this.S_DOC_ListConfig.SpaceID); var node = space.S_DOC_Node.FirstOrDefault(d => d.ID == this.S_DOC_ListConfig.RelationID); if (node == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + this.S_DOC_ListConfig.RelationID + "】节点定义 "); } var attr = node.S_DOC_NodeAttr.FirstOrDefault(d => d.AttrField == this.InnerField); if (attr == null) { throw new Formula.Exceptions.BusinessException("未能找到【" + this.InnerField + "】属性定义 "); } control = ControlGenrator.GenrateMiniControl(attr.InputType); if (attr.IsEnum == TrueOrFalse.True.ToString() && !String.IsNullOrEmpty(attr.EnumKey)) { string enumKey = attr.EnumKey; if (enumKey.Split('.').Length > 1) { enumKey = enumKey.Split('.')[1]; } control.SetAttribute("data", enumKey); } } else { var space = DocConfigHelper.CreateConfigSpaceByID(this.S_DOC_ListConfig.SpaceID); var file = space.S_DOC_File.FirstOrDefault(d => d.ID == this.S_DOC_ListConfig.RelationID); if (file == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + this.S_DOC_ListConfig.RelationID + "】节点定义 "); } var attr = file.S_DOC_FileAttr.FirstOrDefault(d => d.FileAttrField == this.InnerField); if (attr == null) { throw new Formula.Exceptions.BusinessException("未能找到【" + this.InnerField + "】属性定义 "); } control = ControlGenrator.GenrateMiniControl(attr.InputType); if (attr.IsEnum == TrueOrFalse.True.ToString() && !String.IsNullOrEmpty(attr.EnumKey)) { string enumKey = attr.EnumKey; if (enumKey.Split('.').Length > 1) { enumKey = enumKey.Split('.')[1]; } control.SetAttribute("data", enumKey); } } if (String.IsNullOrEmpty(this.QueryType)) { control.Name = "$LK$" + this.InnerField; } else { control.Name = "$" + this.QueryType + "$" + this.InnerField; } control.Style = " width:90% "; return(control); }