当前位置: 首页>>代码示例>>C#>>正文


C# JObject.AddRange方法代码示例

本文整理汇总了C#中Newtonsoft.Json.Linq.JObject.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# JObject.AddRange方法的具体用法?C# JObject.AddRange怎么用?C# JObject.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Newtonsoft.Json.Linq.JObject的用法示例。


在下文中一共展示了JObject.AddRange方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: document

 /// <summary>
 /// Retrieve document, or prepare new one
 /// </summary>
 public JObject document(int id, DocType type)
 {
     Title = Title.Replace("Document", type.UnCamel());
     Extended_Document header = getDocument<Extended_Document>(id);
     if (header.idDocument == null) {
         header.DocumentTypeId = (int)type;
         header.DocType = type.UnCamel();
         header.DocumentDate = Utils.Today;
         header.DocumentName = "";
         header.DocumentIdentifier = Settings.NextNumber(type).ToString();
         if (GetParameters["name"].IsInteger()) {
             JObject name = Database.QueryOne("*", "WHERE Type = " + Database.Quote(NameType) + " AND idNameAddress = " + GetParameters["name"], "NameAddress");
             if (name != null) {
                 checkNameType(name.AsString("Type"), NameType);
                 header.DocumentNameAddressId = name.AsInt("idNameAddress");
                 header.DocumentAddress = name.AsString("Address");
                 header.DocumentName = name.AsString("Name");
             }
         }
     } else {
         checkDocType(header.DocumentTypeId, type);
         checkNameType(header.DocumentNameAddressId, NameType);
     }
     JObject record = new JObject().AddRange("header", header);
     Database.NextPreviousDocument(record, "WHERE DocumentTypeId = " + (int)type);
     Select s = new Select();
     record.AddRange("VatCodes", s.VatCode(""),
         "Names", s.Name(NameType, ""));
     return record;
 }
开发者ID:nikkilocke,项目名称:AccountServer,代码行数:33,代码来源:CustomerSupplier.cs

示例2: Document

 /// <summary>
 /// Get a Buy or Sell document for editing
 /// </summary>
 public void Document(int id, DocType type)
 {
     Title = Title.Replace("Document", type.UnCamel());
     InvestmentDocument header = getDocument<InvestmentDocument>(id);
     if (header.idDocument == null) {
         header.DocumentTypeId = (int)type;
         header.DocType = type.UnCamel();
         header.DocumentDate = Utils.Today;
         header.DocumentName = "";
         if (GetParameters["acct"].IsInteger()) {
             FullAccount acct = Database.QueryOne<FullAccount>("*", "WHERE idAccount = " + GetParameters["acct"], "Account");
             if (acct.idAccount != null) {
                 header.DocumentAccountId = (int)acct.idAccount;
                 header.DocumentAccountName = acct.AccountName;
                 header.FeeAccount = Database.QueryOne("SELECT idAccount FROM Account WHERE AccountName = " + Database.Quote(acct.AccountName + " fees")).AsInt("idAccount");
             }
         }
     } else {
         checkDocType(header.DocumentTypeId, DocType.Buy, DocType.Sell);
         List<JObject> journals = Database.Query(@"SELECT *
     FROM Journal
     LEFT JOIN StockTransaction ON idStockTransaction = idJournal
     LEFT JOIN Security ON idSecurity = SecurityId
     WHERE JournalNum > 1
     AND DocumentId = " + id).ToList();
         header.SecurityId = journals[0].AsInt("SecurityId");
         header.SecurityName = journals[0].AsString("SecurityName");
         header.Quantity = journals[0].AsDouble("Quantity");
         header.Price = journals[0].AsDouble("Price");
         if (journals.Count > 1) {
             header.FeeAccount = journals[1].AsInt("AccountId");
             header.Fee = journals[1].AsDecimal("Amount");
             header.FeeMemo = journals[1].AsString("Memo");
         }
         if (type == DocType.Sell)
             header.Quantity = -header.Quantity;
     }
     JObject record = new JObject().AddRange("header", header);
     Database.NextPreviousDocument(record, "JOIN Journal ON DocumentId = idDocument WHERE DocumentTypeId "
         + Database.In(DocType.Buy, DocType.Sell)
         + (header.DocumentAccountId > 0 ? " AND AccountId = " + header.DocumentAccountId : ""));
     Select s = new Select();
     record.AddRange("Accounts", s.ExpenseAccount(""),
         "Names", s.Other(""),
         "Securities", s.Security(""));
     Record = record;
 }
开发者ID:nikkilocke,项目名称:AccountServer,代码行数:50,代码来源:Investments.cs

示例3: auditFlatten

 /// <summary>
 /// Flatten an audit header-detail set into multiple records containing the header and 1 detail
 /// </summary>
 IEnumerable<JObject> auditFlatten(IEnumerable<JObject> data)
 {
     foreach (JObject record in data) {
         JObject r = JObject.Parse(record.AsString("Record"));
         record.Remove("Record");
         JObject header = (JObject)r["header"];
         if (header == null) {
             record.AddRange(r);
             yield return record;
         } else {
             if(header["DocumentAmount"] == null) header["DocumentAmount"] = header["Amount"];
             if (header["DocumentName"] == null) header["DocumentName"] = header["Name"];
             if (header["DocumentOutstanding"] == null) header["DocumentOutstanding"] = header["Outstanding"];
             foreach (JObject detail in (JArray)r["detail"]) {
                 JObject result = new JObject();
                 result.AddRange(record, header, detail);
                 yield return result;
             }
         }
     }
 }
开发者ID:nikkilocke,项目名称:AccountServer,代码行数:24,代码来源:Reports.cs


注:本文中的Newtonsoft.Json.Linq.JObject.AddRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。