/// <summary> /// 插入一条记录 /// </summary> /// <param name="entity"></param> /// <returns></returns> public void Insert(ProvidentFundEntity entity) { if (string.IsNullOrEmpty(entity.iGuid)) { entity.iGuid = Guid.NewGuid().ToString(); } entity.iCreatedOn = DateTime.Now; entity.iUpdatedOn = DateTime.Now; entity.iIsDeleted = 0; entity.iStatus = 1; IDbSession session = SessionFactory.CreateSession(); try { session.BeginTrans(); Repository.Insert <ProvidentFundEntity>(session.Connection, entity, session.Transaction); session.Commit(); } catch (System.Exception) { session.Rollback(); throw; } finally { session.Dispose(); } }
public void Update(ProvidentFundEntity entity) { entity.iUpdatedOn = DateTime.Now; IDbSession session = SessionFactory.CreateSession(); try { session.BeginTrans(); Repository.Update <ProvidentFundEntity>(session.Connection, entity, session.Transaction); session.Commit(); } catch (System.Exception) { session.Rollback(); throw; } finally { session.Dispose(); } }