public void SubmitForm(SpecialEntity specialEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { if (service.IQueryable().Count(t => t.F_EnCode.Equals(specialEntity.F_EnCode) && !t.F_Id.Equals(keyValue)) > 0) { throw new Exception("修改失败!操作的对象编号已存在。"); } specialEntity.Modify(keyValue); service.Update(specialEntity); } else { if (service.IQueryable().Count(t => t.F_EnCode.Equals(specialEntity.F_EnCode)) > 0) { throw new Exception("添加失败!操作的对象编号已存在。"); } if (specialEntity.F_DeleteMark == null) { specialEntity.F_DeleteMark = false; } specialEntity.Create(); service.Insert(specialEntity); } }