/// <summary> /// 查找指定类型的所有文档 /// </summary> /// <typeparam name="TDocument">文档类型</typeparam> /// <returns>文档对象序列</returns> public virtual IEnumerable <TDocument> FindAll <TDocument>() { try { string[] files = System.IO.Directory.GetFiles( GenerateFilePath <TDocument>(), "*." + FileExtension, SearchOption.TopDirectoryOnly); List <TDocument> list = new List <TDocument>(); foreach (string fileName in files) { string fileData = File.ReadAllText(fileName); TDocument document = Deserialize <TDocument>(fileData); if (document != null) { list.Add(document); } } return(list); } catch (Exception ex) { throw new Exception( "Find all documents failed.", ex); } }
/// <summary>Creates a new NSwagDocument.</summary> /// <typeparam name="TDocument">The type.</typeparam> /// <returns>The document.</returns> protected static TDocument Create <TDocument>() where TDocument : NSwagDocumentBase, new() { var document = new TDocument(); document.Path = "Untitled"; document._latestData = JsonConvert.SerializeObject(document, Formatting.Indented, GetSerializerSettings()); return(document); }
/// <summary> /// сохранить документ в базе /// </summary> public void CreateAndSaveDocument(string label, int type) { List <TDocument> docs = new List <TDocument>(); TDocument doc = new TDocument { CreatorID = (int)Session["ID"], Label = label, StatusID = TDocumentStatus.NEW, TypeID = type, Created = DateTime.Now, }; if (!string.IsNullOrEmpty(Request["ID"])) { doc.ParentDocunentID = int.Parse(Request["ID"]); } docs.Add(doc); CreateAndSaveDocuments(docs); }
private void detach_TDocuments(TDocument entity) { this.SendPropertyChanging(); entity.TDocument1 = null; }
private void attach_TDocuments(TDocument entity) { this.SendPropertyChanging(); entity.TDocument1 = this; }
partial void DeleteTDocument(TDocument instance);
partial void UpdateTDocument(TDocument instance);
partial void InsertTDocument(TDocument instance);
//static void HTMLtest() //{ // TDocument ds = new TDocument(3); // TDocumentText txt = new TDocumentText("Accounting Group"); // txt.Bold = true; // txt.Italic = true; // txt.Font =true; // txt.Color = "#800000"; // TDocumentTable table = new TDocumentTable(); // table.Border=1; // table.Caption = "Accounting Group"; // table.Width=100; // table.BackgroundColor="#EFEEEC"; // TDocumentTableRow row = null; // row = new TDocumentTableRow(); // TDocumentText headtxt = new TDocumentText("Group Code"); // headtxt.Bold = true; // headtxt.Font=true; // headtxt.Color="#800000"; // TDocumentTableCell cell = null; // cell = new TDocumentTableCell(alignment.HEADING); // cell.addObject(headtxt); // row.addObject(cell); // headtxt = new TDocumentText("Group Name"); // headtxt.Bold = true; // headtxt.Font=true; // headtxt.Color="#800000"; // cell = new TDocumentTableCell(alignment.HEADING); // cell.addObject(headtxt); // row.addObject(cell); // int a = 16; // int j = 1; // while (j < 12) // { // row = new TDocumentTableRow(); // cell = new TDocumentTableCell(alignment.DATA); // cell.addObject(new TDocumentText(a.ToString())); // row.addObject(cell); // cell = new TDocumentTableCell(alignment.DATA); // cell.addObject(new TDocumentText(j.ToString())); // row.addObject(cell); // cell = new TDocumentTableCell(alignment.DATA); // int result = a * j; // cell.addObject(new TDocumentText(result.ToString())); // row.addObject(cell); // table.addObject(row); // j++; // } // //ds.addObject(txt); // ds.addObject(table); // string filename = // @"D:\ab\fund.html"; // ds.accept(new HTMLVisitor(filename)); // // string rs = ds.toHTML(); // // FileStream fs = new FileStream(@"d:\ab\a.html", FileMode.Create); // // StreamWriter st = new StreamWriter(fs); // // st.Write(rs); // // st.Close(); //} static void DocumentRender() { TDocument ds = new TDocument(3); ds.Title = "Multiplication Table"; TDocumentTable table = new TDocumentTable(); table.Border = 1; table.Width = 100; table.BackgroundColor = "#EFEEEC"; TDocumentTableRow row = null; row = new TDocumentTableRow(); TDocumentText headtxt = new TDocumentText("Multiplicand"); headtxt.Font = true; headtxt.Color = "#800000"; TDocumentTableCell cell = null; cell = new TDocumentTableCell(alignment.HEADING); cell.addObject(headtxt); row.addObject(cell); headtxt = new TDocumentText("Multiplier"); headtxt.Color = "#800000"; cell = new TDocumentTableCell(alignment.HEADING); cell.addObject(headtxt); row.addObject(cell); headtxt = new TDocumentText("Result"); headtxt.Color = "#800000"; cell = new TDocumentTableCell(alignment.HEADING); cell.addObject(headtxt); row.addObject(cell); table.addObject(row); int a = 16; int j = 1; while (j < 12) { row = new TDocumentTableRow(); cell = new TDocumentTableCell(alignment.DATA); cell.addObject(new TDocumentText(a.ToString())); row.addObject(cell); cell = new TDocumentTableCell(alignment.DATA); cell.addObject(new TDocumentText(j.ToString())); row.addObject(cell); cell = new TDocumentTableCell(alignment.DATA); int result = a * j; cell.addObject(new TDocumentText(result.ToString())); row.addObject(cell); table.addObject(row); j++; } ds.addObject(table); string filename = @"D:\ab\fund.pdf"; ds.accept(new PDFVisitor(filename)); string filename2 = @"D:\ab\fund.html"; ds.accept(new HTMLVisitor(filename2)); }