public int SaveByTrans(EntityObject_MCE_B_ASSETS_PURCHASE obj, IDbTransaction transaction) { if (LocalMode) { SystemLogic.Proxy.AuditAdd(obj); int amount = HelperObject_MCE_B_ASSETS_PURCHASE.Save(obj, transaction); //平台自动生成代码 return(amount); } else { throw new InvalidConstraintException(); } }
public BizLogicMsg CommitUpdate(EntityObject_MCE_B_ASSETS_PURCHASE[] saveEntities, EntityObject_MCE_B_ASSETS_PURCHASE[] updateEntities, EntityObject_MCE_B_ASSETS_PURCHASE[] deleteEntities) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { //平台自动生成代码 foreach (EntityObject_MCE_B_ASSETS_PURCHASE obj in saveEntities) { SystemLogic.Proxy.AuditAdd(obj); HelperObject_MCE_B_ASSETS_PURCHASE.Save(obj, transaction); } foreach (EntityObject_MCE_B_ASSETS_PURCHASE obj in updateEntities) { SystemLogic.Proxy.AuditEdit(obj); HelperObject_MCE_B_ASSETS_PURCHASE.Update(obj, transaction); } foreach (EntityObject_MCE_B_ASSETS_PURCHASE obj in deleteEntities) { HelperObject_MCE_B_ASSETS_PURCHASE.Delete(obj, transaction); } transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE>(ServiceUri)) { return(smgr.Service.CommitUpdate(saveEntities, updateEntities, deleteEntities)); } } }
public BizLogicMsg CommitSave(EntityObject_MCE_B_ASSETS_PURCHASE saveBaseEntity, EntityObject_[] saveDetailEntities) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { SystemLogic.Proxy.AuditAdd(saveBaseEntity); HelperObject_MCE_B_ASSETS_PURCHASE.Save(saveBaseEntity, transaction); //平台自动生成代码 foreach (EntityObject_ obj in saveDetailEntities) { obj. = saveBaseEntity.ID; SystemLogic.Proxy.AuditAdd(obj); HelperObject_.Save(obj, transaction); } PostSave(saveBaseEntity, transaction); transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE>(ServiceUri)) { return(smgr.Service.CommitSave(saveBaseEntity, saveDetailEntities)); } } }
public BizLogicMsg BatchSave(EntityObject_MCE_B_ASSETS_PURCHASE[] objs) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (EntityObject_MCE_B_ASSETS_PURCHASE obj in objs) { SystemLogic.Proxy.AuditAdd(obj); } int amount = 0; //平台自动生成代码 foreach (EntityObject_MCE_B_ASSETS_PURCHASE obj in objs) { amount += HelperObject_MCE_B_ASSETS_PURCHASE.Save(obj, transaction); } transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE>(ServiceUri)) { return(smgr.Service.BatchSave(objs)); } } }