public BizLogicMsg Submit_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (string strID in listID) { EntityObject_MCE_B_AOG obj = new EntityObject_MCE_B_AOG(); obj.ID = strID; obj = HelperObject_MCE_B_AOG.Get(obj); if (obj != null) { if (obj.STATE == 2 || obj.STATE == 3 || obj.STATE == 4) { throw new Exception("已经提交的数据不能再提交."); } obj.STATE = 2; HelperObject_MCE_B_AOG.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_AOG> smgr = new ServiceManager <ServiceContract_MCE_B_AOG>(ServiceUri)) { return(smgr.Service.Submit_Ext(listID)); } } }
public BizLogicMsg CommitUpdate(EntityObject_MCE_B_AOG 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_AOG.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_AOG> smgr = new ServiceManager <ServiceContract_MCE_B_AOG>(ServiceUri)) { return(smgr.Service.CommitUpdate(updateBaseEntity, saveDetailEntities, updateDetailEntities, deleteDetailEntities)); } } }
public EntityObject_MCE_B_AOG Load(IDbTransaction transaction, string id, out EntityObject_COM_DEPART use_dept_id, out EntityObject_COM_USER use_user_id, out EntityObject_MDM_D_DEPT provider_id, out EntityObject_COM_USER install_user_id, out EntityObject_MDM_D_DEPT dealer_id, out EntityObject_COM_USER purcharse_person_id) { if (LocalMode) { EntityObject_MCE_B_AOG obj = new EntityObject_MCE_B_AOG(); //平台自动生成代码 use_dept_id = new EntityObject_COM_DEPART(); use_user_id = new EntityObject_COM_USER(); provider_id = new EntityObject_MDM_D_DEPT(); install_user_id = new EntityObject_COM_USER(); dealer_id = new EntityObject_MDM_D_DEPT(); purcharse_person_id = new EntityObject_COM_USER(); obj.ID = id; obj = HelperObject_MCE_B_AOG.Get(obj, transaction); if (!string.IsNullOrEmpty(obj.USE_DEPT_ID)) { use_dept_id.ID = obj.USE_DEPT_ID; use_dept_id = HelperObject_COM_DEPART.Get(use_dept_id, transaction); } if (!string.IsNullOrEmpty(obj.USE_USER_ID)) { use_user_id.ID = obj.USE_USER_ID; use_user_id = HelperObject_COM_USER.Get(use_user_id, transaction); } if (!string.IsNullOrEmpty(obj.PROVIDER_ID)) { provider_id.ID = obj.PROVIDER_ID; provider_id = HelperObject_MDM_D_DEPT.Get(provider_id, transaction); } if (!string.IsNullOrEmpty(obj.INSTALL_USER_ID)) { install_user_id.ID = obj.INSTALL_USER_ID; install_user_id = HelperObject_COM_USER.Get(install_user_id, transaction); } if (!string.IsNullOrEmpty(obj.DEALER_ID)) { dealer_id.ID = obj.DEALER_ID; dealer_id = HelperObject_MDM_D_DEPT.Get(dealer_id, transaction); } if (!string.IsNullOrEmpty(obj.PURCHARSE_PERSON_ID)) { purcharse_person_id.ID = obj.PURCHARSE_PERSON_ID; purcharse_person_id = HelperObject_COM_USER.Get(purcharse_person_id, transaction); } return(obj); } else { throw new InvalidConstraintException(); } }
public int DeleteByTrans2(CauseObject_MCE_B_AOG cause, IDbTransaction transaction) { if (LocalMode) { return(HelperObject_MCE_B_AOG.Delete(cause, transaction)); //平台自动生成代码 } else { throw new InvalidConstraintException(); } }
public int UpdateByTrans(EntityObject_MCE_B_AOG obj, IDbTransaction transaction) { if (LocalMode) { SystemLogic.Proxy.AuditEdit(obj); return(HelperObject_MCE_B_AOG.Update(obj, transaction)); //平台自动生成代码 } else { throw new InvalidConstraintException(); } }
public int SaveByTrans(EntityObject_MCE_B_AOG obj, IDbTransaction transaction) { if (LocalMode) { SystemLogic.Proxy.AuditAdd(obj); int amount = HelperObject_MCE_B_AOG.Save(obj, transaction); //平台自动生成代码 return(amount); } else { throw new InvalidConstraintException(); } }
public DisplayObject_MCE_B_AOG[] List() { if (LocalMode) { //平台自动生成代码 return(HelperObject_MCE_B_AOG.List()); } else { using (ServiceManager <ServiceContract_MCE_B_AOG> smgr = new ServiceManager <ServiceContract_MCE_B_AOG>(ServiceUri)) { return(smgr.Service.List()); } } }
public EntityObject_MCE_B_AOG Get(EntityObject_MCE_B_AOG obj) { if (LocalMode) { //平台自动生成代码 return(HelperObject_MCE_B_AOG.Get(obj)); } else { using (ServiceManager <ServiceContract_MCE_B_AOG> smgr = new ServiceManager <ServiceContract_MCE_B_AOG>(ServiceUri)) { return(smgr.Service.Get(obj)); } } }
public EntityObject_MCE_B_AOG_D Load(IDbTransaction transaction, string id, out EntityObject_COM_TYPE country, out EntityObject_MDM_D_DEPT prd_id, out EntityObject_COM_TYPE unit_id, out EntityObject_MCE_B_AOG base_id, out EntityObject_MCE_D_MCE_TYPE asset_type_id) { if (LocalMode) { EntityObject_MCE_B_AOG_D obj = new EntityObject_MCE_B_AOG_D(); //平台自动生成代码 country = new EntityObject_COM_TYPE(); prd_id = new EntityObject_MDM_D_DEPT(); unit_id = new EntityObject_COM_TYPE(); base_id = new EntityObject_MCE_B_AOG(); asset_type_id = new EntityObject_MCE_D_MCE_TYPE(); obj.ID = id; obj = HelperObject_MCE_B_AOG_D.Get(obj, transaction); if (!string.IsNullOrEmpty(obj.COUNTRY)) { country.ID = obj.COUNTRY; country = HelperObject_COM_TYPE.Get(country, transaction); } if (!string.IsNullOrEmpty(obj.PRD_ID)) { prd_id.ID = obj.PRD_ID; prd_id = HelperObject_MDM_D_DEPT.Get(prd_id, transaction); } if (!string.IsNullOrEmpty(obj.UNIT_ID)) { unit_id.ID = obj.UNIT_ID; unit_id = HelperObject_COM_TYPE.Get(unit_id, transaction); } if (!string.IsNullOrEmpty(obj.BASE_ID)) { base_id.ID = obj.BASE_ID; base_id = HelperObject_MCE_B_AOG.Get(base_id, transaction); } if (!string.IsNullOrEmpty(obj.ASSET_TYPE_ID)) { asset_type_id.ID = obj.ASSET_TYPE_ID; asset_type_id = HelperObject_MCE_D_MCE_TYPE.Get(asset_type_id, transaction); } return(obj); } else { throw new InvalidConstraintException(); } }
public BizLogicMsg UndoAudit(EntityObject_MCE_B_AOG 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_AOG.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_AOG> smgr = new ServiceManager <ServiceContract_MCE_B_AOG>(ServiceUri)) { return(smgr.Service.UndoAudit(obj)); } } }
public BizLogicMsg BatchUpdate(EntityObject_MCE_B_AOG[] objs) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (EntityObject_MCE_B_AOG obj in objs) { SystemLogic.Proxy.AuditEdit(obj); } int amount = 0; //平台自动生成代码 foreach (EntityObject_MCE_B_AOG obj in objs) { amount += HelperObject_MCE_B_AOG.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_AOG> smgr = new ServiceManager <ServiceContract_MCE_B_AOG>(ServiceUri)) { return(smgr.Service.BatchUpdate(objs)); } } }
public DisplayObject_MCE_B_AOG[] Query(CauseObject_MCE_B_AOG cause, PagingParamter paging, OrderByParameter order) { if (LocalMode) { SystemLogic.Proxy.AuditQuery(cause); //平台自动生成代码 return(HelperObject_MCE_B_AOG.Query(cause, paging, order)); } else { using (ServiceManager <ServiceContract_MCE_B_AOG> smgr = new ServiceManager <ServiceContract_MCE_B_AOG>(ServiceUri)) { return(smgr.Service.Query(cause, paging, order)); } } }
public BizLogicMsg CommitDelete(EntityObject_MCE_B_AOG 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_AOG.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_AOG> smgr = new ServiceManager <ServiceContract_MCE_B_AOG>(ServiceUri)) { return(smgr.Service.CommitDelete(deleteBaseEntity)); } } }
public BizLogicMsg Delete(CauseObject_MCE_B_AOG cause) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { int amount = HelperObject_MCE_B_AOG.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_AOG> smgr = new ServiceManager <ServiceContract_MCE_B_AOG>(ServiceUri)) { return(smgr.Service.Delete(cause)); } } }
public BizLogicMsg Audit_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (string strID in listID) { EntityObject_MCE_B_AOG obj = new EntityObject_MCE_B_AOG(); obj.ID = strID; obj = HelperObject_MCE_B_AOG.Get(obj); if (obj != null) { if (obj.STATE == 3 || obj.STATE == 4) { throw new Exception("已经审核的数据不能再审核."); } obj.STATE = 3; obj.AUDIT_TIME = DateTime.Now; obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; HelperObject_MCE_B_AOG.Update(obj, transaction); DisplayObject_MCE_B_AOG_D[] list_D = BizLogicObject_MCE_B_AOG_D.Proxy.Query(new CauseObject_MCE_B_AOG_D() { BASE_ID = obj.ID }); if (list_D != null && list_D.Length > 0) { foreach (DisplayObject_MCE_B_AOG_D item in list_D) { if (item.REF_TAB_NAME == "MCE_B_ASSETS_PURCHASE_PLAN_D" && !string.IsNullOrEmpty(item.REF_TAB_ID)) { EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D obj_Pur = new EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D(); obj_Pur.ID = item.REF_TAB_ID; obj_Pur = HelperObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Get(obj_Pur); if (obj_Pur != null) { obj_Pur.REF_USED_AMOUNT = obj_Pur.REF_USED_AMOUNT + item.AMOUNT; HelperObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Update(obj_Pur, 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_AOG> smgr = new ServiceManager <ServiceContract_MCE_B_AOG>(ServiceUri)) { return(smgr.Service.Audit_Ext(listID)); } } }
public BizLogicMsg Save_Ext(JsonMCE_AOG jsonMCE_AOG) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_B_AOG entity = new EntityObject_MCE_B_AOG(); if (!string.IsNullOrEmpty(jsonMCE_AOG.ID)) { entity.ID = jsonMCE_AOG.ID; entity = HelperObject_MCE_B_AOG.Get(entity); if (entity == null) { throw new Exception("获取数据出错."); } } entity.CODE = jsonMCE_AOG.CODE; entity.USE_DEPT_ID = jsonMCE_AOG.USE_DEPT_ID; entity.PROVIDER_ID = jsonMCE_AOG.PROVIDER_ID; if (!string.IsNullOrEmpty(jsonMCE_AOG.CREATE_DATE)) { entity.CREATE_DATE = DateTime.Parse(jsonMCE_AOG.CREATE_DATE); } entity.USE_USER_ID = jsonMCE_AOG.USE_USER_ID; entity.PURCHARSE_PERSON = jsonMCE_AOG.PURCHARSE_PERSON; entity.PURCHARSE_HT_NUM = jsonMCE_AOG.PURCHARSE_HT_NUM; entity.COMMENTS = jsonMCE_AOG.COMMENTS; entity.INVOICE_CODE = jsonMCE_AOG.INVOICE_CODE; entity.STATE = 1; if (string.IsNullOrEmpty(jsonMCE_AOG.ID)) { entity.CREATE_TIME = DateTime.Now; entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; int amount = HelperObject_MCE_B_AOG.Save(entity, transaction); } else { int amount = HelperObject_MCE_B_AOG.Update(entity, transaction); } if (jsonMCE_AOG.DELETEIDS != null && jsonMCE_AOG.DELETEIDS.Count > 0) { foreach (string strID in jsonMCE_AOG.DELETEIDS) { EntityObject_MCE_B_AOG_D entity_D = new EntityObject_MCE_B_AOG_D(); if (!string.IsNullOrEmpty(strID)) { entity_D.ID = strID; entity_D = HelperObject_MCE_B_AOG_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } else { HelperObject_MCE_B_AOG_D.Delete(entity_D, transaction); } } } } if (jsonMCE_AOG.children != null && jsonMCE_AOG.children.Count > 0) { decimal decTotMoney = 0; foreach (JsonMCE_AOG_D item in jsonMCE_AOG.children) { EntityObject_MCE_B_AOG_D entity_D = new EntityObject_MCE_B_AOG_D(); if (!string.IsNullOrEmpty(item.ID)) { entity_D.ID = item.ID; entity_D = HelperObject_MCE_B_AOG_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } } entity_D.BASE_ID = entity.ID; entity_D.ASSET_ID = item.ASSET_ID; entity_D.ASSET_TYPE_ID = item.ASSET_TYPE_ID; entity_D.ASSETS_NAME = item.ASSETS_NAME; entity_D.SPEC = item.SPEC; if (string.IsNullOrEmpty(item.ID)) { if (!string.IsNullOrEmpty(item.PRD_ID)) { string strPrdID = ""; CauseObject_MDM_D_DEPT p = new CauseObject_MDM_D_DEPT(); p.REF_ID = item.PRD_ID; DisplayObject_MDM_D_DEPT[] listPrd = HelperObject_MDM_D_DEPT.Query(p); if (listPrd != null && listPrd.Length > 0) { strPrdID = listPrd[0].ID; } entity_D.PRD_ID = strPrdID; } entity_D.REF_PRD_ID = item.PRD_ID; } entity_D.PRICE = item.PRICE; entity_D.AMOUNT = item.AMOUNT; entity_D.UNIT_ID = item.UNIT_ID; entity_D.COUNTRY = item.COUNTRY; entity_D.REG_CODE = item.REG_CODE; entity_D.MONEY = item.AMOUNT * item.PRICE; decTotMoney = decTotMoney + entity_D.MONEY; entity_D.REF_TAB_ID = item.REF_TAB_ID; entity_D.REF_TAB_NAME = item.REF_TAB_NAME; if (string.IsNullOrEmpty(item.ID)) { HelperObject_MCE_B_AOG_D.Save(entity_D, transaction); } else { HelperObject_MCE_B_AOG_D.Update(entity_D, transaction); } } entity.TOTAL_MONEY = decTotMoney; HelperObject_MCE_B_AOG.Update(entity, 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_AOG> smgr = new ServiceManager <ServiceContract_MCE_B_AOG>(ServiceUri)) { return(smgr.Service.Save_Ext(jsonMCE_AOG)); } } }