Example #1
0
        public double MyInvoic(int CustID, int CarID)
        {
            ADP_ParkingEntities db       = new ADP_ParkingEntities();
            Customer            customer = db.Customers.Find(CustID);
            Car           car            = db.Cars.Find(CarID);
            RegisteredCar registeredCar  = db.RegisteredCars.FirstOrDefault(r => r.CarID == CarID && r.CustomerID == CustID);
            bool          isRegistered   = false;

            if (registeredCar != null)
            {
                isRegistered = true;
            }

            if (customer != null && car != null)
            {
                var invoke = .0;
                if (car.LeavingTime != null)
                {
                    invoke = new Bill(car.ArrivalTime.Value, car.LeavingTime.Value, customer.Vip == 1, isRegistered).InvoiceValue;
                }
                else
                {
                    invoke = new Bill(car.ArrivalTime.Value, customer.Vip == 1, isRegistered).InvoiceValue;
                }

                return(invoke);
                //  return (new Bill(car.ArrivalTime.Value, car.LeavingTime.Value, customer.Vip ==1, isRegistered).InvoiceValue);
            }
            //return (new Bill(car.ArrivalTime.Value, car.LeavingTime.Value, false, false).InvoiceValue);
            return(0);
        }
Example #2
0
        public static void Main(string[] arg)
        {
            ADP_ParkingEntities db = new ADP_ParkingEntities();

            //db.Customers.Add(new Customer() { Name = "mo", ID = 100 });
            db.SaveChanges();

            Console.WriteLine(db.Customers.ToList().Count);

            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            ADP_ParkingEntities   x = new ADP_ParkingEntities();
            ClientActivatedObject clientActivatedObject = new ClientActivatedObject();
            var u = clientActivatedObject.RetrieveVIP(300);

            ChannelServices.RegisterChannel(new TcpChannel(9000), false);
            RemotingConfiguration.ApplicationName = "CAO";
            RemotingConfiguration.RegisterActivatedServiceType(typeof(ClientActivatedObject));

            Console.WriteLine("Port 9000 has been started.");
            Console.WriteLine("Server is configured now.");
            Console.WriteLine("You can press any key to exit...");
            Console.ReadLine();

            Console.ReadLine();
        }
Example #4
0
        public List <int> GetNonFreePositionsForShowMap()
        {
            List <int>          ids = new List <int>();
            ADP_ParkingEntities db  = new ADP_ParkingEntities();
            var ParksIDsOFCars      = db.Cars.Where(c => c.LeavingTime == null);

            if (ParksIDsOFCars != null)
            {
                var nonfree = ParksIDsOFCars.Select(c => c.ParkID).ToList();
                foreach (int i in nonfree)
                {
                    ids.Add((int)i);
                }
            }


            return(ids);
        }
Example #5
0
        public List <int> GetFreePositionsForShowMap()
        {
            List <int>          ids = new List <int>();
            ADP_ParkingEntities db  = new ADP_ParkingEntities();
            var ParksIDsOFCars      = db.Cars.Where(c => c.LeavingTime == null);

            if (ParksIDsOFCars != null)
            {
                var nonFreePositions = ParksIDsOFCars.Select(c => c.ParkID);
                var FreePositions    = db.Positions.Where(p => !nonFreePositions.Contains(p.ID));
                if (FreePositions != null)
                {
                    var FreeIDs = FreePositions.Select(c => c.ID).ToList();
                    foreach (int i in FreeIDs)
                    {
                        ids.Add((int)i);
                    }
                }
            }



            return(ids);
        }
Example #6
0
 public ClientActivatedObject()
 {
     context = new ADP_ParkingEntities();
     context.Configuration.ProxyCreationEnabled = false;
 }