public int DeleteByTrans2(CauseObject_MCE_D_MCE_TYPE cause, IDbTransaction transaction) { if (LocalMode) { return(HelperObject_MCE_D_MCE_TYPE.Delete(cause, transaction)); //平台自动生成代码 } else { throw new InvalidConstraintException(); } }
public BizLogicMsg CommitUpdate(EntityObject_MCE_D_MCE_TYPE[] saveEntities, EntityObject_MCE_D_MCE_TYPE[] updateEntities, EntityObject_MCE_D_MCE_TYPE[] deleteEntities) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { //平台自动生成代码 foreach (EntityObject_MCE_D_MCE_TYPE obj in saveEntities) { SystemLogic.Proxy.AuditAdd(obj); HelperObject_MCE_D_MCE_TYPE.Save(obj, transaction); } foreach (EntityObject_MCE_D_MCE_TYPE obj in updateEntities) { SystemLogic.Proxy.AuditEdit(obj); HelperObject_MCE_D_MCE_TYPE.Update(obj, transaction); } foreach (EntityObject_MCE_D_MCE_TYPE obj in deleteEntities) { HelperObject_MCE_D_MCE_TYPE.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_D_MCE_TYPE> smgr = new ServiceManager <ServiceContract_MCE_D_MCE_TYPE>(ServiceUri)) { return(smgr.Service.CommitUpdate(saveEntities, updateEntities, deleteEntities)); } } }
public BizLogicMsg BatchDelete(EntityObject_MCE_D_MCE_TYPE[] objs) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { int amount = 0; //平台自动生成代码 foreach (EntityObject_MCE_D_MCE_TYPE obj in objs) { amount += HelperObject_MCE_D_MCE_TYPE.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_D_MCE_TYPE> smgr = new ServiceManager <ServiceContract_MCE_D_MCE_TYPE>(ServiceUri)) { return(smgr.Service.BatchDelete(objs)); } } }
public BizLogicMsg CommitDelete(EntityObject_MCE_D_MCE_TYPE deleteBaseEntity) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { //平台自动生成代码 CauseObject_ p = new CauseObject_(); p. = deleteBaseEntity.ID; HelperObject_.Delete(p, transaction); HelperObject_MCE_D_MCE_TYPE.Delete(deleteBaseEntity, 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_D_MCE_TYPE> smgr = new ServiceManager <ServiceContract_MCE_D_MCE_TYPE>(ServiceUri)) { return(smgr.Service.CommitDelete(deleteBaseEntity)); } } }
public BizLogicMsg Delete_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { if (listID != null && listID.Count > 0) { foreach (string strID in listID) { CauseObject_MCE_D_MCE_TYPE p_Type = new CauseObject_MCE_D_MCE_TYPE(); p_Type.PARENT_ID = strID; DisplayObject_MCE_D_MCE_TYPE[] listMCE_D_MCE_TYPE = BizLogicObject_MCE_D_MCE_TYPE.Proxy.Query(p_Type); if (listMCE_D_MCE_TYPE != null && listMCE_D_MCE_TYPE.Length > 0) { throw new Exception("该资产分类下存在子分类,不能删除."); } CauseObject_MCE_B_ASSETS p = new CauseObject_MCE_B_ASSETS(); p.MACHINE_TYPE_ID = strID; DisplayObject_MCE_B_ASSETS[] list = BizLogicObject_MCE_B_ASSETS.Proxy.Query(p); if (list != null && list.Length > 0) { throw new Exception("在资产卡片中已经使用的资产分类不能删除."); } EntityObject_MCE_D_MCE_TYPE obj = new EntityObject_MCE_D_MCE_TYPE(); obj.ID = strID; if (obj.STATE == 1) { throw new Exception("状态为[正常]的资产分类不能删除."); } obj = HelperObject_MCE_D_MCE_TYPE.Get(obj); if (obj != null) { HelperObject_MCE_D_MCE_TYPE.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_D_MCE_TYPE> smgr = new ServiceManager <ServiceContract_MCE_D_MCE_TYPE>(ServiceUri)) { return(smgr.Service.Delete_Ext(listID)); } } }