/// <summary> /// 保存实体数据(新增、修改) /// <param name="keyValue">主键</param> /// <summary> /// <returns></returns> public void SaveEntity(int keyValue, dm_task_reportEntity entity) { try { if (keyValue > 0) { entity.Modify(keyValue); this.BaseRepository("dm_data").Update(entity); } else { entity.Create(); this.BaseRepository("dm_data").Insert(entity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
public void SubmitTaskReport(dm_task_reportEntity entity) { try { dm_task_reportEntity old_task_reportEntity = BaseRepository("dm_data").FindEntity <dm_task_reportEntity>(t => t.user_id == entity.user_id && t.task_id == entity.task_id); if (!old_task_reportEntity.IsEmpty()) { throw new Exception("该任务已经举报过了,请勿重复提交!"); } entity.Create(); this.BaseRepository("dm_data").Insert(entity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }