public string SaveCustomer(SaveCustomer request) { if (request == null) { ArgumentNullException ex = new ArgumentNullException("GetCustomer request"); LogError(ex); return("获得保存数据失败!"); } CustomerAccessor accessor = new CustomerAccessor(); Customer customer = new Customer(); customer.Code = request.Code; customer.Name = request.Name; customer.Description = request.Description; try { if (accessor.SaveCustomer(customer) == -1) { return("项目名称在数据中已存在!"); } else { return("保存成功!"); } } catch (Exception ex) { LogError(ex); return("保存失败!" + ex.Message); } }