Ejemplo n.º 1
0
 /// <summary>
 ///  创建客户_企业信息集合
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="entitys">客户_企业信息集合</param>
 /// <returns></returns>
 public bool EditCollection(ref ValidationErrors validationErrors, IQueryable <CRM_Company> entitys)
 {
     try
     {
         if (entitys != null)
         {
             int count = entitys.Count();
             if (count == 1)
             {
                 return(this.Edit(ref validationErrors, entitys.FirstOrDefault()));
             }
             else if (count > 1)
             {
                 using (TransactionScope transactionScope = new TransactionScope())
                 {
                     repository.Edit(db, entitys);
                     if (count == repository.Save(db))
                     {
                         transactionScope.Complete();
                         return(true);
                     }
                     else
                     {
                         Transaction.Current.Rollback();
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }