Beispiel #1
0
        public Passanger GetPassanger(int passanger_id)
        {
            Passanger     passanger = new Passanger();
            SqlConnection cnn       = dBContext.GetConnection();

            cnn.Open();
            String query = "Select Passanger.lname,Passanger.fname from Account,Passanger"
                           + " where Account.passanger_id = Passanger.id"
                           + " and"
                           + " Passanger.id = @val1"
            ;

            SqlCommand command = new SqlCommand(query, cnn);

            command.Parameters.AddWithValue("@val1", passanger_id);

            SqlDataReader reader = command.ExecuteReader();

            if (reader.Read())
            {
                passanger.Lname = reader.GetString(0);
                passanger.Fname = reader.GetString(1);
            }

            cnn.Close();
            return(passanger);
        }
Beispiel #2
0
        public bool InsertPassanger(Passanger passanger)
        {
            str = "USE FligthDB;" +
                  "INSERT INTO Passanger (Nome, Sobrenome, Email, AirplaneId) VALUES (@Nome, @Sobrenome, @Email, @AirplaneId)";
            SqlCommand command;

            using (SqlConnection connection = myConn)
            {
                command = new SqlCommand(str, connection);
                command.Parameters.Add("@Nome", SqlDbType.Text);
                command.Parameters["@Nome"].Value = passanger.Nome;
                command.Parameters.Add("@Sobrenome", SqlDbType.Text);
                command.Parameters["@Sobrenome"].Value = passanger.Sobrenome;
                command.Parameters.Add("@Email", SqlDbType.Text);
                command.Parameters["@Email"].Value = passanger.Email;
                command.Parameters.Add("@AirplaneId", SqlDbType.Int);
                command.Parameters["@AirplaneId"].Value = passanger.AirplaneId;

                try
                {
                    connection.Open();
                    var linhasAfetadas = command.ExecuteNonQuery();
                    Console.WriteLine("Linhas afetadas: {0}", linhasAfetadas);
                    return(true);
                }
                catch (Exception ex)
                {
                    ex.ToString();
                    return(false);
                }
            }
        }
Beispiel #3
0
    //private void TrainArrived()
    //{
    //    foreach (PassengerTrack platform in _buildingManager.m_Buildings.OfType<PassengerTrack>())
    //    {
    //        StartCoroutine(SpawnNpcGroup(platform.m_NpcAmount, platform.m_PassangerType, platform.m_NpcMovePoint));
    //    }
    //}

    public virtual IEnumerator SpawnNpcGroup(int pNpcCount, Passanger pPassanger, Vector3 pSpawnPoint)
    {
        OnVisitorSpawn(pPassanger, pNpcCount);

        int spawnAmount = UnityEngine.Random.Range(1, 3);

        for (int i = 0; i < pNpcCount; i += spawnAmount)
        {
            if (spawnAmount < 2)
            {
                SpawnNpcAndMove(pSpawnPoint, CalculateGoToStore(pPassanger), (int)pPassanger);
            }
            else
            {
                SpawnNpcAndMove(pSpawnPoint, CalculateGoToStore(pPassanger), (int)pPassanger);
                yield return(new WaitForSeconds(UnityEngine.Random.Range(0.05f, 0.1f)));

                SpawnNpcAndMove(pSpawnPoint, CalculateGoToStore(pPassanger), (int)pPassanger);
            }
            float randomTime = UnityEngine.Random.Range(0.0f, 0.2f);
            yield return(new WaitForSeconds(_spawnFrequency + randomTime));

            if (pNpcCount >= 2)
            {
                spawnAmount = UnityEngine.Random.Range(1, 3);
            }
            else
            {
                spawnAmount = 1;
            }
        }
    }
        public ActionResult EditPassanger(int?id)
        {
            Passanger passanger  = context.passangers.Find(id);
            var       ResDetails = context.passangers.Where(x => x.Id == id).FirstOrDefault();

            return(View(ResDetails));
        }
        public ActionResult PassangerSearch(int?Id)
        {
            if (Id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Passanger passanger = context.passangers.Find(Id);

            if (passanger == null)
            {
                return(HttpNotFound());
            }
            else
            {
                var result = (from p in context.passangers
                              join s in context.Stages
                              on p.PassangerStageId equals s.StageID
                              where p.Id == Id
                              select new PassangerSearch
                {
                    PicturePath = path + s.Picture.Trim(),
                    PassangerName = p.Name,
                    PassangerNationality = p.Nationality,
                    StageName = s.StageName,
                    StageExtraTime = s.ExtraTime,
                    StageEstimatedTime = s.EstimatedTime
                }).FirstOrDefault();

                return(View("PassangerSearchDetails", result));
            }
        }
Beispiel #6
0
        public ActionResult Delete([FromRoute] int id)
        {
            Passanger p = unitOfWork.Passanger.GetAll().Single(p => p.PassangerId == id);

            unitOfWork.Passanger.Remove(p);
            unitOfWork.Commit();
            return(Index());
        }
 protected override void WriteGDValues()
 {
     base.WriteGDValues();
     //m_BuildCost = values.BuildCost;
     UpkeepCost      = values.UpkeepCost;
     m_PassangerType = values.PassangerType;
     timeTilArrival  = values.TimeTilArrival;
 }
Beispiel #8
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            Passanger passanger = db.Passanger.Find(id);

            db.Passanger.Remove(passanger);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #9
0
        static void Main(string[] args)
        {
            Welcome.WelcomeToAirport();
            string name = Console.ReadLine();
            string firstNames, lastName;

            SplitFullName.SplitName(name, out firstNames, out lastName);

            Console.WriteLine($"{firstNames}, welcome to check-in desk. Please answer for a few questions.");

            Console.WriteLine($"First of all, please input your date of birthday (yyyy,mm,d): ");
            Passport passport = new Passport();

            passport.DateOfBirth = CheckType.GetDateFromConsole();
            CheckDB.CheckDateOfBirth(passport);

            Console.WriteLine($"Are you have a visa, {firstNames}? (yes or no)");
            Visa visa = new Visa();

            visa.Status = CheckVisa.CheckOfVisa();

            Console.WriteLine($"{firstNames}, please input your passport number: ");
            passport.Number = Console.ReadLine();

            Console.WriteLine($"{firstNames}, now please input passport issued (yyyy,mm,d): ");
            passport.Issued = CheckType.GetDateFromConsole();

            Console.WriteLine($"{firstNames}, now please input passport expired (yyyy,mm,d): ");
            passport.Expired = CheckType.GetDateFromConsole();

            CheckPassport.CheckDatesOfPassport(passport);

            Console.WriteLine($"Are you have a online registration, {firstNames}? (yes or no)");
            Ticket ticket = new Ticket();

            ticket.NumberOfTicket = CheckTicket.CheckOnlineRegistration(ticket);

            Console.WriteLine($"\nDo you have any luggage, {firstNames}? (yes or no)");

            Bag bag = new Bag();

            CheckBag.CheckWeightOfBag(bag);

            Console.WriteLine($"{firstNames}, allright! Please go to security check. (any key)");
            Console.ReadKey();

            Console.WriteLine($"{firstNames}, welcome to security check. Open your case for examination, please." +
                              $"\nDo you have anything forbidden in your suitcase: drugs, guns, explosive materials? (yes or no)");
            SecurityEmployee security = new SecurityEmployee();

            security.ForbiddenItem = SecurityCheck.CheckForbiddenItem(security);

            Console.WriteLine($"{firstNames}, welcome to passport control. May I see your passport and ticket, please? (yes or no)");
            Passanger passanger = new Passanger(name, passport, ticket, visa, bag);
            PassportControlEmployee passportControlEmployee = new PassportControlEmployee();

            passportControlEmployee.Passanger = PassportControl.CheckPassanger(passanger);
        }
Beispiel #10
0
    private void UpdateVisitorAmount(Passanger pType, int newVisitorCount)
    {
        pStats[(int)pType].curAmount   += newVisitorCount;
        pStats[(int)pType].totalAmount += newVisitorCount;

        OnNewVisitorsArrived(newVisitorCount);
        OnCurVisiterCountChange(newVisitorCount);
        OnVisitorLeftEntered();
    }
        public ActionResult DeletePassanger(int?id)
        {
            Passanger passanger = context.passangers.Find(id);
            int?      planeid   = passanger.PassangerPlaneId;

            context.passangers.Remove(passanger);
            context.SaveChanges();
            return(RedirectToAction("Details", "Plane", new { id = planeid }));
        }
Beispiel #12
0
 protected virtual void SpawnNPCLeavingStore(Passanger type, Transform spawnPoint)
 {
     SpawnNpcAndMove(
         new Vector3(spawnPoint.transform.position.x - 1.0f, spawnPoint.transform.position.y, spawnPoint.transform.position.z),
         new StoreInfo(null, _exitPoint),
         (int)type
         );
     print(type.ToString() + " is leaving shop towards station exit");
 }
Beispiel #13
0
    public virtual void NPCEnters(Passanger passanger)
    {
        guestInShop = true;
        VisitorStats visitor = VisitorStats(passanger);

        FC.AddShopIncome(visitor.type, visitor.earningGain);
        //FC.UpdateMonthlyRevenue(visitor.earningGain);
        OnSatisfactionGain(visitor.satisfactionGain);
    }
        public ActionResult EditPassanger(Passanger passanger, int id)
        {
            var MyEdit = context.passangers.Where(c => c.Id == id).FirstOrDefault();

            MyEdit.Name        = passanger.Name;
            MyEdit.Nationality = passanger.Nationality;
            context.SaveChanges();

            return(RedirectToAction("Index"));
        }
        public ActionResult EditPassanger(Passanger passanger, int id)
        {
            var MyEdit = context.passangers.Where(c => c.Id == id).FirstOrDefault();

            MyEdit.Name        = passanger.Name;
            MyEdit.Nationality = passanger.Nationality;
            context.SaveChanges();

            return(RedirectToAction("Details", new{ Controller = "Plane", id = MyEdit.PassangerPlaneId }));
        }
Beispiel #16
0
 public ActionResult Edit([Bind(Include = "Passanger_ID,FirstName,LastName,Nationality,PassportID,DateOfBirth,Sex")] Passanger passanger)
 {
     if (ModelState.IsValid)
     {
         db.Entry(passanger).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(passanger));
 }
 public void UnregisterPassanger(Passanger Argpassanger)
 {
     for (int i = 0; i < passangerIndicatorList.Count; i++)
     {
         if (passangerIndicatorList[i].go == Argpassanger.gameObject)
         {
             Destroy(passangerIndicatorList[i].indicator);
             passangerIndicatorList.RemoveAt(i);
         }
     }
 }
Beispiel #18
0
        public Passanger GetReservationPassanger(ReservationPassangerInputModel model)
        {
            //Check if passanger has already been added to the database
            Passanger passanger = context.Passangers
                                  .FirstOrDefault(c =>
                                                  c.PersonalNumber == model.PersonalNumber &&
                                                  c.Email == model.Email &&
                                                  c.PhoneNumber == model.PhoneNumber);

            return(passanger ?? model.To <Passanger>());
        }
Beispiel #19
0
 public override int CurGuestCountOf(Passanger pType)
 {
     foreach (VisitorStats vs in m_VisitorStats)
     {
         if (vs.type == pType)
         {
             return(vs.curAmount);
         }
     }
     return(0);
 }
Beispiel #20
0
        public ActionResult Create([Bind(Include = "Passanger_ID,FirstName,LastName,Nationality,PassportID,DateOfBirth,Sex")] Passanger passanger)
        {
            if (ModelState.IsValid)
            {
                passanger.Passanger_ID = Guid.NewGuid();
                db.Passanger.Add(passanger);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(passanger));
        }
Beispiel #21
0
 public HttpResponseMessage Post([FromBody] Passanger passanger)
 {
     if (passanger != null)
     {
         Passangers.Add(passanger);
         baseContext.InsertPassanger(passanger);
         return(Request.CreateResponse(HttpStatusCode.OK, "sucess"));
     }
     else
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "failed"));
     }
 }
Beispiel #22
0
        public async Task <Passanger> InsertPassangerAsync(Passanger request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            await _context.Passangers.AddAsync(request);

            await _context.SaveChangesAsync();

            return(request);
        }
Beispiel #23
0
        // GET: Passangers/Delete/5
        public ActionResult Delete(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Passanger passanger = db.Passanger.Find(id);

            if (passanger == null)
            {
                return(HttpNotFound());
            }
            return(View(passanger));
        }
 public ActionResult AddPassanger(int id, Passanger passanger)
 {
     //Stages stages = context.Stages.Where(x => x.StageID == 1).FirstOrDefault();
     //passanger.Stages = stages;
     if (ModelState.IsValid)
     {
         passanger.PassangerStageId = 1;
         passanger.PassangerPlaneId = id;
         context.passangers.Add(passanger);
         context.SaveChanges();
         return(PartialView("_AppendPassanger", passanger));
     }
     return(PartialView("_AppendPassanger", passanger));
 }
Beispiel #25
0
        public void insertPassanger(Passanger passanger)
        {
            SqlConnection cnn = dBContext.GetConnection();

            cnn.Open();
            String     query   = "Insert into Passanger values(@val1,@val2,@val3,@val4,@val5)";
            SqlCommand command = new SqlCommand(query, cnn);

            command.Parameters.AddWithValue("@val1", passanger.Fname);
            command.Parameters.AddWithValue("@val2", passanger.Lname);
            command.Parameters.AddWithValue("@val3", passanger.Dob);
            command.Parameters.AddWithValue("@val4", passanger.Email);
            command.Parameters.AddWithValue("@val5", passanger.Phone);
            command.ExecuteNonQuery();
        }
 public PassengersAndServicesPage FillInformationAboutPassanger(Passanger passanger)
 {
     WaitWebElementLoad(driver, 20, ButtonNextToTabServices);
     PassengerTitle.Click();
     PassengerTitle.SendKeys(Keys.Enter);
     PassangerFirstName.SendKeys(passanger.PassangerFirstName);
     PassangerLastName.SendKeys(passanger.PassangerLastName);
     DateOfBirthAdultField.SendKeys(passanger.PassangerDateOfBirth);
     PassangerDocumentNumber.SendKeys(passanger.PassangerDocumentNumber);
     PassengerDocumentExpirationDate.Click();
     PassangerPhoneNumber.SendKeys(passanger.PassangerPhoneNumber);
     PassangerEmail.SendKeys(passanger.PassangerEmail);
     PassangerEmailConfirm.SendKeys(passanger.PassangerEmailConfirm);
     ButtonNextToTabServices.Click();
     return(this);
 }
        public async Task <IActionResult> Post(Passanger model)
        {
            try
            {
                await _passanger.Add(model);

                if (await _passanger.SaveChanges())
                {
                    return(Created($"Airplane/{model.id}", model));
                }
            }
            catch (Exception ex)
            {
                return(await Error(ex));
            }
            return(BadRequest());
        }
 public bool CompareDisplayedDataWithInputData(Passanger passanger)
 {
     if (NamePassanger.Text.Contains(passanger.PassangerFirstName + " " + passanger.PassangerLastName))
     {
         if (PassangerNumberDocument.Text.Equals(passanger.PassangerDocumentNumber))
         {
             if (PassangerNumberPhone.Text.Contains(passanger.PassangerPhoneNumber))
             {
                 if (PassangerEmail.Text.Contains(passanger.PassangerEmail))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            var route = new Passanger();

            route.Id        = Guid.NewGuid();
            route.FirstName = firstname.Text;
            route.LastName  = lastname.Text;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
            {
                client.CreateEntity(route);
                scope.Complete();
            }

            Thread.Sleep(3000);
            Response.Redirect("passangersPage");
        }
Beispiel #30
0
        [Route("setpassenger")] //ВНЕШКА  этот пост используется системой пассажир для посадки в автобус
        public void Post([FromBody] ValueTuple <Guid, Guid> pastuple)
        {
            var filepassangers = new FileCSV();
            var bl             = new BusLog();
            var pas            = new Passanger();

            byte[] p    = pastuple.Item1.ToByteArray();
            int    pint = BitConverter.ToInt32(p, 0);

            byte[] b    = pastuple.Item2.ToByteArray();
            int    bint = BitConverter.ToInt32(b, 0);


            pas.passangerId = pint;
            pas.busId       = bint;
            bl.WriteToLog("Автобус " + bint + " принялна борт пассажира " + pint + ".");
            filepassangers.WriteToCSVPassanger(pas);
        }