Exemplo n.º 1
0
        /// <summary>
        /// Erases a hosting unit
        /// </summary>
        /// <param name="hostUnit"></param>
        public void Erase_Hosting_Unit(HostingUnit hostUnit)
        {
            List <Order> ordersList = Dal.Get_Order_List();

            foreach (var order in ordersList)
            {
                if (order.HostingUnitKey == hostUnit.HostingUnitKey)
                {
                    if (order.Status == Order_Status.Mail_Sent)
                    {
                        throw new Can_tEraseException("Can't erase the hosting unit.There is an order connected to it ! From BL");
                    }
                }
            }


            try
            {
                Dal.Erase_Hosting_Unit(hostUnit.Clone());
            }
            catch (KeyNotFoundException ex)
            {
                throw new KeyNotFoundException(ex.Message);
            }



            return;
        }