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_ASSETS_PURCHASE obj = new EntityObject_MCE_B_ASSETS_PURCHASE();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_PURCHASE.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_ASSETS_PURCHASE.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_PURCHASE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext(listID));
                }
            }
        }
        public BizLogicMsg CommitUpdate(EntityObject_MCE_B_ASSETS_PURCHASE 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_PURCHASE.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_PURCHASE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE>(ServiceUri))
                {
                    return(smgr.Service.CommitUpdate(updateBaseEntity, saveDetailEntities, updateDetailEntities, deleteDetailEntities));
                }
            }
        }
        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
                        {
                            foreach (string strID in listID)
                            {
                                EntityObject_MCE_B_ASSETS_PURCHASE obj = new EntityObject_MCE_B_ASSETS_PURCHASE();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_PURCHASE.Get(obj);

                                if (obj != null)
                                {
                                    if (obj.STATE >= 2)
                                    {
                                        throw new Exception("已经提交的数据不能删除.");
                                    }

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

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

                //平台自动生成代码
                return(HelperObject_MCE_B_ASSETS_PURCHASE.Query(cause, paging, order));
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE>(ServiceUri))
                {
                    return(smgr.Service.Query(cause, paging, order));
                }
            }
        }
Exemple #12
0
        public EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D Load(IDbTransaction transaction, string id, out EntityObject_MCE_D_MCE_TYPE type_id, out EntityObject_COM_TYPE currency_id, out EntityObject_COM_TYPE unit_id, out EntityObject_MCE_B_ASSETS_PURCHASE base_id)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D obj = new EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D();

                //平台自动生成代码
                type_id     = new EntityObject_MCE_D_MCE_TYPE();
                currency_id = new EntityObject_COM_TYPE();
                unit_id     = new EntityObject_COM_TYPE();
                base_id     = new EntityObject_MCE_B_ASSETS_PURCHASE();


                obj.ID = id;
                obj    = HelperObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Get(obj, transaction);
                if (!string.IsNullOrEmpty(obj.TYPE_ID))
                {
                    type_id.ID = obj.TYPE_ID;
                    type_id    = HelperObject_MCE_D_MCE_TYPE.Get(type_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.CURRENCY_ID))
                {
                    currency_id.ID = obj.CURRENCY_ID;
                    currency_id    = HelperObject_COM_TYPE.Get(currency_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_ASSETS_PURCHASE.Get(base_id, transaction);
                }
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
        public EntityObject_MCE_B_ASSETS_PURCHASE Load(IDbTransaction transaction, string id, out EntityObject_MCE_D_MCE_TYPE type_id, out EntityObject_COM_USER apply_user_id, out EntityObject_COM_DEPART apply_dept_id, out EntityObject_COM_TYPE purchase_type_id)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_PURCHASE obj = new EntityObject_MCE_B_ASSETS_PURCHASE();

                //平台自动生成代码
                type_id          = new EntityObject_MCE_D_MCE_TYPE();
                apply_user_id    = new EntityObject_COM_USER();
                apply_dept_id    = new EntityObject_COM_DEPART();
                purchase_type_id = new EntityObject_COM_TYPE();


                obj.ID = id;
                obj    = HelperObject_MCE_B_ASSETS_PURCHASE.Get(obj, transaction);
                if (!string.IsNullOrEmpty(obj.TYPE_ID))
                {
                    type_id.ID = obj.TYPE_ID;
                    type_id    = HelperObject_MCE_D_MCE_TYPE.Get(type_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.APPLY_USER_ID))
                {
                    apply_user_id.ID = obj.APPLY_USER_ID;
                    apply_user_id    = HelperObject_COM_USER.Get(apply_user_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.APPLY_DEPT_ID))
                {
                    apply_dept_id.ID = obj.APPLY_DEPT_ID;
                    apply_dept_id    = HelperObject_COM_DEPART.Get(apply_dept_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.PURCHASE_TYPE_ID))
                {
                    purchase_type_id.ID = obj.PURCHASE_TYPE_ID;
                    purchase_type_id    = HelperObject_COM_TYPE.Get(purchase_type_id, transaction);
                }
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
 public BizLogicMsg CommitDelete(EntityObject_MCE_B_ASSETS_PURCHASE 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_PURCHASE.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_PURCHASE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE>(ServiceUri))
         {
             return(smgr.Service.CommitDelete(deleteBaseEntity));
         }
     }
 }
 public BizLogicMsg Delete(CauseObject_MCE_B_ASSETS_PURCHASE 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_PURCHASE.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_PURCHASE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE>(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_ASSETS_PURCHASE_PLAN obj = new EntityObject_MCE_B_ASSETS_PURCHASE_PLAN();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_PURCHASE_PLAN.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_ASSETS_PURCHASE_PLAN.Update(obj, transaction);


                                    DisplayObject_MCE_B_ASSETS_PURCHASE_PLAN_D[] list_D = BizLogicObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Proxy.Query(new CauseObject_MCE_B_ASSETS_PURCHASE_PLAN_D()
                                    {
                                        BASE_ID = obj.ID
                                    });
                                    if (list_D != null && list_D.Length > 0)
                                    {
                                        foreach (DisplayObject_MCE_B_ASSETS_PURCHASE_PLAN_D item in list_D)
                                        {
                                            if (item.REF_TAB_NAME == "MCE_B_ASSETS_PURCHASE" && !string.IsNullOrEmpty(item.REF_TAB_ID))
                                            {
                                                EntityObject_MCE_B_ASSETS_PURCHASE obj_Pur = new EntityObject_MCE_B_ASSETS_PURCHASE();
                                                obj_Pur.ID = item.REF_TAB_ID;

                                                obj_Pur = HelperObject_MCE_B_ASSETS_PURCHASE.Get(obj_Pur);
                                                if (obj_Pur != null)
                                                {
                                                    obj_Pur.REF_USED_AMOUNT = obj_Pur.REF_USED_AMOUNT + item.AMOUNT;
                                                    HelperObject_MCE_B_ASSETS_PURCHASE.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_ASSETS_PURCHASE_PLAN> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE_PLAN>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext(listID));
                }
            }
        }