コード例 #1
0
        public static void Delete(PartnerDto pPartner)
        {
            using (Rbr_Db _db = new Rbr_Db()) {
                using (Transaction _tx = new Transaction(_db, pPartner)) {
                    if (CustomerAcctManager.Exist(_db, pPartner.PartnerId))
                    {
                        throw new ApplicationException("Partner has Customer Account(s).\r\nCannot delete.");
                    }

                    if (CarrierAcctManager.Exist(_db, pPartner.PartnerId))
                    {
                        throw new ApplicationException("Partner has Carrier Account(s).\r\nCannot delete.");
                    }

                    //TODO: NEW DAL !!!
                    //ResellAcctManager.DeleteByPartnerId(_db, pPartner.PartnerId);
                    PersonManager.DeleteByPartnerId(_db, pPartner.PartnerId);
                    PartnerManager.Delete(_db, pPartner);

                    _tx.Commit();
                }
            }
        }