Esempio n. 1
0
        private void GetHeaderInfo(TripInfo tripInfo)
        {
            if (NewEditExit.BtnNewText == "&Save")
            {
                tripInfo.TripID    = string.Empty;
                tripInfo.TripCode  = txtTripCode.Text;
                tripInfo.RouteID   = cboRoute.SelectedValue.ToString();
                tripInfo.TripDate  = Convert.ToDateTime(dtpDate.Text);
                tripInfo.TimeID    = cboTime.SelectedValue.ToString();
                tripInfo.Price     = Convert.ToDecimal(this.txtPrice.Text.Trim());
                tripInfo.BusID     = cboBusNumber.SelectedValue.ToString();
                tripInfo.Driver1ID = cboDriver1.SelectedValue.ToString();
                tripInfo.Driver2ID = cboDriver2.SelectedValue.ToString();
                totalseat          = Convert.ToInt32(txtTotalSeat.Text);
            }

            else if (NewEditExit.BtnNewText == "&Update")
            {
                tripInfo.TripID    = recordID;
                tripInfo.TripCode  = this.cboTripCode.Text;
                tripInfo.RouteID   = cboRoute.SelectedValue.ToString();
                tripInfo.TripDate  = Convert.ToDateTime(dtpDate.Text);
                tripInfo.TimeID    = cboTime.SelectedValue.ToString();
                tripInfo.Price     = Convert.ToDecimal(this.txtPrice.Text.Trim());
                tripInfo.BusID     = cboBusNumber.SelectedValue.ToString();
                tripInfo.Driver1ID = cboDriver1.SelectedValue.ToString();
                tripInfo.Driver2ID = cboDriver2.SelectedValue.ToString();
                totalseat          = Convert.ToInt32(txtTotalSeat.Text);
            }
        }
Esempio n. 2
0
            public static void OrginizeTrip(TripInfo tripInfo)
            {
                if (tripInfo.TypeOfTransport == "Air")
                {
                    TransportOrginizer.OrderAirplaneTickets();
                }
                else if (tripInfo.TypeOfTransport == "Ground")
                {
                    TransportOrginizer.OrderBusTickets();
                }

                if (tripInfo.TypeOfAccomondation == "Hotel")
                {
                    AcomondationOrginizer.BookHotel(tripInfo.NumberOfAccomendationStars);
                }
                else if (tripInfo.TypeOfAccomondation == "Apartment")
                {
                    AcomondationOrginizer.BookApartment(tripInfo.NumberOfAccomendationStars);
                }
                if (tripInfo.TypeOfGuidance == "Online")
                {
                    GuidenceOrginizer.GetOnlineGuidance();
                }
                else if (tripInfo.TypeOfGuidance == "Offline")
                {
                    GuidenceOrginizer.GetOfflineGuidance();
                }
                if (tripInfo.IsVisaRequred)
                {
                    VisaOrginizer.GetVisa();
                }
            }
Esempio n. 3
0
        public static bool Update(TripInfo tripInfo)
        {
            bool status;

            try
            {
                using (var con = new MySqlConnection(connectionString))
                {
                    string query = "UPDATE tripInfo SET source=@source,destination=@destination,arrDateTime=@arrDateTime,depDateTime=@depDateTime,avalSeats=@avalSeats,fare=@fare" +
                                   "WHERE tId=@tId";
                    MySqlCommand cmd = new MySqlCommand(query, con);

                    cmd.Parameters.Add(new MySqlParameter("@tId", tripInfo.TripId));
                    cmd.Parameters.Add(new MySqlParameter("@source", tripInfo.Source));
                    cmd.Parameters.Add(new MySqlParameter("@destination", tripInfo.Destination));
                    cmd.Parameters.Add(new MySqlParameter("@arrDateTime", tripInfo.ArrivalDateTime));
                    cmd.Parameters.Add(new MySqlParameter("@depDateTime", tripInfo.DepartureDateTime));
                    cmd.Parameters.Add(new MySqlParameter("@avalSeats", tripInfo.AvailableSeats));
                    cmd.Parameters.Add(new MySqlParameter("@fare", tripInfo.Fare));
                    cmd.ExecuteNonQuery();
                    status = true;
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                throw new Exception("Error while connecting with database, please contact site admin for more detail.");
            }

            return(status);
        }
Esempio n. 4
0
 public TripModifier(TripInfo tripInfo, Vector3 collidedProjectilePosition,
                     Vector3 collidedProjectileVelocity, Entity caster, Entity target,
                     Camera camera, SkillId skillId, Environment environment,
                     CollectionOfInteractions modifierInteractionCollection,
                     WallHitConfig whc, float damageScale) : base(tripInfo, collidedProjectilePosition, collidedProjectileVelocity, caster, target, camera, skillId, environment, modifierInteractionCollection, whc, damageScale)
 {
 }
Esempio n. 5
0
 public TicketInfoMessage(TripInfo tripInfo, int seatId, 
     int empId, int clientId, double ticketPrice)
 {
     this.TripInfo = tripInfo;
     this.SeatId = seatId;
     this.EmpId = empId;
     this.ClientId = clientId;
     this.TicketPrice = ticketPrice;
 }
Esempio n. 6
0
        public void RequiredDepartError()
        {
            TripInfo      trip     = TripInfoCreator.SetInvalidInfo();
            TrainListPage mainPage = new MainPage(Driver)
                                     .InputTripInfo(trip)
                                     .ClickSearchButton();

            Assert.AreEqual(mainPage.requiredDepartureDateSign.Displayed, false);
        }
Esempio n. 7
0
 public MainPage SendRequest(TripInfo trip)
 {
     departureStation.SendKeys(trip.departureStation);
     arrivalStation.SendKeys(trip.arrivalStation);
     departureDate.SendKeys(trip.todayDate);
     cancelReturnTripButton.Click();
     sendRequestButton.Click();
     return(this);
 }
Esempio n. 8
0
        //test 2
        public void SameStationError()
        {
            TripInfo sameStationTrip = new TripInfo();

            sameStationTrip.arrivalStation = sameStationTrip.departureStation;
            MainPage mainPage = new MainPage(webDriver).SendRequest(sameStationTrip);

            NUnit.Framework.Assert.AreEqual(errorMessage, mainPage.GetErrorText());
        }
        private void BindBusNo()
        {
            TripController tripController = new TripController();
            TripInfo       tripInfo       = tripController.SelectBusTripID(this.cboTrip.SelectedValue.ToString(), Convert.ToDateTime(this.cboDate.SelectedValue.ToString()), this.cboTime.SelectedValue.ToString());

            this.lblTripID.Text = tripInfo.TripID;
            // this.lblBusID.Text = tripInfo.BusID;
            this.txtBusNo.Text = tripInfo.BusNo;
        }
Esempio n. 10
0
 public MainPage InputTripInfo(TripInfo trip)
 {
     new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until(ExpectedConditions.ElementIsVisible(By.Name("departure")));
     CloseCookieButton.Click();
     departureStation.SendKeys(trip.DepartureStation);
     arrivalStation.SendKeys(trip.ArrivalStation);
     departureDate.SendKeys(trip.DepartureDate + "\n");
     Logger.Log.Info("Input trip info:" + trip.DepartureStation + "/" + trip.ArrivalStation + "/" + trip.DepartureDate);
     return(this);
 }
        private void BindControls()
        {
            TripController tripController = new TripController();
            TripInfo       tripInfo       = tripController.SelectByTripID(this.cboTrip.SelectedValue.ToString());

            string date = Convert.ToString(tripInfo.TripDate);

            this.txtTripDate.Text = date.Substring(0, 10);
            this.txtTime.Text     = (tripInfo.Time);
        }
Esempio n. 12
0
        public void SuccessfulTrainSearch()
        {
            TripInfo      trip     = TripInfoCreator.SetValidInfo();
            TrainListPage mainPage = new MainPage(Driver)
                                     .InputTripInfo(trip)
                                     .PickDateAndTime()
                                     .ClickSearchButton()
                                     .WaitListOfTrains();

            Assert.IsTrue(mainPage.listOfTrains.Displayed);
        }
Esempio n. 13
0
        public async Task <ActionResult> UpdateTripInfo([FromBody] TripInfo data, string username, string tripId)
        {
            try
            {
                if (data != null && username != null && tripId != null)
                {
                    var getTrip = MH.GetSingleObject(tripinfo_collection, "TripId", tripId, null, null).Result;
                    if (getTrip != null)
                    {
                        var delete = await MH.DeleteSingleObject(tripinfo_collection, "TripId", tripId, null, null);

                        var tripData = BsonSerializer.Deserialize <TripInfo>(getTrip);
                        data.Id     = tripData.Id;
                        data.TripId = tripData.TripId;
                        await trip_db.GetCollection <TripInfo>("TripInfo").InsertOneAsync(data);

                        AL.CreateLog(username, "UpdateTripInfo", BsonSerializer.Deserialize <TripInfo>(getTrip), data, activitylog_collection);
                        return(Ok(new ResponseData
                        {
                            Code = "200",
                            Message = "Updated"
                        }));
                    }
                    else
                    {
                        return(BadRequest(new ResponseData
                        {
                            Code = "404",
                            Message = "Trip info not found"
                        }));
                    }
                }
                else
                {
                    return(BadRequest(new ResponseData
                    {
                        Code = "401",
                        Message = "Bad Request"
                    }));
                }
            }
            catch (Exception ex)
            {
                SL.CreateLog("TripController", "UpdateTripInfo", ex.Message);
                return(BadRequest(new ResponseData
                {
                    Code = "400",
                    Message = "Failed",
                    Data = ex.Message
                }));
            }
        }
        private void BindBusNo()
        {
            TripController tripController = new TripController();
            TripInfo       tripInfo       = tripController.SelectBusTripID(this.cboTrip.SelectedValue.ToString(), Convert.ToDateTime(this.cboDate.SelectedValue.ToString()), this.cboTime.SelectedValue.ToString());

            this.lblTripID.Text = tripInfo.TripID;
            // this.lblBusID.Text = tripInfo.BusID;
            this.txtBusNo.Text = tripInfo.BusNo;
            this.txtPrice.Text = Convert.ToString(tripInfo.Price);
            decimal price1 = Convert.ToDecimal(this.txtPrice.Text);

            this.txtPrice.Text = price1.ToString("N");
        }
Esempio n. 15
0
        static void Main(string[] args)
        {
            var tripInfo = new TripInfo()
            {
                TypeOfTransport            = "Air",
                TypeOfAccomondation        = "Apartment",
                TypeOfGuidance             = "Online",
                NumberOfAccomendationStars = 4,
                IsVisaRequred = true
            };

            TripOrginizerFacade.OrginizeTrip(tripInfo);
        }
Esempio n. 16
0
        public void SearchTripsWithReturnOption()
        {
            Logger.InitLogger();
            Driver.Navigate().GoToUrl(URL);
            Logger.Log.Info("Go to " + URL);
            TripInfo      trip          = TripInfoCreator.SetAllProperties();
            OrderTripPage orderTripPage = new MainPage(Driver)
                                          .InputTripInfo(trip)
                                          .InputReturnDate(trip)
                                          .ClickSendRequestButton();

            Assert.AreEqual(orderTripPage.CountOfRoutes(), 2);
            Logger.Log.Info("Test complete successfully");
        }
Esempio n. 17
0
        public void ChooseReservedSeat()
        {
            Logger.InitLogger();
            Driver.Navigate().GoToUrl(URL);
            Logger.Log.Info("Go to " + URL);
            TripInfo     trip         = TripInfoCreator.SetAllProperties();
            CarriagePage carriagePage = new MainPage(Driver)
                                        .InputTripInfo(trip)
                                        .InputReturnDate(trip)
                                        .ClickSendRequestButton()
                                        .ClickSelectCarriageButton();

            Assert.IsFalse(carriagePage.ChooseReservedSeat());
            Logger.Log.Info("Test complete successfully");
        }
Esempio n. 18
0
        public void SearchTrips()
        {
            Logger.InitLogger();
            Driver.Navigate().GoToUrl(URL);
            Logger.Log.Info("Go to " + URL);
            TripInfo      trip          = TripInfoCreator.SetAllProperties();
            OrderTripPage orderTripPage = new MainPage(Driver)
                                          .InputTripInfo(trip)
                                          .CancelReturnTrip()
                                          .ClickSendRequestButton();

            Assert.AreEqual(trip.DepartureStation, orderTripPage.DepartureStationInfo());
            Assert.AreEqual(trip.ArrivalStation, orderTripPage.ArrivalStationInfo());
            Logger.Log.Info("Test complete successfully");
        }
Esempio n. 19
0
        private async Task <List <Route> > FilterRoutesByStops(Stop stop)
        {
            RealTimeDepartureInfo routeInfo = await Parser.GetRealTimeDepartureInfoAsync(stop.ShortName, DirectionMode.Departure, currentTime, currentTime.AddMinutes(120));

            foreach (ActualInfo ai in routeInfo.Actual)
            {
                TripInfo ti = await Parser.GetTripInfoAsync(ai.TripID, DirectionMode.Departure);
            }

            foreach (Route r in routes)
            {
            }

            return(null);
        }
 public override void OnStation(int Station, int NeededStation, Color colorOfStation)
 {
     InTravel       = true;
     CurrentStation = Station;
     NeedStation    = NeededStation;
     StationColor   = colorOfStation;
     if (StationColor == Colors.Green)
     {
         TripInfo.Add(new Tuple <string, int, int, DateTime>("TrolleyBus", Station, NeededStation, DateTime.Now));
     }
     if (StationColor == Colors.Red)
     {
         TripInfo.Add(new Tuple <string, int, int, DateTime>("Tram", Station, NeededStation, DateTime.Now));
     }
     WriteStatistic();
 }
        private void BindTripID()
        {
            TripController tripController = new TripController();
            TripCollection tripCollection = tripController.SelectList();

            TripInfo tripInfo = new TripInfo();

            tripInfo.TripCode = " - Select One - ";
            tripInfo.TripID   = null;
            tripCollection.Insert(0, tripInfo);

            this.cboTrip.DisplayMember = "TripCode";
            this.cboTrip.ValueMember   = "TripID";
            this.cboTrip.DataSource    = tripCollection;
            this.cboTrip.SelectedIndex = 0;
        }
        private void BindTime()
        {
            TripController tripController = new TripController();
            TripCollection tripCollection = tripController.SelectTime(this.cboTrip.SelectedValue.ToString(), Convert.ToDateTime(this.cboDate.SelectedValue.ToString()));

            TripInfo tripInfo = new TripInfo();

            tripInfo.Time   = "-Select One-";
            tripInfo.TimeID = null;
            tripCollection.Insert(0, tripInfo);

            this.cboTime.DisplayMember = "Time";
            this.cboTime.ValueMember   = "TimeID";
            this.cboTime.DataSource    = tripCollection;
            this.cboTime.SelectedIndex = 0;
        }
        public void WriteStatistic()
        {
            if (TripInfo.Count > 2)
            {
                TripInfo.RemoveAt(TripInfo.Count - 2);
            }
            ((MainWindow)System.Windows.Application.Current.MainWindow).textBox.Text = " ";
            foreach (var VARIABLE in TripInfo)
            {
                ((MainWindow)System.Windows.Application.Current.MainWindow).textBox.Text += VARIABLE.Item1 + " ";
                ((MainWindow)System.Windows.Application.Current.MainWindow).textBox.Text += VARIABLE.Item2 + " ";
                ((MainWindow)System.Windows.Application.Current.MainWindow).textBox.Text += VARIABLE.Item3 + " ";

                ((MainWindow)System.Windows.Application.Current.MainWindow).textBox.Text += VARIABLE.Item4.ToString("HH:mm:ss") + "\n";
            }
        }
        private void BindToTripCode()
        {
            TripController tripController = new TripController();
            TripCollection tripCollection = tripController.SelectListRecord();

            TripInfo info = new TripInfo();

            info.TripCode = " - Select One - ";
            info.TripID   = null;
            tripCollection.Insert(0, info);

            cboToTripCode.DisplayMember = "TripCode";
            cboToTripCode.ValueMember   = "TripID";
            cboToTripCode.DataSource    = tripCollection;

            cboToTripCode.SelectedIndex = 0;
        }
        private void BindAvailableSeat()
        {
            TripInfo             tripInfo   = new TripInfo();
            TripDetailController controller = new TripDetailController();
            TripDetailCollection collection = controller.SelectDetailByTripID(lblTripID.Text);

            int a = 0;

            for (int i = 0; i < collection.Count; i++)
            {
                if (collection[i].Status == "A")
                {
                    a++;
                }
            }
            txtAvailableSeats.Text = Convert.ToString(a);
        }
Esempio n. 26
0
        public static List <TripInfo> GetListByDateSourceDest(string Source, string Destination, DateTime ArrivalDateTime)
        {
            List <TripInfo> tripInfos = new List <TripInfo>();

            try
            {
                using (var con = new MySqlConnection(connectionString))
                {
                    string       query = "SELECT * FROM tripInfo WHERE source=@Source AND destination=@Destination AND arrDateTime=@ArrivalDateTime";
                    MySqlCommand cmd   = new MySqlCommand(query, con);

                    MySqlDataReader reader = cmd.ExecuteReader();
                    if (reader != null)
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                TripInfo tripInfo = new TripInfo()
                                {
                                    TripId            = int.Parse(reader["tId"].ToString()),
                                    Source            = reader["source"].ToString(),
                                    Destination       = reader["destination"].ToString(),
                                    ArrivalDateTime   = DateTime.Parse(reader["arrDateTime"].ToString()),
                                    DepartureDateTime = DateTime.Parse(reader["depDateTime"].ToString()),
                                    AvailableSeats    = int.Parse(reader["avalSeats"].ToString()),
                                    Fare = decimal.Parse(reader["fare"].ToString())
                                };
                                tripInfos.Add(tripInfo);
                            }
                            reader.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                throw new Exception("Error while connecting with database, please contact site admin for more detail.");
            }

            return(tripInfos);
        }
Esempio n. 27
0
        private void BindTripComboBox()
        {
            TripController tripController = new TripController();
            TripInfo       tripInfo       = tripController.SelectByTripID(this.cboTripCode.SelectedValue.ToString());

            this.cboTripCode.SelectedValue = tripInfo.TripID;
            this.cboRoute.SelectedValue    = tripInfo.RouteID;
            this.dtpDate.Text          = Convert.ToString(tripInfo.TripDate);
            this.cboTime.SelectedValue = tripInfo.TimeID;
            this.txtPrice.Text         = Convert.ToString(tripInfo.Price);
            decimal price = Convert.ToDecimal(this.txtPrice.Text);

            this.txtPrice.Text = price.ToString("N");
            this.cboBusNumber.SelectedValue = tripInfo.BusID;
            string seat = tripController.SelectTotalSeat(this.cboBusNumber.SelectedValue.ToString());

            this.txtTotalSeat.Text        = seat;
            this.cboDriver1.SelectedValue = tripInfo.Driver1ID;
            this.cboDriver2.SelectedValue = tripInfo.Driver2ID;
        }
Esempio n. 28
0
        public override void Load(StreamReader sw)
        {
            name     = sw.ReadLine();
            years    = Convert.ToInt32(sw.ReadLine());
            x        = Convert.ToInt32(sw.ReadLine());
            y        = Convert.ToInt32(sw.ReadLine());
            active   = Convert.ToBoolean(sw.ReadLine());
            InTravel = Convert.ToBoolean(sw.ReadLine());
            if (InTravel == true)
            {
                InTravel       = Convert.ToBoolean(sw.ReadLine());
                InTransport    = Convert.ToBoolean(sw.ReadLine());
                CurrentStation = Convert.ToInt32(sw.ReadLine());
                NeedStation    = Convert.ToInt32(sw.ReadLine());
                int stStationColor = Convert.ToInt32(sw.ReadLine());
                if (stStationColor == 1)
                {
                    StationColor = Colors.Green;
                }
                if (stStationColor == 2)
                {
                    StationColor = Colors.Red;
                }
            }
            else
            {
                MotionStyle = Convert.ToInt32(sw.ReadLine());
            }
            int k = Convert.ToInt32(sw.ReadLine());

            for (int i = 0; i < k; i++)
            {
                String[] words = sw.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                TripInfo.Add(new Tuple <string, int, int, DateTime>(words[0], Convert.ToInt32(words[1]), Convert.ToInt32(words[2]), Convert.ToDateTime(words[3])));
            }
            cash = Convert.ToDouble(sw.ReadLine());
            TypeOfPreferential = sw.ReadLine();
            WriteStatistic2();
        }
Esempio n. 29
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="data"></param>
 /// <param name="collection"></param>
 /// <returns></returns>
 public static dynamic InsertNewTripInfo(TripInfo data, IMongoCollection <TripInfo> collection)
 {
     try
     {
         #region Create index
         //collection.Indexes.CreateOne("{ TripId: " + data.TripId + " }");
         #endregion
         collection.InsertOne(data);
         return(true);
     }
     catch (Exception ex)
     {
         if (ex.Message.Contains("duplicate key error"))
         {
             return(ex.Message);
         }
         else
         {
             SL.CreateLog("MongoHelper", "InsertNewTripInfo", ex.Message);
             return(false);
         }
     }
 }
Esempio n. 30
0
    public void LoadTripInfoData(System.Action dataLoadedCallback)
    {
        System.Action <CSVLineDataHandler> lineProcessor = delegate(CSVLineDataHandler lineComponents) {
                        #if UNITY_EDITOR
            try
                        #endif
            {
                //                int routeId = int.Parse(lineComponents[1]);
                string routeId = lineComponents["route_id"];

                if (!this.tripInfosByRouteId.ContainsKey(routeId))
                {
                    this.tripInfosByRouteId.Add(routeId, new List <TripInfo>(150));
                }

                TripInfo newTripInfo = new TripInfo();
                newTripInfo.bikesAllowed         = int.Parse(lineComponents["bikes_allowed"]);
                newTripInfo.routeId              = routeId;
                newTripInfo.wheelchairAccessible = int.Parse(lineComponents["wheelchair_accessible"]);
                newTripInfo.directionId          = int.Parse(lineComponents["direction_id"]);
                newTripInfo.tripHeadSign         = lineComponents["trip_headsign"];
                newTripInfo.serviceId            = lineComponents["service_id"];
                newTripInfo.shapeId              = lineComponents["shape_id"];
                newTripInfo.tripId = lineComponents["trip_id"];

                this.tripInfosByRouteId[routeId].Add(newTripInfo);
            }
                        #if UNITY_EDITOR
            catch (System.Exception e) {
                Debug.LogError("Encoutnered error: " + e.ToString() + " on tripId: " + lineComponents["trip_id"]);
            }
                        #endif
        };

        this.ProcessCSVData(this.tripsTextData.text, lineProcessor, 8, dataLoadedCallback);
    }
Esempio n. 31
0
 public TripInfoMessage(TripInfo currentTripInfo)
 {
     this.CurrentTripInfo = currentTripInfo;
 }
Esempio n. 32
0
        public void BindSeat()
        {
            TripInfo             tripInfo            = new TripInfo();
            string               TripID              = Convert.ToString(tripInfo.TripID);
            TripDetailController tripDetailContoller = new TripDetailController();
            TripDetailCollection collections         = tripDetailContoller.SelectDetailByTripID(lblGetTripID.Text);

            pnlSeat.Controls.Clear();

            int backSeat       = collections.Count - 5;
            int backSeatNumber = (collections.Count % 2);

            for (int i = 0, x = 0, y = 0; i < collections.Count; i++)
            {
                Label lbl = new Label();

                if (collections[i].Status == "A")
                {
                    if (!string.IsNullOrEmpty(lblSeatSelectList.Text))
                    {
                        string[] arr = lblSeatSelectList.Text.Split(',');
                        string   no  = "";
                        for (int j = 0; j < arr.Length; j++)
                        {
                            no = arr[j];
                            if (no.Contains(collections[i].SeatNo))
                            {
                                lbl.Image = global::BTS.UI.Properties.Resources.sbs4;
                                lbl.Name  = "lbl" + Convert.ToString(i);


                                break;
                            }
                            else
                            {
                                lbl.Image = global::BTS.UI.Properties.Resources.sa1;
                                lbl.Name  = "Xlbl" + Convert.ToString(i);
                            }
                        }
                    }
                    else
                    {
                        lbl.Image = global::BTS.UI.Properties.Resources.sa1;
                        lbl.Name  = "Xlbl" + Convert.ToString(i);
                    }
                }
                else
                {
                    if (collections[i].Status == "S")
                    {
                        lbl.Image = global::BTS.UI.Properties.Resources.ss2;
                    }
                    else
                    {
                        lbl.Image = global::BTS.UI.Properties.Resources.sb3;
                    }
                }


                if (i >= backSeat && backSeatNumber != 0)
                {
                    lbl.Location    = new System.Drawing.Point(x, (41 * y));
                    lbl.AutoSize    = false;
                    lbl.BorderStyle = System.Windows.Forms.BorderStyle.None;
                    lbl.Size        = new System.Drawing.Size(40, 40);
                    lbl.Text        = Convert.ToString(Convert.ToInt32(i + 1));
                    lbl.Name        = "Xlbl" + Convert.ToString(i);
                    lbl.TextAlign   = System.Drawing.ContentAlignment.MiddleCenter;
                    lbl.TabIndex    = 1;
                    lbl.TabStop     = false;
                    if (collections[i].Status == "A")
                    {
                        lbl.MouseClick += new System.Windows.Forms.MouseEventHandler(this.lblSeat_MouseClick);
                    }
                    pnlSeat.Controls.Add(lbl);
                    y++;

                    if (y == 5)
                    {
                        y = 0;
                        x = x + 45;
                    }
                }
                else
                {
                    if (y == 2 || y == 3 || y == 4)
                    {
                        lbl.Location = new System.Drawing.Point(x, (46 * y) + 25);
                    }
                    else
                    {
                        lbl.Location = new System.Drawing.Point(x, (46 * y));
                    }
                    lbl.AutoSize    = false;
                    lbl.BorderStyle = System.Windows.Forms.BorderStyle.None;
                    lbl.Size        = new System.Drawing.Size(40, 40);
                    if (i < 9)
                    {
                        lbl.Text = "0" + Convert.ToString(Convert.ToInt32(i + 1));
                    }
                    else
                    {
                        lbl.Text = Convert.ToString(Convert.ToInt32(i + 1));
                    }

                    lbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                    lbl.TabIndex  = 1;
                    lbl.TabStop   = false;
                    if (collections[i].Status == "A")
                    {
                        lbl.MouseClick += new System.Windows.Forms.MouseEventHandler(this.lblSeat_MouseClick);
                    }
                    pnlSeat.Controls.Add(lbl);
                    y++;

                    if (y == 4)
                    {
                        y = 0;
                        x = x + 45;
                    }
                }
            }
        }
Esempio n. 33
0
        public SeatSetViewModel()
        {
            _berth = new List<WagonSeatsSet>();
            _coupe = new List<WagonSeatsSet>();
            _lux = new List<WagonSeatsSet>();

            CurrentBerth = new WagonSeatsSet();
            CurrentCoupe = new WagonSeatsSet();
            CurrentLux = new WagonSeatsSet();

            _berthSeatsVisibility = new ObservableRangeCollection<String>();
            _coupeSeatsVisibility = new ObservableRangeCollection<String>();
            _luxSeatsVisibility = new ObservableRangeCollection<String>();

            SelectSeatCmd = new RelayCommand<object>(this.SelectSeat);
            NextWagonCmd = new RelayCommand(() => NextWagon());
            PrevWagonCmd = new RelayCommand(() => PrevWagon());
            ClientInfoInputCmd = new RelayCommand(() => ClientInfoInput());

            Messenger.Default.Register<TripInfoMessage>(this, (msg) =>
            {
                this._tripInfo = msg.CurrentTripInfo;
                SetTrainInfo();
                SetCurrentTripInfo();
            });
        }