Ejemplo n.º 1
0
        /// <summary>
        /// O(n^2)
        /// </summary>
        /// <param name="delete"></param>
        public void DeleteCargoWays(List <CargoWays> delete)
        {
            List <DAL.CargoWays>    todel = new List <DAL.CargoWays>();
            HashSet <DAL.CargoWays> has   = new HashSet <DAL.CargoWays>();

            foreach (CargoWays c in delete)
            {
                //there may be multiple reference of the same DAL_instance, so we check here
                if (has.Contains(c.DAL_GetCargoWay()))
                {
                    continue;
                }
                todel.Add(c.DAL_GetCargoWay());
                has.Add(c.DAL_GetCargoWay());
            }
            DAL.CargoWayDA.ICargoWaysDA cargoWaysDA = new DAL.CargoWayDA.CargoWaysDAO();
            //database
            cargoWaysDA.DeleteCargoWays(todel);
            //memory
            foreach (Entity.CargoWays c in delete)
            {
                _DAL_CargoWays.Remove(c.DAL_GetCargoWay());
                _map.CargoWays.Remove(c);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// O(n), normally the cargoways will not be deleted, except for recalculation
 /// </summary>
 public void DeleteAllCargoWays()
 {
     DAL.CargoWayDA.ICargoWaysDA cargoWaysDA = new DAL.CargoWayDA.CargoWaysDAO();
     //database
     cargoWaysDA.DeleteCargoWays(_DAL_CargoWays);
     //memory
     _DAL_CargoWays.Clear();
     _map.CargoWays.Clear();
 }