public BizLogicMsg CommitUpdate(EntityObject_MCE_B_ASSETS_ROLL 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_ROLL.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_ROLL> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL>(ServiceUri)) { return(smgr.Service.CommitUpdate(updateBaseEntity, saveDetailEntities, updateDetailEntities, deleteDetailEntities)); } } }
public int UpdateByTrans(EntityObject_MCE_B_ASSETS_ROLL obj, IDbTransaction transaction) { if (LocalMode) { SystemLogic.Proxy.AuditEdit(obj); return(HelperObject_MCE_B_ASSETS_ROLL.Update(obj, transaction)); //平台自动生成代码 } else { throw new InvalidConstraintException(); } }
public BizLogicMsg UndoAudit(EntityObject_MCE_B_ASSETS_ROLL 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_ROLL.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_ROLL> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL>(ServiceUri)) { return(smgr.Service.UndoAudit(obj)); } } }
public BizLogicMsg BatchUpdate(EntityObject_MCE_B_ASSETS_ROLL[] objs) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (EntityObject_MCE_B_ASSETS_ROLL obj in objs) { SystemLogic.Proxy.AuditEdit(obj); } int amount = 0; //平台自动生成代码 foreach (EntityObject_MCE_B_ASSETS_ROLL obj in objs) { amount += HelperObject_MCE_B_ASSETS_ROLL.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_ROLL> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL>(ServiceUri)) { return(smgr.Service.BatchUpdate(objs)); } } }
public BizLogicMsg Save_Ext(JsonMceAssetsRoll item) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_B_ASSETS_ROLL obj = new EntityObject_MCE_B_ASSETS_ROLL(); if (!string.IsNullOrEmpty(item.id)) { obj.ID = item.id; obj = HelperObject_MCE_B_ASSETS_ROLL.Get(obj); if (obj == null) { throw new Exception("获取数据出错."); } } // obj.ASSETS_ID = item.assets_id; // obj.CODE = item.code; obj.NAME = item.name; obj.SAVELIMIT = item.savelimit; obj.CREATE_USER_ID = item.create_user_id; if (!string.IsNullOrEmpty(item.create_time)) { obj.CREATE_TIME = DateTime.Parse(item.create_time); } obj.PLAN_TYPE = item.plan_type; obj.ROLL_TYPE = item.roll_type; obj.ROLL_PROPERTY = item.roll_property; obj.COMMENTS = item.comments; if (string.IsNullOrEmpty(item.id)) { obj.CODE = GetRollCode(); obj.AUDIT_STATE = 1; obj.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; HelperObject_MCE_B_ASSETS_ROLL.Save(obj, transaction); EntityObject_MCE_B_ASSETS_ROLLEQUIP objEquip = new EntityObject_MCE_B_ASSETS_ROLLEQUIP(); objEquip.ASSETS_ID = item.assets_id; objEquip.ROLL_ID = obj.ID; HelperObject_MCE_B_ASSETS_ROLLEQUIP.Save(objEquip, transaction); } else { obj.ID = item.id; HelperObject_MCE_B_ASSETS_ROLL.Update(obj, transaction); CauseObject_MCE_B_ASSETS_ROLLEQUIP pMCE_B_ASSETS_ROLLEQUIP = new CauseObject_MCE_B_ASSETS_ROLLEQUIP(); pMCE_B_ASSETS_ROLLEQUIP.ROLL_ID = obj.ID; pMCE_B_ASSETS_ROLLEQUIP.ASSETS_ID = item.assets_id; DisplayObject_MCE_B_ASSETS_ROLLEQUIP[] listMCE_B_ASSETS_ROLLEQUIP = BizLogicObject_MCE_B_ASSETS_ROLLEQUIP.Proxy.Query(pMCE_B_ASSETS_ROLLEQUIP); if (listMCE_B_ASSETS_ROLLEQUIP == null || listMCE_B_ASSETS_ROLLEQUIP.Length == 0) { EntityObject_MCE_B_ASSETS_ROLLEQUIP objEquip = new EntityObject_MCE_B_ASSETS_ROLLEQUIP(); objEquip.ASSETS_ID = item.assets_id; objEquip.ROLL_ID = obj.ID; HelperObject_MCE_B_ASSETS_ROLLEQUIP.Save(objEquip, transaction); } } msg.Message = obj.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_ROLL> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL>(ServiceUri)) { return(smgr.Service.Save_Ext(item)); } } }
public BizLogicMsg Audit_Ext(JsonMceAssetsRoll item) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_B_ASSETS_ROLL obj = new EntityObject_MCE_B_ASSETS_ROLL(); obj.ID = item.id; obj = HelperObject_MCE_B_ASSETS_ROLL.Get(obj); if (obj != null) { if (obj.AUDIT_STATE == 3 || obj.AUDIT_STATE == 4) { throw new Exception("已经审核的案卷信息不能再审核."); } obj.AUDIT_STATE = 3; obj.AUDIT_TIME = DateTime.Now; obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; HelperObject_MCE_B_ASSETS_ROLL.Update(obj, transaction); EntityObject_MCE_B_ASSETS objMCE_B_ASSETS = new EntityObject_MCE_B_ASSETS(); objMCE_B_ASSETS.ID = item.assets_id; objMCE_B_ASSETS = HelperObject_MCE_B_ASSETS.Get(objMCE_B_ASSETS); if (obj != null) { objMCE_B_ASSETS.FILE_CODE = obj.CODE; HelperObject_MCE_B_ASSETS.Update(objMCE_B_ASSETS, 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_ROLL> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL>(ServiceUri)) { return(smgr.Service.Audit_Ext(item)); } } }