예제 #1
0
 static TicketHelpers()
 {
     TicketStatus   = new TicketStatusService();
     TicketCategory = new TicketCategoryService();
     TicketPriority = new TicketPriorityService();
     TicketType     = new TicketTypeService();
     UserRepository = new UserService();
 }
예제 #2
0
파일: Ticket.cs 프로젝트: akon01/Garage
        /// <summary>Checks if the vehicle classis in allowed Vehicle classes of a specific ticket.</summary>
        /// <param name="vehicle">The vehicle to check the class of.</param>
        /// <returns>True if the class of the vehicle is one of the allowed of the ticket.</returns>
        public static bool checkVehicleClass(Vehicle vehicle)
        {
            ITicketType ticket = Ticket.getTicketByType(vehicle.TicketType);

            VehicleClass[] vehicleClasses = ticket.VehicleClasses;
            if (!Array.Exists <VehicleClass>(vehicleClasses, (vehicleClass) => vehicleClass == vehicle.getVehicleClass()))
            {
                return(false);
            }
            return(true);
        }
예제 #3
0
 public TicketController()
 {
     _categoryService       = new CategoryService();
     _ticketService         = new TicketService();
     _userService           = new UserService();
     _ticketCategoryService = new TicketCategoryService();
     _ticketPriority        = new TicketPriorityService();
     _ticketStatus          = new TicketStatusService();
     _ticketType            = new TicketTypeService();
     _emailService          = new Core.Implementation.EmailService();
     _ticketProject         = new TicketProjectService();
 }
예제 #4
0
        /// <summary>Gets the first available lot of a ticket.</summary>
        /// <param name="ticket">The ticket to get the lot of.</param>
        /// <returns>The Number of the lot that's available.</returns>
        /// <exception cref="InvalidOperationException">No Available Lot In Ticket</exception>
        public async Task <int> getAvailableLotByTicket(ITicketType ticket)
        {
            //TODO: go to DB and check available lot and return the number
            int[] takenLots = await db.Database.SqlQuery <int>("SELECT LotNumber FROM dbo.Vehicles WHERE LotNumber BETWEEN @lowRange AND @highRange", new SqlParameter[] { new SqlParameter("lowRange", ticket.Lots[0]), new SqlParameter("highRange", ticket.Lots[ticket.Lots.Length - 1]) }).ToArrayAsync();

            int[] lots          = ticket.Lots;
            int[] availableLots = lots.Except(takenLots).ToArray();

            if (availableLots.Length < 1)
            {
                throw new InvalidOperationException("No Available Lot In Ticket");
            }
            return(availableLots[0]);
        }
예제 #5
0
파일: Ticket.cs 프로젝트: akon01/Garage
        /// <summary>Checks if the dimentions of a Vehicle match allowed dimentions of Ticket.</summary>
        /// <param name="height">The height of the Vehicle.</param>
        /// <param name="width">The width of the vehicle.</param>
        /// <param name="length">The length of the vehicle.</param>
        /// <param name="ticketType">Type of the ticket to check against.</param>
        /// <returns>true if the dimentions are valid for the ticket, false otherwise.</returns>
        public static bool checkDimentions(int height, int width, int length, TICKET_TYPE ticketType)
        {
            //Vip Doesn't have dimentions limitations.
            if (ticketType == TICKET_TYPE.VIP)
            {
                return(true);
            }
            ITicketType ticket = Ticket.getTicketByType(ticketType);

            if (height > ticket.Dimentions.Height || width > ticket.Dimentions.Width || length > ticket.Dimentions.Length)
            {
                return(false);
            }
            return(true);
        }
예제 #6
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();

            // Ticket Type//
            Type dataType = module.TicketTypeDataType;

            foreach (string name in new[] { "Task", "Idea", "Error" })
            {
                ITicketType type = null;
                type = ObjectSpace.FindObject(dataType, new BinaryOperator(nameof(type.Ticket_Type), name)) as ITicketType;
                if (type == null)
                {
                    type             = ObjectSpace.CreateObject(dataType) as ITicketType;
                    type.Ticket_Type = name;
                }
            }

            ObjectSpace.CommitChanges();

            //Ticket Priority//
            Type dtTypeTicketPriority = module.TicketPriorityDataType;

            foreach (string name in new[] { "High", "Medium", "Low" })
            {
                ITicketPriority typePriority = null;
                typePriority =
                    ObjectSpace.FindObject(dtTypeTicketPriority, new BinaryOperator(nameof(typePriority.Ticket_Priority), name)) as ITicketPriority;
                if (typePriority == null)
                {
                    typePriority = ObjectSpace.CreateObject(dtTypeTicketPriority) as ITicketPriority;
                    typePriority.Ticket_Priority = name;
                }
            }

            ObjectSpace.CommitChanges();

            //string name = "MyName";
            //DomainObject1 theObject = ObjectSpace.FindObject<DomainObject1>(CriteriaOperator.Parse("Name=?", name));
            //if(theObject == null) {
            //    theObject = ObjectSpace.CreateObject<DomainObject1>();
            //    theObject.Name = name;
            //}

            //ObjectSpace.CommitChanges(); //Uncomment this line to persist created object(s).
        }
예제 #7
0
 public Ticket(IDatabase database, ITicketType ticketType, IAge age)
 {
     _database   = database.Get();
     _ticketType = ticketType;
     _age        = age;
 }