public EntityObject_MCE_B_ASSETS_METER_CHECK Load(IDbTransaction transaction, string id, out EntityObject_MDM_D_DEPT prd_id, out EntityObject_COM_TYPE unit_id, out EntityObject_MCE_B_ASSETS_METER_TYPE meter_type, out EntityObject_COM_USER head_user_id, out EntityObject_COM_USER audit_user_id, out EntityObject_COM_DEPART using_dept_id, out EntityObject_MCE_B_ASSETS assets_id)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_METER_CHECK obj = new EntityObject_MCE_B_ASSETS_METER_CHECK();

                //平台自动生成代码
                prd_id        = new EntityObject_MDM_D_DEPT();
                unit_id       = new EntityObject_COM_TYPE();
                meter_type    = new EntityObject_MCE_B_ASSETS_METER_TYPE();
                head_user_id  = new EntityObject_COM_USER();
                audit_user_id = new EntityObject_COM_USER();
                using_dept_id = new EntityObject_COM_DEPART();
                assets_id     = new EntityObject_MCE_B_ASSETS();


                obj.ID = id;
                obj    = HelperObject_MCE_B_ASSETS_METER_CHECK.Get(obj, 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.METER_TYPE))
                {
                    meter_type.ID = obj.METER_TYPE;
                    meter_type    = HelperObject_MCE_B_ASSETS_METER_TYPE.Get(meter_type, transaction);
                }
                if (!string.IsNullOrEmpty(obj.HEAD_USER_ID))
                {
                    head_user_id.ID = obj.HEAD_USER_ID;
                    head_user_id    = HelperObject_COM_USER.Get(head_user_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.AUDIT_USER_ID))
                {
                    audit_user_id.ID = obj.AUDIT_USER_ID;
                    audit_user_id    = HelperObject_COM_USER.Get(audit_user_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.USING_DEPT_ID))
                {
                    using_dept_id.ID = obj.USING_DEPT_ID;
                    using_dept_id    = HelperObject_COM_DEPART.Get(using_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);
                }
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
        public BizLogicMsg CommitUpdate(EntityObject_MCE_B_ASSETS_METER_TYPE 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_METER_TYPE.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_METER_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE>(ServiceUri))
                {
                    return(smgr.Service.CommitUpdate(updateBaseEntity, saveDetailEntities, updateDetailEntities, deleteDetailEntities));
                }
            }
        }
 public int DeleteByTrans2(CauseObject_MCE_B_ASSETS_METER_TYPE cause, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         return(HelperObject_MCE_B_ASSETS_METER_TYPE.Delete(cause, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Exemple #4
0
        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)
                                {
                                    EntityObject_MCE_B_ASSETS_METER_TYPE obj = new EntityObject_MCE_B_ASSETS_METER_TYPE();
                                    obj.ID = strID;

                                    obj = HelperObject_MCE_B_ASSETS_METER_TYPE.Get(obj);

                                    if (obj != null)
                                    {
                                        HelperObject_MCE_B_ASSETS_METER_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_B_ASSETS_METER_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE>(ServiceUri))
                {
                    return(smgr.Service.Delete_Ext(listID));
                }
            }
        }
 public int UpdateByTrans(EntityObject_MCE_B_ASSETS_METER_TYPE obj, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         SystemLogic.Proxy.AuditEdit(obj);
         return(HelperObject_MCE_B_ASSETS_METER_TYPE.Update(obj, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
 public int SaveByTrans(EntityObject_MCE_B_ASSETS_METER_TYPE obj, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         SystemLogic.Proxy.AuditAdd(obj);
         int amount = HelperObject_MCE_B_ASSETS_METER_TYPE.Save(obj, transaction);
         //平台自动生成代码
         return(amount);
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
 public DisplayObject_MCE_B_ASSETS_METER_TYPE[] List()
 {
     if (LocalMode)
     {
         //平台自动生成代码
         return(HelperObject_MCE_B_ASSETS_METER_TYPE.List());
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE>(ServiceUri))
         {
             return(smgr.Service.List());
         }
     }
 }
 public EntityObject_MCE_B_ASSETS_METER_TYPE Get(EntityObject_MCE_B_ASSETS_METER_TYPE obj)
 {
     if (LocalMode)
     {
         //平台自动生成代码
         return(HelperObject_MCE_B_ASSETS_METER_TYPE.Get(obj));
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE>(ServiceUri))
         {
             return(smgr.Service.Get(obj));
         }
     }
 }
 public BizLogicMsg UndoAudit(EntityObject_MCE_B_ASSETS_METER_TYPE 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_METER_TYPE.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_METER_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE>(ServiceUri))
         {
             return(smgr.Service.UndoAudit(obj));
         }
     }
 }
        public BizLogicMsg BatchUpdate(EntityObject_MCE_B_ASSETS_METER_TYPE[] objs)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (EntityObject_MCE_B_ASSETS_METER_TYPE obj in objs)
                            {
                                SystemLogic.Proxy.AuditEdit(obj);
                            }
                            int amount = 0;

                            //平台自动生成代码
                            foreach (EntityObject_MCE_B_ASSETS_METER_TYPE obj in objs)
                            {
                                amount += HelperObject_MCE_B_ASSETS_METER_TYPE.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_METER_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE>(ServiceUri))
                {
                    return(smgr.Service.BatchUpdate(objs));
                }
            }
        }
        public DisplayObject_MCE_B_ASSETS_METER_TYPE[] Query(CauseObject_MCE_B_ASSETS_METER_TYPE cause, PagingParamter paging, OrderByParameter order)
        {
            if (LocalMode)
            {
                SystemLogic.Proxy.AuditQuery(cause);

                //平台自动生成代码
                return(HelperObject_MCE_B_ASSETS_METER_TYPE.Query(cause, paging, order));
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE>(ServiceUri))
                {
                    return(smgr.Service.Query(cause, paging, order));
                }
            }
        }
        public EntityObject_MCE_B_ASSETS_METER_TYPE Load(IDbTransaction transaction, string id)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_METER_TYPE obj = new EntityObject_MCE_B_ASSETS_METER_TYPE();

                //平台自动生成代码


                obj.ID = id;
                obj    = HelperObject_MCE_B_ASSETS_METER_TYPE.Get(obj, transaction);
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
 public BizLogicMsg CommitDelete(EntityObject_MCE_B_ASSETS_METER_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_B_ASSETS_METER_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_B_ASSETS_METER_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE>(ServiceUri))
         {
             return(smgr.Service.CommitDelete(deleteBaseEntity));
         }
     }
 }
 public BizLogicMsg Delete(CauseObject_MCE_B_ASSETS_METER_TYPE 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_METER_TYPE.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_METER_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE>(ServiceUri))
         {
             return(smgr.Service.Delete(cause));
         }
     }
 }
Exemple #15
0
        public BizLogicMsg Save_Ext(EntityObject_MCE_B_ASSETS_METER_TYPE item)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_METER_TYPE obj = new EntityObject_MCE_B_ASSETS_METER_TYPE();

                            if (!string.IsNullOrEmpty(item.ID))
                            {
                                obj.ID = item.ID;

                                obj = HelperObject_MCE_B_ASSETS_METER_TYPE.Get(obj);

                                if (obj == null)
                                {
                                    throw new Exception("获取数据出错.");
                                }
                            }

                            obj.CODE  = item.CODE;
                            obj.NAME  = item.NAME;
                            obj.STATE = item.STATE;

                            if (string.IsNullOrEmpty(item.ID))
                            {
                                obj.CREATE_TIME    = DateTime.Now;
                                obj.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                int amount = HelperObject_MCE_B_ASSETS_METER_TYPE.Save(obj, transaction);
                            }
                            else
                            {
                                obj.MODIFY_TIME    = DateTime.Now;
                                obj.MODIFY_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                int amount = HelperObject_MCE_B_ASSETS_METER_TYPE.Update(obj, 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_METER_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER_TYPE>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext(item));
                }
            }
        }