Пример #1
0
        public ParkingResult ParkMyCar(ParkingInformation parkInfo)
        {
            var parkingAttemptResult = new ParkingResult();

            try
            {
                this.driver = new ChromeDriver(options);
                driver.Manage().Window.Size = new Size(iPhoneXWidth, iPhoneXHeight);
                var visitResult   = VerifyMyVisit(parkInfo.PhoneNumber, parkInfo.ApartmentNumber);
                var detailsResult = EnterVehicleDetails(parkInfo.PlateNumber, parkInfo.PlateState, parkInfo.CarMake, parkInfo.CarModel, parkInfo.CarColor, parkInfo.CarYear);
                var confirmResult = ConfirmRules();

                var ssLocation = Path.GetFullPath(GetPass());
                Console.WriteLine(ssLocation);

                parkingAttemptResult.Success             = (visitResult.Success && detailsResult.Success && confirmResult.Success);
                parkingAttemptResult.ParkingPassLocation = ssLocation;
            }
            catch (Exception e)
            {
                parkingAttemptResult.Success      = false;
                parkingAttemptResult.ErrorMessage = $"{e.Message} ::: {e.StackTrace}";
            }
            finally
            {
                driver.Quit();
                this.driver = null;
            }
            return(parkingAttemptResult);
        }
Пример #2
0
 public void PostCarPark(Guid id, String plateNumber, ParkingResult result)
 {
     this.DbExecuteNonQuery(String.Format("update IPSCM.dbo.ParkRecord set [RecordId]='{0}',[UserId]='{1}' where Id='{2}'",
                                          result.Info.RecordId, result.Info.UserId == 0 ? result.Info.UserId.ToString() : "NULL", id));
     if (result.Info.UserId == 0)
     {
         return;
     }
     this.DbExecuteNonQuery(String.Format
                            (
                                @"if exists( select * from IPSCM.dbo.Users where UserId = '{0}')
         begin
         update IPSCM.dbo.Users set [Money]='{1}',PlateNumber=N'{3}',PhoneNumber='{2}' where UserId = '{0}'
         end
         else
         begin
         insert into IPSCM.dbo.Users ([UserId],[PlateNumber],[Money],[PhoneNumber]) values ('{0}',N'{3}','{1}','{2}')
         end"
                                , result.Info.UserId, result.Info.Money, result.Info.PhoneNumber, plateNumber));
 }
Пример #3
0
        /// <summary>
        /// Parks a vehicle in the garage
        /// </summary>
        /// <param name="vehicle">The vehicle to park</param>
        /// <returns>Returns a PerkingResult object with info about how things worked out</returns>
        public ParkingResult ParkVehicle(Vehicle vehicle)
        {
            ParkingResult result;

            if (count < vehicles.Length)          // if not full
            {
                if (IndexOf(vehicle.RegNo) == -1) // if not duplicate
                {
                    vehicles[count] = vehicle;    // add it
                    count++;
                    result = new ParkingResult(true, null);
                }
                else
                {
                    result = new ParkingResult(false, $"{vehicle.RegNo} not unique!");
                }
            }
            else
            {
                result = new ParkingResult(false, "Garage is full");
            }
            return(result);
        }