コード例 #1
0
ファイル: Car.cs プロジェクト: MrYandersen/OOP_KProject
 public override void WriteXml(XmlWriter writer)
 {
     base.WriteXml(writer);
     writer.WriteAttributeString("PassangersCount", PassangersCount.ToString());
     writer.WriteAttributeString("SeatsCount", SeatsCount.ToString());
     writer.WriteAttributeString("EmptyMaxSpeed", EmptyMaxSpeed.ToString());
 }
コード例 #2
0
        public override string ToString()
        {
            string retVal = Name + " кресел " + SeatsCount.ToString();

            if (IsProjector)
            {
                retVal += " проектор есть";
            }
            if (IsMarkerBoard)
            {
                retVal += " доска есть";
            }
            return(retVal);
        }
コード例 #3
0
        /// <summary>
        /// Locks seats
        /// </summary>
        private void LockSeats(Spot[] spots)
        {
            List <Seat> seats = new List <Seat>();

            foreach (Spot spot in spots)
            {
                Seat seat = new Seat();
                seat.Id          = spot.Id;
                seat.ReserveDate = ReserveDate;
                seats.Add(seat);
            }

            List <Seat> lockedSeats = Data.Access.LockSeats(seats);

            if (lockedSeats != null)
            {
                HashSet <int> writerIds = new HashSet <int>(lockedSeats.Select(x => x.Id));
                seats.RemoveAll(x => writerIds.Contains(x.Id));

                foreach (Seat s in seats)
                {
                    SelectedSpots.Remove(SelectedSpots.Single(i => i.Id == s.Id));
                    Spots.Remove(Spots.Single(i => i.Id == s.Id));
                }

                int     counter = 0;
                decimal price   = 0;
                foreach (Spot spot in SelectedSpots)
                {
                    counter++;
                    price      += spot.Price;
                    spot.ItemId = counter;
                }
                StatusText      = String.Format("Удерживается {0} мест на сумму {1}", SeatsCount.ToString("### ##0"), SeatsAmount.ToString("C0"));
                OperationResult = String.Format("Выбрано мест {0} на сумму {1}", counter, price.ToString("C"));
            }
        }