private static void WriteButton(HtmlTextWriter writer, OrgDto theOrgDto, string buttonClass, string methodClick, string iconClass, string buttonText, string title = null) { writer.AddAttribute(HtmlTextWriterAttribute.Class, buttonClass); //writer.AddAttribute("orgId", theOrgDto.Id.ToString()); writer.AddAttribute("ng-click", methodClick, false); writer.AddAttribute(HtmlTextWriterAttribute.Title, title); writer.RenderBeginTag(HtmlTextWriterTag.Button); //<i class="fa fa-trash-o"></i> writer.AddAttribute(HtmlTextWriterAttribute.Class, iconClass); writer.RenderBeginTag(HtmlTextWriterTag.I); writer.RenderEndTag(); writer.WriteEncodedText(buttonText); writer.RenderEndTag(); }
//----helpers---- private static void WriteOpTds(HtmlTextWriter writer, OrgDto theOrgDto) { writer.RenderBeginTag(HtmlTextWriterTag.Td); //--------buttons start------- //<button class="btn btn-info btn-xs" ng-click="create('abc')" title="创建子节点"><i class="fa fa-plus"></i> 创建</button> //<button class="btn btn-danger btn-xs" ng-click="delete('abc')"><i class=" fa fa-trash-o"></i> 删除</button> //<button class="btn btn-warning btn-xs" ng-click="edit('abc')><i class="fa fa-pencil"></i> 修改</button> //<button class="btn btn-primary btn-xs" ng-click="show('abc')><i class="fa fa-search"></i> 详情</button> WriteButton(writer, theOrgDto, "btn btn-info btn-xs", string.Format("create('{0}')", theOrgDto.Id), "fa fa-trash-o", "创建", "点击创建子节点"); WriteButton(writer, theOrgDto, "btn btn-danger btn-xs", string.Format("delete('{0}')", theOrgDto.Id), "fa fa-trash-o", "修改", "点击修改此节点"); WriteButton(writer, theOrgDto, "btn btn-warning btn-xs", string.Format("edit('{0}')", theOrgDto.Id), "fa fa-pencil", "删除", "点击删除此节点"); WriteButton(writer, theOrgDto, "btn btn-primary btn-xs", string.Format("show('{0}')", theOrgDto.Id), "fa fa-search", "详情", "点击查看详细"); writer.RenderEndTag(); //--------buttons end------- }
public static IList <OrgDto> MockOrgDtos() { var ids = GuidHelper.CreateMockGuidQueue(100); var orgDtos = new List <OrgDto>(); var orgRoot = new OrgDto() { Id = ids.Dequeue(), Name = "1.", RelationCode = "1." }; orgDtos.Add(orgRoot); for (int i = 1; i <= 2; i++) { var append = i + "."; var orgI = new OrgDto() { Id = ids.Dequeue(), Name = orgRoot.Name + append, RelationCode = orgRoot.RelationCode + append }; orgDtos.Add(orgI); for (int j = 1; j <= 2; j++) { var appendJ = j + "."; var orgJ = new OrgDto() { Id = ids.Dequeue(), Name = orgI.Name + appendJ, RelationCode = orgI.RelationCode + appendJ }; orgDtos.Add(orgJ); for (int k = 1; k <= 2; k++) { var appendK = k + "."; var orgK = new OrgDto() { Id = ids.Dequeue(), Name = orgJ.Name + appendK, RelationCode = orgJ.RelationCode + appendK }; orgDtos.Add(orgK); } } } return(orgDtos); }