Exemplo n.º 1
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
                        {
                            foreach (string strID in listID)
                            {
                                EntityObject_MCE_B_ASSETS_OUTSTOCK obj = new EntityObject_MCE_B_ASSETS_OUTSTOCK();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_OUTSTOCK.Get(obj);

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

                                    HelperObject_MCE_B_ASSETS_OUTSTOCK.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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
                {
                    return(smgr.Service.Delete_Ext(listID));
                }
            }
        }
Exemplo n.º 2
0
 public int DeleteByTrans2(CauseObject_MCE_B_ASSETS_OUTSTOCK cause, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         return(HelperObject_MCE_B_ASSETS_OUTSTOCK.Delete(cause, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Exemplo n.º 3
0
 public BizLogicMsg CommitUpdate(EntityObject_MCE_B_ASSETS_OUTSTOCK[] saveEntities, EntityObject_MCE_B_ASSETS_OUTSTOCK[] updateEntities, EntityObject_MCE_B_ASSETS_OUTSTOCK[] deleteEntities)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     //平台自动生成代码
                     foreach (EntityObject_MCE_B_ASSETS_OUTSTOCK obj in saveEntities)
                     {
                         SystemLogic.Proxy.AuditAdd(obj);
                         HelperObject_MCE_B_ASSETS_OUTSTOCK.Save(obj, transaction);
                     }
                     foreach (EntityObject_MCE_B_ASSETS_OUTSTOCK obj in updateEntities)
                     {
                         SystemLogic.Proxy.AuditEdit(obj);
                         HelperObject_MCE_B_ASSETS_OUTSTOCK.Update(obj, transaction);
                     }
                     foreach (EntityObject_MCE_B_ASSETS_OUTSTOCK obj in deleteEntities)
                     {
                         HelperObject_MCE_B_ASSETS_OUTSTOCK.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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
         {
             return(smgr.Service.CommitUpdate(saveEntities, updateEntities, deleteEntities));
         }
     }
 }
Exemplo n.º 4
0
        public BizLogicMsg BatchDelete(EntityObject_MCE_B_ASSETS_OUTSTOCK[] objs)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            int amount = 0;

                            //平台自动生成代码
                            foreach (EntityObject_MCE_B_ASSETS_OUTSTOCK obj in objs)
                            {
                                amount += HelperObject_MCE_B_ASSETS_OUTSTOCK.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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
                {
                    return(smgr.Service.BatchDelete(objs));
                }
            }
        }
Exemplo n.º 5
0
 public BizLogicMsg CommitDelete(EntityObject_MCE_B_ASSETS_OUTSTOCK 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_OUTSTOCK.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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
         {
             return(smgr.Service.CommitDelete(deleteBaseEntity));
         }
     }
 }