本文整理汇总了C#中JsonObject.AddProperty方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.AddProperty方法的具体用法?C# JsonObject.AddProperty怎么用?C# JsonObject.AddProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonObject
的用法示例。
在下文中一共展示了JsonObject.AddProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoProduct
public ActionResult AutoProduct(string productName)
{
ProductProvider provider = new ProductProvider();
List<ProductEntity> list = provider.GetListByCache();
if (!list.IsNullOrEmpty() && !productName.IsEmpty())
{
list = list.Where(a => a.ProductName.Contains(productName) || a.BarCode.Contains(productName) || a.SnNum.Contains(productName)).ToList();
}
list = list.IsNull() ? new List<ProductEntity>() : list;
StringBuilder sb = new StringBuilder();
JsonObject jsonObject = null;
foreach (ProductEntity t in list)
{
jsonObject = new JsonObject();
jsonObject.AddProperty("BarCode", t.BarCode);
jsonObject.AddProperty("ProductName", t.ProductName);
jsonObject.AddProperty("SnNum", t.SnNum);
jsonObject.AddProperty("CateNum", t.CateNum);
jsonObject.AddProperty("CateName", t.CateName);
jsonObject.AddProperty("InPrice", t.InPrice);
jsonObject.AddProperty("Unit", t.UnitNum);
jsonObject.AddProperty("UnitName", t.UnitName);
jsonObject.AddProperty("Size", t.Size);
jsonObject.AddProperty("Num", t.Num);
sb.Append(jsonObject.ToString() + "\n");
}
if (sb.Length == 0)
{
sb.Append("\n");
}
return Content(sb.ToString());
}
示例2: Auto
public ActionResult Auto(string supName)
{
SupplierProvider provider = new SupplierProvider();
List<SupplierEntity> list = provider.GetList();
if (!list.IsNullOrEmpty() && !supName.IsEmpty())
{
list = list.Where(a => a.SupNum.Contains(supName) || a.SupName.Contains(supName)).ToList();
}
list = list.IsNull() ? new List<SupplierEntity>() : list;
StringBuilder sb = new StringBuilder();
JsonObject jsonObject = null;
foreach (SupplierEntity t in list)
{
jsonObject = new JsonObject();
jsonObject.AddProperty("SupNum", t.SupNum);
jsonObject.AddProperty("SupName", t.SupName);
jsonObject.AddProperty("ContactName", t.ContactName);
jsonObject.AddProperty("Phone", t.Phone);
sb.Append(jsonObject.ToString() + "\n");
}
if (sb.Length == 0)
{
sb.Append("\n");
}
return Content(sb.ToString());
}
示例3: SetJsonProperties
protected override void SetJsonProperties(JsonObject json)
{
if (json == null) throw new ArgumentNullException("json");
json.AddProperty("v", new GoogleValue(DataType, Value));
if (Formatted != null) json.AddProperty("f", Formatted);
}
示例4: AutoOrder
public ActionResult AutoOrder(string productName)
{
string orderNum = WebUtil.GetFormValue<string>("orderNum", string.Empty);
PageInfo page = new PageInfo { PageIndex = 1, PageSize = 5 };
Bill<OrdersEntity, OrderDetailEntity> bill = new OrderBill();
OrdersEntity entity = new OrdersEntity();
if (orderNum != string.Empty)
{
entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%");
}
entity.Where(a => a.AuditeStatus == (int)EAudite.Pass).And(a => a.Status != (int)EOrderStatus.AllDelivery);
List<OrdersEntity> list = bill.GetList(entity, ref page);
list = list.IsNull() ? new List<OrdersEntity>() : list;
StringBuilder sb = new StringBuilder();
JsonObject jsonObject = null;
foreach (OrdersEntity t in list)
{
jsonObject = new JsonObject();
jsonObject.AddProperty("OrderNum", t.OrderNum);
jsonObject.AddProperty("CusName", t.CusName);
sb.Append(jsonObject.ToString() + "\n");
}
if (sb.Length == 0)
{
sb.Append("\n");
}
return Content(sb.ToString());
}
示例5: AutoSinProduct
public ActionResult AutoSinProduct(string ProductNum)
{
ProductProvider provider = new ProductProvider();
List<ProductEntity> list = provider.GetListByCache();
ProductEntity entity = null;
if (!list.IsNullOrEmpty() && !ProductNum.IsEmpty())
{
entity = list.FirstOrDefault(a => a.SnNum == ProductNum);
}
entity = entity.IsNull() ? new ProductEntity() : entity;
List<ProductEntity> listSource = new List<ProductEntity>();
listSource.Add(entity);
StringBuilder sb = new StringBuilder();
JsonObject jsonObject = null;
foreach (ProductEntity t in listSource)
{
jsonObject = new JsonObject();
jsonObject.AddProperty("BarCode", t.BarCode);
jsonObject.AddProperty("ProductName", t.ProductName);
jsonObject.AddProperty("SnNum", t.SnNum);
jsonObject.AddProperty("CateNum", t.CateNum);
jsonObject.AddProperty("CateName", t.CateName);
jsonObject.AddProperty("InPrice", t.InPrice);
jsonObject.AddProperty("Unit", t.UnitNum);
jsonObject.AddProperty("UnitName", t.UnitName);
jsonObject.AddProperty("Size", t.Size.Escape());
jsonObject.AddProperty("Num", t.Num);
sb.Append(jsonObject.ToString() + "\n");
}
if (sb.Length == 0)
{
sb.Append("\n");
}
return Content(sb.ToString());
}
示例6: SetJsonProperties
protected override void SetJsonProperties(JsonObject json)
{
json.AddProperty("v", new GoogleValue(DataType, Value));
if (Formatted != null) json.AddProperty("f", Formatted);
}