Ejemplo n.º 1
0
 public int SaveByTrans(EntityObject_V_MCE_ASSETS_ROLLEQUIP obj, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         SystemLogic.Proxy.AuditAdd(obj);
         int amount = HelperObject_V_MCE_ASSETS_ROLLEQUIP.Save(obj, transaction);
         //平台自动生成代码
         return(amount);
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Ejemplo n.º 2
0
 public BizLogicMsg CommitUpdate(EntityObject_V_MCE_ASSETS_ROLLEQUIP[] saveEntities, EntityObject_V_MCE_ASSETS_ROLLEQUIP[] updateEntities, EntityObject_V_MCE_ASSETS_ROLLEQUIP[] deleteEntities)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     //平台自动生成代码
                     foreach (EntityObject_V_MCE_ASSETS_ROLLEQUIP obj in saveEntities)
                     {
                         SystemLogic.Proxy.AuditAdd(obj);
                         HelperObject_V_MCE_ASSETS_ROLLEQUIP.Save(obj, transaction);
                     }
                     foreach (EntityObject_V_MCE_ASSETS_ROLLEQUIP obj in updateEntities)
                     {
                         SystemLogic.Proxy.AuditEdit(obj);
                         HelperObject_V_MCE_ASSETS_ROLLEQUIP.Update(obj, transaction);
                     }
                     foreach (EntityObject_V_MCE_ASSETS_ROLLEQUIP obj in deleteEntities)
                     {
                         HelperObject_V_MCE_ASSETS_ROLLEQUIP.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_V_MCE_ASSETS_ROLLEQUIP> smgr = new ServiceManager <ServiceContract_V_MCE_ASSETS_ROLLEQUIP>(ServiceUri))
         {
             return(smgr.Service.CommitUpdate(saveEntities, updateEntities, deleteEntities));
         }
     }
 }
Ejemplo n.º 3
0
        public BizLogicMsg CommitSave(EntityObject_V_MCE_ASSETS_ROLLEQUIP saveBaseEntity, EntityObject_[] saveDetailEntities)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            SystemLogic.Proxy.AuditAdd(saveBaseEntity);
                            HelperObject_V_MCE_ASSETS_ROLLEQUIP.Save(saveBaseEntity, transaction);

                            //平台自动生成代码
                            foreach (EntityObject_ obj in saveDetailEntities)
                            {
                                obj. = saveBaseEntity.ASSETS_NAME;
                                SystemLogic.Proxy.AuditAdd(obj);
                                HelperObject_.Save(obj, transaction);
                            }
                            PostSave(saveBaseEntity, 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_V_MCE_ASSETS_ROLLEQUIP> smgr = new ServiceManager <ServiceContract_V_MCE_ASSETS_ROLLEQUIP>(ServiceUri))
                {
                    return(smgr.Service.CommitSave(saveBaseEntity, saveDetailEntities));
                }
            }
        }
Ejemplo n.º 4
0
        public BizLogicMsg BatchSave(EntityObject_V_MCE_ASSETS_ROLLEQUIP[] objs)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (EntityObject_V_MCE_ASSETS_ROLLEQUIP obj in objs)
                            {
                                SystemLogic.Proxy.AuditAdd(obj);
                            }
                            int amount = 0;

                            //平台自动生成代码
                            foreach (EntityObject_V_MCE_ASSETS_ROLLEQUIP obj in objs)
                            {
                                amount += HelperObject_V_MCE_ASSETS_ROLLEQUIP.Save(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_V_MCE_ASSETS_ROLLEQUIP> smgr = new ServiceManager <ServiceContract_V_MCE_ASSETS_ROLLEQUIP>(ServiceUri))
                {
                    return(smgr.Service.BatchSave(objs));
                }
            }
        }