public BizLogicMsg CommitUpdate(EntityObject_MCE_B_ASSETS_MT_PLAN_D updateBaseEntity, EntityObject_[] saveDetailEntities, EntityObject_[] updateDetailEntities, EntityObject_[] deleteDetailEntities) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { SystemLogic.Proxy.AuditEdit(updateBaseEntity); HelperObject_MCE_B_ASSETS_MT_PLAN_D.Update(updateBaseEntity, transaction); //平台自动生成代码 foreach (EntityObject_ obj in saveDetailEntities) { obj. = updateBaseEntity.ID; SystemLogic.Proxy.AuditAdd(obj); HelperObject_.Save(obj, transaction); } foreach (EntityObject_ obj in updateDetailEntities) { SystemLogic.Proxy.AuditEdit(obj); HelperObject_.Update(obj, transaction); } foreach (EntityObject_ obj in deleteDetailEntities) { HelperObject_.Delete(obj, transaction); } PostSave(updateBaseEntity, 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_MT_PLAN_D> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D>(ServiceUri)) { return(smgr.Service.CommitUpdate(updateBaseEntity, saveDetailEntities, updateDetailEntities, deleteDetailEntities)); } } }
public int DeleteByTrans2(CauseObject_MCE_B_ASSETS_MT_PLAN_D cause, IDbTransaction transaction) { if (LocalMode) { return(HelperObject_MCE_B_ASSETS_MT_PLAN_D.Delete(cause, transaction)); //平台自动生成代码 } else { throw new InvalidConstraintException(); } }
public int UpdateByTrans(EntityObject_MCE_B_ASSETS_MT_PLAN_D obj, IDbTransaction transaction) { if (LocalMode) { SystemLogic.Proxy.AuditEdit(obj); return(HelperObject_MCE_B_ASSETS_MT_PLAN_D.Update(obj, transaction)); //平台自动生成代码 } else { throw new InvalidConstraintException(); } }
public int SaveByTrans(EntityObject_MCE_B_ASSETS_MT_PLAN_D obj, IDbTransaction transaction) { if (LocalMode) { SystemLogic.Proxy.AuditAdd(obj); int amount = HelperObject_MCE_B_ASSETS_MT_PLAN_D.Save(obj, transaction); //平台自动生成代码 return(amount); } else { throw new InvalidConstraintException(); } }
public DisplayObject_MCE_B_ASSETS_MT_PLAN_D[] List() { if (LocalMode) { //平台自动生成代码 return(HelperObject_MCE_B_ASSETS_MT_PLAN_D.List()); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D>(ServiceUri)) { return(smgr.Service.List()); } } }
public EntityObject_MCE_B_ASSETS_MT_PLAN_D Get(EntityObject_MCE_B_ASSETS_MT_PLAN_D obj) { if (LocalMode) { //平台自动生成代码 return(HelperObject_MCE_B_ASSETS_MT_PLAN_D.Get(obj)); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D>(ServiceUri)) { return(smgr.Service.Get(obj)); } } }
public BizLogicMsg UndoAudit(EntityObject_MCE_B_ASSETS_MT_PLAN_D obj) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { SystemLogic.Proxy.AuditUndoAudit(obj); int amount = HelperObject_MCE_B_ASSETS_MT_PLAN_D.Update(obj, transaction); //平台自动生成代码 PostUndoAudit(obj, transaction); //执行撤回操作 msg = SystemLogic.Proxy.BillUndoAudit(obj, transaction); if (!msg.Succeed) { throw new Exception(msg.Message); } transaction.Commit(); } catch (Exception expt) { SystemLogic.Proxy.AuditState(obj, Ipedf.Common.数据状态.已审核); transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D>(ServiceUri)) { return(smgr.Service.UndoAudit(obj)); } } }
public BizLogicMsg BatchUpdate(EntityObject_MCE_B_ASSETS_MT_PLAN_D[] objs) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (EntityObject_MCE_B_ASSETS_MT_PLAN_D obj in objs) { SystemLogic.Proxy.AuditEdit(obj); } int amount = 0; //平台自动生成代码 foreach (EntityObject_MCE_B_ASSETS_MT_PLAN_D obj in objs) { amount += HelperObject_MCE_B_ASSETS_MT_PLAN_D.Update(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_MT_PLAN_D> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D>(ServiceUri)) { return(smgr.Service.BatchUpdate(objs)); } } }
public DisplayObject_MCE_B_ASSETS_MT_PLAN_D[] Query(CauseObject_MCE_B_ASSETS_MT_PLAN_D cause, PagingParamter paging, OrderByParameter order) { if (LocalMode) { SystemLogic.Proxy.AuditQuery(cause); //平台自动生成代码 return(HelperObject_MCE_B_ASSETS_MT_PLAN_D.Query(cause, paging, order)); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D>(ServiceUri)) { return(smgr.Service.Query(cause, paging, order)); } } }
public EntityObject_MCE_B_ASSETS_MT_PLAN_D Load(IDbTransaction transaction, string id, out EntityObject_MCE_B_ASSETS_MT_PLAN base_id, out EntityObject_COM_DEPART dept_id, out EntityObject_MCE_B_ASSETS assets_id, out EntityObject_MCE_B_ASSETS_MT_ITEM item_id) { if (LocalMode) { EntityObject_MCE_B_ASSETS_MT_PLAN_D obj = new EntityObject_MCE_B_ASSETS_MT_PLAN_D(); //平台自动生成代码 base_id = new EntityObject_MCE_B_ASSETS_MT_PLAN(); dept_id = new EntityObject_COM_DEPART(); assets_id = new EntityObject_MCE_B_ASSETS(); item_id = new EntityObject_MCE_B_ASSETS_MT_ITEM(); obj.ID = id; obj = HelperObject_MCE_B_ASSETS_MT_PLAN_D.Get(obj, transaction); if (!string.IsNullOrEmpty(obj.BASE_ID)) { base_id.ID = obj.BASE_ID; base_id = HelperObject_MCE_B_ASSETS_MT_PLAN.Get(base_id, transaction); } if (!string.IsNullOrEmpty(obj.DEPT_ID)) { dept_id.ID = obj.DEPT_ID; dept_id = HelperObject_COM_DEPART.Get(dept_id, transaction); } if (!string.IsNullOrEmpty(obj.ASSETS_ID)) { assets_id.ID = obj.ASSETS_ID; assets_id = HelperObject_MCE_B_ASSETS.Get(assets_id, transaction); } if (!string.IsNullOrEmpty(obj.ITEM_ID)) { item_id.ID = obj.ITEM_ID; item_id = HelperObject_MCE_B_ASSETS_MT_ITEM.Get(item_id, transaction); } return(obj); } else { throw new InvalidConstraintException(); } }
public BizLogicMsg CommitDelete(EntityObject_MCE_B_ASSETS_MT_PLAN_D 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_B_ASSETS_MT_PLAN_D.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_B_ASSETS_MT_PLAN_D> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D>(ServiceUri)) { return(smgr.Service.CommitDelete(deleteBaseEntity)); } } }
public BizLogicMsg Delete(CauseObject_MCE_B_ASSETS_MT_PLAN_D cause) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { int amount = HelperObject_MCE_B_ASSETS_MT_PLAN_D.Delete(cause, 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_MT_PLAN_D> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN_D>(ServiceUri)) { return(smgr.Service.Delete(cause)); } } }
public BizLogicMsg Save_Ext(JsonMCE_MT_PLAN json) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_B_ASSETS_MT_PLAN entity = new EntityObject_MCE_B_ASSETS_MT_PLAN(); if (!string.IsNullOrEmpty(json.ID)) { entity.ID = json.ID; entity = HelperObject_MCE_B_ASSETS_MT_PLAN.Get(entity); if (entity == null) { throw new Exception("获取数据出错."); } } entity.CODE = json.CODE; entity.NAME = json.NAME; entity.MTN_TYPE_ID = json.MTN_TYPE_ID; entity.MTN_COMPANY_ID = json.MTN_COMPANY_ID; if (!string.IsNullOrEmpty(json.EXECUTE_PERIOD)) { entity.EXECUTE_PERIOD = int.Parse(json.EXECUTE_PERIOD); } entity.MTN_TYPE_ID = json.MTN_TYPE_ID; if (!string.IsNullOrEmpty(json.CREATE_DATE)) { entity.CREATE_DATE = DateTime.Parse(json.CREATE_DATE); } if (!string.IsNullOrEmpty(json.CREATE_DATE)) { entity.EXECUTE_PERIOD_UNIT = int.Parse(json.EXECUTE_PERIOD_UNIT); } entity.APPLY_USER_ID = json.APPLY_USER_ID; entity.COMMENTS = json.COMMENTS; entity.PLAN_STATE = json.PLAN_STATE; entity.STATE = json.STATE; if (string.IsNullOrEmpty(json.ID)) { entity.CREATE_TIME = DateTime.Now; entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; int amount = HelperObject_MCE_B_ASSETS_MT_PLAN.Save(entity, transaction); } else { int amount = HelperObject_MCE_B_ASSETS_MT_PLAN.Update(entity, transaction); } if (json.DELETEIDS != null && json.DELETEIDS.Count > 0) { foreach (string strID in json.DELETEIDS) { EntityObject_MCE_B_ASSETS_MT_PLAN_D entity_D = new EntityObject_MCE_B_ASSETS_MT_PLAN_D(); if (!string.IsNullOrEmpty(strID)) { entity_D.ID = strID; entity_D = HelperObject_MCE_B_ASSETS_MT_PLAN_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } else { HelperObject_MCE_B_ASSETS_MT_PLAN_D.Delete(entity_D, transaction); } } } } if (json.children != null && json.children.Count > 0) { foreach (JsonMCE_MT_PLAN_D item in json.children) { EntityObject_MCE_B_ASSETS_MT_PLAN_D entity_D = new EntityObject_MCE_B_ASSETS_MT_PLAN_D(); if (!string.IsNullOrEmpty(item.ID)) { entity_D.ID = item.ID; entity_D = HelperObject_MCE_B_ASSETS_MT_PLAN_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } } entity_D.BASE_ID = entity.ID; entity_D.ASSETS_ID = item.ASSETS_ID; entity_D.ASSET_CODE = item.ASSET_CODE; entity_D.SPEC = item.SPEC; entity_D.DEPT_ID = item.DEPT_ID; entity_D.ITEM_ID = item.ITEM_ID; entity_D.SEQ_NUMBER = item.SEQ_NUMBER; entity_D.COMMENTS = item.COMMENTS; if (string.IsNullOrEmpty(item.ID)) { HelperObject_MCE_B_ASSETS_MT_PLAN_D.Save(entity_D, transaction); } else { HelperObject_MCE_B_ASSETS_MT_PLAN_D.Update(entity_D, transaction); } } } msg.Message = entity.ID; 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_MT_PLAN> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN>(ServiceUri)) { return(smgr.Service.Save_Ext(json)); } } }