Ejemplo n.º 1
0
        public void RemoveHostingUnitB(HostingUnit H)
        {
            DAL.IDAL            dal   = DAL.FactoryDal.GetDal();
            IEnumerable <Order> order = dal.Get_Orders();
            var v = from item in order
                    where item.HostingUnitKey == H.HostingUnitKey && (item.Status == OrderStatus.mail_has_been_sent || item.Status == OrderStatus.Not_treated && item.HostingUnitKey == H.HostingUnitKey)
                    select item;

            try
            {
                if (v == null)
                {
                    throw new OverflowException("לא ניתן למחוק יחידת אירוח כל עוד יש הצעה הקשורה אליה במצב פתוח");
                }
                else
                {
                    dal.DeleteHostingUnit(H);
                }
            }
            catch (OverflowException ex)
            {
                throw ex;
            }
            catch (KeyNotFoundException ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public void RemoveHostingUnitB(HostingUnit H)//לפני מחיקת יחידת אירוח  בודק אם אין הזמנות במצב פתוח
        {
            IEnumerable <Order> order = dal.Get_Orders();
            var v = from item in order
                    where item.HostingUnitKey == H.HostingUnitKey && (item.Status == OrderStatus.נשלח_מייל || item.Status == OrderStatus.לא_טופל && item.HostingUnitKey == H.HostingUnitKey)
                    select item;

            if (v.ToList() == null)
            {
                throw new OverflowException("לא ניתן למחוק יחידת אירוח כל עוד יש הצעה הקשורה אליה במצב פתוח");
            }
            else
            {
                try
                {
                    dal.DeleteHostingUnit(H);
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }