Пример #1
0
 public SpinLock(bool enableThreadOwnerTracking)
 {
     this.isThreadOwnerTrackingEnabled = enableThreadOwnerTracking;
     this.threadWhoTookLock = 0;
     this.ticket = new TicketType ();
     this.stallTickets = null;
 }
Пример #2
0
        /// <summary>
        ///  Adds the tickets specified to the tickets List, if the number of tickets exceeds the booking.LIMIT value then an exception is thrown.
        /// </summary>
        /// <param name="fee">The booking fee.</param>
        /// <param name="number">The number of tickets to be booked.</param>
        /// <param name="type">The type of ticket to be added.</param>
        public void AddTickets(int number, TicketType type, decimal fee)
        {
            if (tickets.Count < Booking.LIMIT) {
                if (type == TicketType.Adult) {
                    for (int i = 0; i < number; i++) {
                        AdultTicket newTicket = new AdultTicket(show.Title, fee);
                        tickets.Add(newTicket);
                    }
                }

                else if (type == TicketType.Child) {
                    for (int i = 0; i < number; i++) {
                        ChildTicket newTicket = new ChildTicket(show.Title);
                        tickets.Add(newTicket);
                    }
                }
                else if (type == TicketType.Family) {
                    for (int i = 0; i < number; i++) {
                        FamilyTicket newTicket = new FamilyTicket(show.Title, fee);
                        tickets.Add(newTicket);
                    }
                }
            }
            else {
                throw new BookingException(this.BookingID);
            }
        }
Пример #3
0
 protected Ticket(string startingPoint, string destination, DateTime date, decimal price, TicketType ticketType)
 {
     this.FromTo = startingPoint + "; " + destination;
     this.DateAndTime = date;
     this.Price = price;
     this.Type = ticketType;
 }
 protected Ticket(IPerformance performance, TicketType type)
 {
     this.Performance = performance;
     this.Price = this.CalculatePrice();
     this.status = TicketStatus.Unsold;
     this.Type = type;
 }
Пример #5
0
 protected Ticket(TicketType ticketType, string from, string to, DateTime dateAndTime, decimal price)
 {
     this.Type = ticketType;
     this.From = from;
     this.To = to;
     this.DateAndTime = dateAndTime;
     this.Price = price;
 }
Пример #6
0
 public Ticket(int? clientId, string title, string description, TicketType type)
 {
     this.ClientId = clientId;
     this.Title = title;
     this.Description = description;
     this.TicketType = type;
     this.CreationDate = DateTime.UtcNow;
     this.Priority = 0;
 }
Пример #7
0
 public double GetTicketCost(TicketType ticketType, bool isMatinee)
 {
     switch (ticketType)
     {
         case TicketType.Adult: return isMatinee ? priceAdultMatinee : priceAdultEvening;
         case TicketType.Child: return isMatinee ? priceChildMatinee : priceChildEvening;
         case TicketType.Senior: return isMatinee ? priceSeniorMatinee : priceSeniorEvening;
         default: return 0;
     }
 }
Пример #8
0
		public Ticket(Character chr, string message, TicketType type)
		{
			m_owner = chr;
			m_ownerName = chr.Name;
			m_charId = chr.EntityId.Low;
			m_Message = message;
			m_region = chr.Region;
			m_position = chr.Position;
			m_Timestamp = DateTime.Now;
			m_Type = type;
		}
Пример #9
0
 public ActionResult EditTicketType(TicketType model, string returnUrl)
 {
     if (model.ID == 0)
         db.TicketType.Add(model);
     else
     {
         db.Entry(model).State = System.Data.Entity.EntityState.Modified;
     }
     db.SaveChanges();
     if (returnUrl == null) return RedirectToAction("ListTicketType"); else return Redirect(returnUrl);
 }
Пример #10
0
 public int GetTicketsCount(TicketType type)
 {
     if (!this.ticketsCount.ContainsKey(type))
     {
         throw new InvalidOperationException("Invalid ticket type");
     }
     else
     {
         return this.ticketsCount[type];
     }
 }
Пример #11
0
        public static Ticket CreateSwiftCar(TicketType type, Movie movie)
        {
            Ticket ticket = null;

            switch (type)
            {//TODO normal ticket and fix price
                case TicketType.KIDS: ticket = new KidsTicket(movie, 5);
                    break;
                case TicketType.STUDENT: ticket = new StudentsTicket(movie, 6);
                    break;
            }
            return ticket;
        }
 public TicketingViewModel()
 {
     TicketTypeList = TicketType.GetTicketTypes();
     TicketList = Ticket.GetTickets();
     FormTicket = new Ticket();
     FormTicketType = new TicketType();
     TicketTypeIndex = 0;
     TypeHeight = 0;
     ZoekHeight = 0;
     AddHeight = 0;
     CloseVis = "Hidden";
     CloseTypeVis = "Hidden";
 }
        // GET: TicketTypes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TicketType ticketType = TicketTypeHelper.GetTicketType(id);

            if (ticketType == null)
            {
                return(HttpNotFound());
            }
            return(View(ticketType));
        }
Пример #14
0
        public bool SaveTicketType(TicketType ticketType)
        {
            if (ticketType.TicketTypeId > 0)
            {
                ticketTypeRepository.Update(ticketType);
            }
            else
            {
                ticketTypeRepository.Add(ticketType);
            }

            ticketTypeRepository.SaveChanges();
            return(true);
        }
Пример #15
0
        public ActionResult Index(TicketType type)
        {
            var model = new SubModel()
            {
                Name   = type == TicketType.Single ? "天门山国家森林公园登山成人票" : "天门山国家森林公园登山门票+往返观光车成人票",
                Price  = type == TicketType.Single ? 50 : 80,
                Count  = 1,
                Total  = type == TicketType.Single ? 50 : 80,
                Type   = type,
                UserId = this.currentUser.UserId
            };

            return(View(model));
        }
Пример #16
0
        // GET: TicketTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Oops5", "Home", null));
            }
            TicketType ticketType = db.TicketTypes.Find(id);

            if (ticketType == null)
            {
                return(RedirectToAction("Oops5", "Home", null));
            }
            return(View(ticketType));
        }
Пример #17
0
        public ActionResult DeleteConfirmed(int id)
        {
            TicketType ticketType = db.TicketTypes.Find(id);

            db.TicketTypes.Remove(ticketType);

            var userr = User.Identity.GetUserId();

            if (!rolesHelper.IsDemoUser(userr))
            {
                db.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
Пример #18
0
        public int GetTicketsCount(TicketType type)
        {
            if (type == TicketType.Flight)
            {
                return this.airTicketsCount;
            }

            if (type == TicketType.Bus)
            {
                return this.busTicketsCount;
            }

            return this.trainTicketsCount;
        }
Пример #19
0
 public Ticket(
     TicketType type,
     string from,
     string to,
     DateTime dateAndTime,
     decimal price)
 {
     // TODO: Add validations if needed
     this.Type        = type;
     this.From        = from;
     this.To          = to;
     this.DateAndTime = dateAndTime;
     this.Price       = price;
 }
Пример #20
0
        // GET: TicketTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TicketType ticketType = db.TicketTypes.Find(id);

            if (ticketType == null)
            {
                return(HttpNotFound());
            }
            return(View(ticketType));
        }
Пример #21
0
        public async Task <IActionResult> Create([Bind("TicketTypeId,TicketTypeName,ActiveDayCount,TotalCheckinLimit,DailyCheckInLimit,StartHour,EndHour,ActiveDays,ActiveMonday,ActiveTuesday,ActiveWednesday,ActiveThursday,ActiveFriday,ActiveSaturday,ActiveSunday,Price")] TicketType ticketType)
        {
            ticketType.InsertedAt = DateTime.Now;
            ticketType.InsertedBy = User.FindFirstValue(ClaimTypes.NameIdentifier);
            User.FindFirstValue(ClaimTypes.Name);
            if (ModelState.IsValid)
            {
                _context.Add(ticketType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ticketType));
        }
Пример #22
0
        private void NewTicketType()
        {
            TicketType tt = new TicketType();

            tt.Name             = _selectedTicketType.Name;
            tt.Price            = _selectedTicketType.Price;
            tt.AvailableTickets = _selectedTicketType.AvailableTickets;

            TicketType.InsertTicketType(tt);
            MessageBox.Show("de nieuwe ticket " + _selectedTicketType.Name + " is toegevoegd");

            _tickettypes = TicketType.GetTicketTypes();
            OnPropertyChanged("TicketTypes");
        }
        public IActionResult Detail(int Id)
        {
            TicketType tt    = _repo.GetByID(Id);
            var        model = new DetailTicketTypeVM
            {
                Id          = tt.ID,
                Name        = tt.Name,
                Description = tt.Description,
                Price       = tt.Price,
                TicketsSold = _repo.GetNumberOfTicketsBought(tt.ID)
            };

            return(View(model));
        }
        public IActionResult Edit(int Id)
        {
            TicketType tt    = _repo.GetByID(Id);
            var        model = new EditTicketTypeVM
            {
                Id          = tt.ID,
                Name        = tt.Name,
                Price       = tt.Price,
                Description = tt.Description,
                Tier        = tt.Tier
            };

            return(View(model));
        }
        public int GetTicketsCount(TicketType type)
        {
            if (type == TicketType.Flight)
            {
                return(this.airTicketsCount);
            }

            if (type == TicketType.Bus)
            {
                return(this.busTicketsCount);
            }

            return(this.trainTicketsCount);
        }
Пример #26
0
        public BaseLottoTicket(Mobile owner, TicketType type, bool quickScratch) : base(0x0FF3)
        {
            m_Type       = type;
            m_Owner      = owner;
            m_CashedOut  = false;
            m_Payout     = 0;
            m_Checked    = false;
            m_FreeTicket = false;

            if (quickScratch)
            {
                DoQuickScratch();
            }
        }
Пример #27
0
        public ActionResult Create([Bind(Include = "Id,Name")] TicketType ticketType)
        {
            var nHelper = new UserNotificationsHelper();

            ViewBag.Notifications = nHelper.filterNotifications(User.Identity.GetUserId());
            if (ModelState.IsValid)
            {
                db.TicketTypes.Add(ticketType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ticketType));
        }
Пример #28
0
 private Ticket(YearId primaryKey, int?orderId, TicketType type, int partyId, int seatingId, int serverId,
                int customerId, DateTime createTime,
                DateTime?startTime, DateTime?prepareTime, DateTime?readyTime, DateTime?closeTime,
                string managerNote, bool isCanceled, string taxExemptId)
     : this(primaryKey, orderId, type, partyId, seatingId, serverId, customerId, createTime, taxExemptId)
 {
     ManagerNote     = managerNote;
     IsCanceled      = isCanceled;
     StartTime       = startTime;
     PrepareTime     = prepareTime;
     ReadyTime       = readyTime;
     CloseTime       = closeTime;
     IsBeingModified = false;
 }
 /// <summary>
 /// find  where to park the vehicle according to the ticket type and where there's a free lot
 /// </summary>
 /// <param name="v">vehicle to parking</param>
 /// <param name="ticketType"></param>
 /// <returns></returns>
 public void ParkVehicle(Vehicle v, TicketType ticketType, ref int lot)
 {
     for (int i = ticketType.MinLotRange - 1; i < ticketType.MaxLotRange; i++)
     {
         Lot curLot = Lots[i];
         if (curLot.IsFree())
         {
             curLot.ParkVehicle(v);
             OccupiedLots[v.LicensePlate] = curLot;
             lot = curLot.LotNumber;
             break;
         }
     }
 }
Пример #30
0
        public Ticket OrderTicket(TicketType type, int money)
        {
            TicketFactory factory;

            if (money < 1000)
            {
                factory = new StateFactory();
            }
            else
            {
                factory = new CommertcialFactory();
            }
            return(factory.CreateTicket(type));
        }
Пример #31
0
        public ActionResult Create([Bind(Include = "Id,TypeName,Description")] TicketType ticketType)
        {
            if (ModelState.IsValid)
            {
                db.TicketTypes.Add(ticketType);
                if (!roleHelper.IsUserDemo())
                {
                    db.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }

            return(View(ticketType));
        }
Пример #32
0
        public Ticket(Character chr, string message, TicketType type)
        {
            m_owner     = chr;
            m_ownerName = chr.Name;
            m_charId    = chr.EntityId.Low;
            m_Message   = message;

            m_Map    = chr.Map;
            Position = chr.Position;
            Phase    = chr.Phase;

            m_Timestamp = DateTime.Now;
            m_Type      = type;
        }
Пример #33
0
        public Ticket Update(int id, string title, TicketType type, TicketState state, TicketPriority priority, int locationId)
        {
            var ticket = this.BaseRepository.GetById(id);

            ticket.Title      = title;
            ticket.Type       = type;
            ticket.State      = state;
            ticket.Priority   = priority;
            ticket.LocationId = locationId;

            this.BaseRepository.SaveChanges();

            return(ticket);
        }
Пример #34
0
 public Ticket(
     DateTime _departure
     , DateTime _arrivalDate
     , String _numberOfAirplane
     , String _arrivalContry
     , TicketType _type
     )
 {
     this.Departure        = _departure;
     this.ArrivalDate      = _arrivalDate;
     this.NumberOfAirplane = _numberOfAirplane;
     this.ArrivalCountry   = _arrivalContry;
     this.Type             = _type;
     this.Reserved         = false;
 }
Пример #35
0
 public static Ticket createTicket(
     DateTime _departure
     , DateTime _arrival
     , TicketType _type = TicketType.BusinessClass
     )
 {
     return
         (new Ticket(
              _departure
              , _arrival
              , "test_flight"
              , "UA"
              , _type
              ));
 }
Пример #36
0
        public static string GetGameType(TicketType type)
        {
            switch (type)
            {
            default: return("");

            case TicketType.GoldenTicket: return("Golden Ticket");

            case TicketType.CrazedCrafting: return("Crazed Crafting");

            case TicketType.SkiesTheLimit: return("Skies the Limit");

            case TicketType.Powerball: return("Powerball");
            }
        }
Пример #37
0
        public ActionResult Edit([Bind(Include = "Id,TicketId,TypeName,Description")] TicketType ticketType)
        {
            if (ModelState.IsValid)
            {
                db.Entry(ticketType).State = EntityState.Modified;

                var userr = User.Identity.GetUserId();
                if (!rolesHelper.IsDemoUser(userr))
                {
                    db.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            return(View(ticketType));
        }
Пример #38
0
        public TicketType Update(TicketType ticketType)
        {
            using (var model = new gb_ts_stagingEntities())
            {
                var recordToEdit = model.tic_TicketTypes.First(rec => rec.Id == ticketType.Id);
                recordToEdit.UpdatedBy  = "Admin";
                recordToEdit.LastUpdate = DateTime.Now;
                recordToEdit.IconId     = ticketType.Icon.Id;
                recordToEdit.Name       = ticketType.Name;

                model.SaveChanges();

                return(ticketType);
            }
        }
Пример #39
0
        private void DeleteTicketType()
        {
            TicketType tt = new TicketType();

            tt.Name             = _selectedTicketType.Name;
            tt.Price            = _selectedTicketType.Price;
            tt.AvailableTickets = _selectedTicketType.AvailableTickets;

            TicketType.DeleteTicketType(tt);
            MessageBox.Show("De ticket " + _selectedTicketType.Name + "is verwijderd");
            MessageBox.Show("Indien er hier tickets mee gemaakt zijn, zijn deze niet meer geldig");

            _tickettypes = TicketType.GetTicketTypes();
            OnPropertyChanged("TicketTypes");
        }
Пример #40
0
        private void AddReservation()
        {
            TicketType type = null;

            if (TicketTypes.Count() > 0)
            {
                type = TicketTypes.First();
            }
            Tickets.Add(new Ticket()
            {
                Amount       = 1,
                TicketHolder = "Nieuwe koper",
                Type         = type
            });
        }
Пример #41
0
    public int GetTicketsCount(TicketType type)
    {
        if (type == TicketType.Air)
        {
            return(airTicketsCount);
        }



        if (type == TicketType.Bus)
        {
            return(busTicketsCount);
        }
        return(trainTicketsCount);
    }
Пример #42
0
		public decimal GetTicketPrice(TicketType ticketType)
		{
			decimal ticketPrice = 600;
			switch (ticketType)
			{
				case TicketType.EarlyBird:
					ticketPrice = 500;
					break;
				case TicketType.Educational:
					ticketPrice = 300;
					break;
			}

			return ticketPrice;
		}
Пример #43
0
        private void EditTicketType()
        {
            TicketType tt = new TicketType();

            tt.ID               = _selectedTicketType.ID;
            tt.Name             = _selectedTicketType.Name;
            tt.Price            = _selectedTicketType.Price;
            tt.AvailableTickets = _selectedTicketType.AvailableTickets;

            TicketType.UpdateTicketType(tt);

            MessageBox.Show("De instellingen voor " + _selectedTicketType.Name + " zijn aangepast");
            _tickettypes = TicketType.GetTicketTypes();
            OnPropertyChanged("TicketTypes");
        }
Пример #44
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TicketType = await _context.TicketType.SingleOrDefaultAsync(m => m.Id == id);

            if (TicketType == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public static List<TicketType> GetTicketTypes()
        {
            List<TicketType> ticketTypes = new List<TicketType>();
            try
            {
                // Get data
                DbDataReader reader = Database.GetData("SELECT * FROM tickettype");
                foreach (DbDataRecord record in reader)
                {
                    // Create new TicketType
                    TicketType type = new TicketType();

                    // Get ID
                    if (DBNull.Value.Equals(record["ID"])) type.ID = -1;
                    else type.ID = Convert.ToInt32(record["ID"]);

                    // Get Name
                    if (DBNull.Value.Equals(record["Name"])) type.Name = "";
                    else type.Name = record["Name"].ToString();

                    // Get Price
                    if (DBNull.Value.Equals(record["Price"])) type.Price = -1;
                    else type.Price = Convert.ToDouble(record["Price"].ToString());

                    // Get AvailableTickets
                    if (DBNull.Value.Equals(record["AvailableTickets"])) type.AvailableTickets = -1;
                    else type.AvailableTickets = Convert.ToInt32(record["AvailableTickets"].ToString());

                    // Get TicketsLeft
                    if (DBNull.Value.Equals(record["TicketsLeft"])) type.TicketsLeft = -1;
                    else type.TicketsLeft = Convert.ToInt32(record["TicketsLeft"].ToString());

                    // Add TicketType
                    ticketTypes.Add(type);
                }
                reader.Close();
                return ticketTypes;
            }

            // Fail
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);

                return null;
            }
        }
        public static TicketType GetTicketType(int ID)
        {
            try
            {
                // Create new TicketType
                TicketType type = new TicketType();

                // Get data
                DbParameter param = Database.AddParameter("@id", ID);
                DbDataReader reader = Database.GetData("SELECT * FROM tickettype WHERE ID = @id", param);
                foreach (DbDataRecord record in reader)
                {
                    // Get ID
                    if (DBNull.Value.Equals(record["ID"])) type.ID = -1;
                    else type.ID = Convert.ToInt32(record["ID"]);

                    // Get Name
                    if (DBNull.Value.Equals(record["Name"])) type.Name = "";
                    else type.Name = record["Name"].ToString();

                    // Get Price
                    if (DBNull.Value.Equals(record["Price"])) type.Price = -1;
                    else type.Price = Convert.ToDouble(record["Price"].ToString());

                    // Get AvailableTickets
                    if (DBNull.Value.Equals(record["AvailableTickets"])) type.AvailableTickets = -1;
                    else type.AvailableTickets = Convert.ToInt32(record["AvailableTickets"].ToString());

                    // Get TicketsLeft
                    if (DBNull.Value.Equals(record["TicketsLeft"])) type.TicketsLeft = -1;
                    else type.TicketsLeft = Convert.ToInt32(record["TicketsLeft"].ToString());

                }
                reader.Close();
                return type;
            }

            // Fail
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);

                return null;
            }
        }
        private void TicketTypesComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if(!IsUpdating)
            {
                selectedTicketType = (TicketType)TicketTypesComboBox.SelectedItem;
                List<Ticket> ticketsByType = new List<Ticket>();

                foreach (var item in ticketsArray)
                {
                    if (item.TicketTypeId == selectedTicketType.Id)
                    {
                        ticketsByType.Add(item);
                    }
                }

                TicketsListBox.ItemsSource = ticketsByType;
            }
        }
Пример #48
0
        internal Ticket(PeygirDatabaseDataSet.TicketsRow row)
        {
            if (row == null)
            {
                throw new ArgumentNullException("row");
            }

            ID = row.ID;
            milestoneID = row.MilestoneID;
            ticketNumber = row.TicketNumber;
            summary = row.Summary;
            reportedBy = row.ReportedBy;
            type = (TicketType)row.Type;
            severity = (TicketSeverity)row.Severity;
            state = (TicketState)row.State;
            assignedTo = row.AssignedTo;
            priority = (TicketPriority)row.Priority;
            description = row.Description;
        }
Пример #49
0
        public int GetTicketsCount(TicketType ticketType)
        {
            int countOfTickets;
            switch (ticketType)
            {
                case TicketType.Air:
                    countOfTickets = this.AirTicketsCount;
                    break;
                case TicketType.Bus:
                    countOfTickets = this.BusTicketsCount;
                    break;
                case TicketType.Train:
                    countOfTickets = this.TrainTicketsCount;
                    break;
                default:
                    throw new ArgumentException("Non existing ticket type has been used", "ticketType");
            }

            return countOfTickets;
        }
Пример #50
0
        public Ticket(int projectID, int milestoneID)
        {
            if (projectID == InvalidID)
            {
                string message = Resources.String_InvalidProjectID;
                throw new ArgumentException(message, "projectID");
            }
            if (milestoneID == InvalidID)
            {
                string message = Resources.String_InvalidMilestoneID;
                throw new ArgumentException(message, "milestoneID");
            }

            this.milestoneID = milestoneID;
            ticketNumber = 0;
            summary = string.Empty;
            reportedBy = string.Empty;
            type = (TicketType)(-1);
            severity = (TicketSeverity)(-1);
            state = (TicketState)(-1);
            assignedTo = string.Empty;
            priority = (TicketPriority)(-1);
            description = string.Empty;

            // Find max ticket number.
            TicketsTableAdapter tableAdapter = Database.TicketsTableAdapter;
            int? maxTicketNumber = tableAdapter.GetMaxTicketNumber(projectID);
            if (maxTicketNumber.HasValue)
            {
                ticketNumber = maxTicketNumber.Value + 1;
            }
            else
            {
                ticketNumber = 1;
            }
        }
 private void CloseType()
 {
     TypeHeight = 0;
     FormTicketType = new TicketType();
     CloseTypeVis = "Hidden";
     AddTypeVis = "Hidden";
     EditTypeVis = "Hidden";
 }
Пример #52
0
 public int GetTicketsCount(TicketType type)
 {
     switch (type)
     {
         case TicketType.Air:
             return this.airTicketsCount;
         case TicketType.Bus:
             return this.busTicketsCount;
         case TicketType.Train:
             return this.trainTicketsCount;
         default:
             return default(int);
     }
 }
 public int GetTicketsCount(TicketType type)
 {
     return this.ticketCountByType[type];
 }
Пример #54
0
        public int GetTicketsCount(TicketType type)
        {
            switch (type)
            {
                case TicketType.Air:
                    return this.ticketCountByType[TicketType.Air];
                case TicketType.Bus:
                    return this.ticketCountByType[TicketType.Bus];
            }

            return this.ticketCountByType[TicketType.Train];
        }
Пример #55
0
        public int GetTicketsCount(TicketType type)
        {
            int result = 0;
            switch (type)
            {
                case TicketType.Air:
                    result = this.airTicketsCount;
                    break;
                case TicketType.Bus:
                    result = this.busTicketsCount;
                    break;
                case TicketType.Train:
                    result = this.trainTicketsCount;
                    break;
                default:
                    throw new ArgumentOutOfRangeException("TicketType", "Invalid ticket type");
                    break;
            }

            return result;
        }
Пример #56
0
        public int GetTicketsCount(TicketType type)
        {
            switch (type)
            {
                case TicketType.Flight:
                    return this.airTicketsCount;
                case TicketType.Bus:
                    return this.busTicketsCount;
            }

            return this.trainTicketsCount;
        }
Пример #57
0
        private string DeleteTicket(TicketType ticketType, string uniqueKey)
        {
            if (this.ticketsByUniqueKey.ContainsKey(uniqueKey))
            {
                var ticketToDelete = this.ticketsByUniqueKey[uniqueKey];
                this.ticketsByUniqueKey.Remove(uniqueKey);
                string fromToKey = CreateFromToKey(ticketToDelete.From, ticketToDelete.To);
                this.ticketsFromTo.Remove(fromToKey, ticketToDelete);
                this.ticketsByDate.Remove(ticketToDelete.DateTime, ticketToDelete);
                this.ticketCountByType[ticketToDelete.Type]--;
                return ticketToDelete.Type + Constants.TicketDeletedMsg;
            }

            return ticketType + Constants.TicketDoesNotExistMsg;
        }
        public int GetTicketsCount(TicketType type)
        {
            int result = this.ticketsCountByType[type];

            return result;
        }
Пример #59
0
        public string SellTicket(TicketType type)
        {
            var ticket = this.tickets.FirstOrDefault(t => t.Status == TicketStatus.Unsold && t.Type == type);
            if (ticket == null)
            {
                throw new ArgumentException("There is no unsold ticket of the specified type.");
            }

            ticket.Sell();
            return ticket.ToString();
        }
Пример #60
0
        public void UpdateTicket(int? assignedToUserId,int priority, string title, string description, string solution,TicketType type, TicketStatus status)
        {
            this.AssignedToUserId = assignedToUserId;
            this.Title = title;
            this.Description = description;
            this.Solution = solution;
            this.TicketType = type;
            this.Status = status;
            this.Priority = priority;

            if (this.Status == TicketStatus.Processed)
            {
                this.SendEmailToClient();
            }
        }