public ActionResult GetContact() { string snNum = WebUtil.GetFormValue<string>("SnNum",string.Empty); CustomerProvider provider = new CustomerProvider(); CusAddressEntity entity= new CusAddressEntity(); entity = provider.GetSingleAddress(snNum); if (entity.IsNotNull()) { StringBuilder sb = new StringBuilder(); List<CusAddressEntity> listResult = new List<CusAddressEntity>(); listResult.Add(entity); string json = ConvertJson.ListToJson(listResult, "List"); this.ReturnJson.AddProperty("Data", new JsonObject(json)); } return Content(this.ReturnJson.ToString()); }
/// <summary> /// 修改 /// </summary> /// <param name="entity"></param> /// <param name="list"></param> /// <returns></returns> public int Update(CustomerEntity entity, List<CusAddressEntity> list) { entity.IncludeCusName(true) .IncludeEmail(true) .IncludeFax(true) .IncludePhone(true) .IncludeRemark(true) .IncludeCusType(true) ; entity.Where(a => a.CusNum == entity.CusNum); int line = this.Customer.Update(entity); if (!list.IsNullOrEmpty()) { foreach (CusAddressEntity item in list) { item.CusNum = entity.CusNum; CusAddressEntity tempEntity = new CusAddressEntity(); tempEntity.IncludeAll(); tempEntity.Where(a => a.CusNum == item.CusNum).And(a => a.SnNum == item.SnNum); tempEntity = this.CusAddress.GetSingle(tempEntity); if (tempEntity.IsNotNull()) { item.IncludeAddress(true) .IncludeContact(true) .IncludePhone(true) ; item.Where(a => a.SnNum == item.SnNum).And(a => a.CusNum == item.CusNum); line += this.CusAddress.Update(item); } else { item.IncludeAll(); line = this.CusAddress.Add(item); } } if (line > 0) { CacheHelper.Remove(CacheKey.JOOSHOW_CUSADDRESS_CACHE); } } return line; }