Exemple #1
0
    public virtual void  SetPriority(Dictionary <ComperativeLocation, Car> comperative, Car settingCar)
    {
        TrafficSign trafficSignal = ToolBox.Get <SignManager>().TS[settingCar.Position];

        Car observeCarLeft;
        Car observeCarRight;

        if (trafficSignal == TrafficSign.Secondary)
        {
            if (comperative.ContainsKey(ComperativeLocation.Left) || comperative.ContainsKey(ComperativeLocation.Right))
            {
                settingCar.priority++;
            }

            if (comperative.TryGetValue(ComperativeLocation.Left, out observeCarLeft) && comperative.TryGetValue(ComperativeLocation.Right, out observeCarRight))
            {
                if (observeCarLeft.Direction == Direction.Left && observeCarRight.Direction != Direction.Left)
                {
                    settingCar.priority++;
                }
                else if (observeCarRight.Direction == Direction.Left && observeCarLeft.Direction != Direction.Left)
                {
                    settingCar.priority++;
                }
            }
        }
    }
Exemple #2
0
        public string GetMessegeFromUserByTrafficSign(string uniqueString, string stringForDisable, string stringForDisableCarNum, string stringForParkingNote, string parkingPermitAreaNum, string stringDateTime)
        //char  parkingPermitAreaNum is 0 if not parking permit
        {
            StringBuilder stringToSend     = null;
            ClientUser    userDetails      = new ClientUser(stringForDisable, stringForDisableCarNum, stringForParkingNote, parkingPermitAreaNum);
            TrafficSign   trafficSign      = new TrafficSign(uniqueString, stringDateTime);
            SubNotesTS    suitableSubNotes = null;

            string result = string.Empty;

            result = checkSpetialUniqueString(uniqueString, userDetails);

            if (result.Equals(string.Empty))
            {
                suitableSubNotes = trafficSign.getSuitableSubNotes();
                if (suitableSubNotes != null)
                {
                    stringToSend = messageBuilder(suitableSubNotes, userDetails);
                }
                else
                {
                    stringToSend = canParkMessageBuilder();
                    stringToSend.Append(",,,");
                }
                return(stringToSend.ToString());
            }

            return(result);
        }
Exemple #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            TrafficSign trafficSign = db.TrafficSigns.Find(id);

            db.TrafficSigns.Remove(trafficSign);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "TrafficSignID,TrafficSignName")] TrafficSign trafficSign)
 {
     if (ModelState.IsValid)
     {
         db.Entry(trafficSign).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(trafficSign));
 }
        public IHttpActionResult GetTrafficSign(int id)
        {
            TrafficSign trafficSign = db.TrafficSigns.Find(id);

            if (trafficSign == null)
            {
                return(NotFound());
            }

            return(Ok(trafficSign));
        }
Exemple #6
0
        public ActionResult Create([Bind(Include = "TrafficSignID,TrafficSignName")] TrafficSign trafficSign)
        {
            if (ModelState.IsValid)
            {
                db.TrafficSigns.Add(trafficSign);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(trafficSign));
        }
Exemple #7
0
        // GET: TrafficSigns/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TrafficSign trafficSign = db.TrafficSigns.Find(id);

            if (trafficSign == null)
            {
                return(HttpNotFound());
            }
            return(View(trafficSign));
        }
Exemple #8
0
 public RoadSituation(int countOfCars, PositionRotation[] posRotAnimCar, bool vIP, Direction[] directions,
                      TrafficSign trafficSign, int coutOfSigns, PositionRotation[] posRotSign,
                      TrafficLight trafficLight, int coutOfLights, PositionRotation[] posRotLight)
 {
     CountOfCars        = countOfCars;
     this.posRotAnimCar = posRotAnimCar;
     VIP               = vIP;
     this.directions   = directions;
     this.trafficSign  = trafficSign;
     CoutOfSigns       = coutOfSigns;
     this.posRotSign   = posRotSign;
     this.trafficLight = trafficLight;
     CoutOfLights      = coutOfLights;
     this.posRotLight  = posRotLight;
 }