public BizLogicMsg Delete_Ext2(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_METER obj = new EntityObject_MCE_B_ASSETS_METER();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_METER.Get(obj);

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

                                    HelperObject_MCE_B_ASSETS_METER.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> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER>(ServiceUri))
                {
                    return(smgr.Service.Delete_Ext2(listID));
                }
            }
        }
Esempio n. 2
0
 public int DeleteByTrans2(CauseObject_MCE_B_ASSETS_METER cause, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         return(HelperObject_MCE_B_ASSETS_METER.Delete(cause, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Esempio n. 3
0
 public BizLogicMsg CommitUpdate(EntityObject_MCE_B_ASSETS_METER[] saveEntities, EntityObject_MCE_B_ASSETS_METER[] updateEntities, EntityObject_MCE_B_ASSETS_METER[] deleteEntities)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     //平台自动生成代码
                     foreach (EntityObject_MCE_B_ASSETS_METER obj in saveEntities)
                     {
                         SystemLogic.Proxy.AuditAdd(obj);
                         HelperObject_MCE_B_ASSETS_METER.Save(obj, transaction);
                     }
                     foreach (EntityObject_MCE_B_ASSETS_METER obj in updateEntities)
                     {
                         SystemLogic.Proxy.AuditEdit(obj);
                         HelperObject_MCE_B_ASSETS_METER.Update(obj, transaction);
                     }
                     foreach (EntityObject_MCE_B_ASSETS_METER obj in deleteEntities)
                     {
                         HelperObject_MCE_B_ASSETS_METER.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> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER>(ServiceUri))
         {
             return(smgr.Service.CommitUpdate(saveEntities, updateEntities, deleteEntities));
         }
     }
 }
Esempio n. 4
0
        public BizLogicMsg BatchDelete(EntityObject_MCE_B_ASSETS_METER[] 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_METER obj in objs)
                            {
                                amount += HelperObject_MCE_B_ASSETS_METER.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> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER>(ServiceUri))
                {
                    return(smgr.Service.BatchDelete(objs));
                }
            }
        }
Esempio n. 5
0
 public BizLogicMsg CommitDelete(EntityObject_MCE_B_ASSETS_METER 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.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> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER>(ServiceUri))
         {
             return(smgr.Service.CommitDelete(deleteBaseEntity));
         }
     }
 }
        public BizLogicMsg Delete_Ext(string strID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_METER obj = new EntityObject_MCE_B_ASSETS_METER();
                            obj.ID = strID;

                            obj = HelperObject_MCE_B_ASSETS_METER.Get(obj);

                            if (obj != null)
                            {
                                if (obj.AUDIT_STATE == 3 || obj.AUDIT_STATE == 4)
                                {
                                    throw new Exception("已经审核的计量信息不能删除.");
                                }

                                CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE();
                                pCOM_FILE.REF_TAB_ID   = obj.ID;
                                pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_METER";

                                DisplayObject_COM_FILE[] listCOM_FILE = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE);

                                if (listCOM_FILE != null && listCOM_FILE.Length > 0)
                                {
                                    foreach (DisplayObject_COM_FILE item in listCOM_FILE)
                                    {
                                        if (!string.IsNullOrEmpty(item.SERVER_NAME))
                                        {
                                            string strFileURL = System.Web.HttpContext.Current.Server.MapPath("~/upload/mce/" + item.SERVER_NAME);//路径
                                            if (File.Exists(strFileURL))
                                            {
                                                File.Delete(strFileURL);
                                            }
                                        }
                                    }
                                }
                                HelperObject_COM_FILE.Delete(pCOM_FILE, transaction);

                                HelperObject_MCE_B_ASSETS_METER.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> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext(strID));
                }
            }
        }