예제 #1
0
 /// <summary>
 /// 删除地址
 /// </summary>
 /// <param name="snNum"></param>
 /// <param name="cusNum"></param>
 /// <returns></returns>
 public int DelCusAddress(string snNum, string cusNum)
 {
     int line = 0;
     List<CusAddressEntity> list = GetAddressList(cusNum);
     list.ForEach(a =>
     {
         if (!snNum.IsNullOrEmpty() && !cusNum.IsNullOrEmpty())
         {
             CusAddressEntity entity = new CusAddressEntity();
             entity.IncludeIsDelete(true);
             entity.IsDelete = (int)EIsDelete.Deleted;
             entity.Where(c => c.SnNum == snNum).And(c => c.CusNum == cusNum);
             line += this.CusAddress.Update(entity);
             if (a.SnNum == snNum)
             {
                 a.IsDelete = (int)EIsDelete.Deleted;
                 line++;
             }
         }
         else
         {
             if (a.SnNum == snNum)
             {
                 a.IsDelete = (int)EIsDelete.Deleted;
                 line++;
             }
         }
     });
     list.Remove(a => a.IsDelete == (int)EIsDelete.Deleted);
     CacheHelper.Insert(CacheKey.JOOSHOW_CUSADDRESS_CACHE, list);
     return line;
 }
예제 #2
0
 /// <summary>
 /// 根据收货单位编号获得地址信息
 /// </summary>
 /// <param name="snNum"></param>
 /// <returns></returns>
 public CusAddressEntity GetSingleAddress(string snNum)
 {
     try
     {
         CusAddressEntity entity = new CusAddressEntity();
         entity.IncludeAll();
         entity.Where(a => a.SnNum == snNum);
         entity = this.CusAddress.GetSingle(entity);
         return entity;
     }
     catch
     {
         return null;
     }
 }
예제 #3
0
 /// <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;
 }
예제 #4
0
 /// <summary>
 /// 获得所有的地址
 /// </summary>
 /// <param name="cusNum"></param>
 /// <returns></returns>
 public List<CusAddressEntity> GetAddressList(string cusNum)
 {
     CusAddressEntity entity = new CusAddressEntity();
     entity.IncludeAll();
     entity.Where<CusAddressEntity>(a => a.CusNum == cusNum).And<CusAddressEntity>(a => a.IsDelete == (int)EIsDelete.NotDelete);
     List<CusAddressEntity> listResult = this.CusAddress.GetList(entity);
     return listResult;
 }