Пример #1
0
        public List<Models.Ticket> TicketsProgress (List<int> ticketNumbers)
        {
            List<Models.Ticket> tt = new List<Models.Ticket>();
           // ('2396','2397','2398','2399','2400')
            //2400	Change Rate	CHANGE RATE
            //2399	Remove Short Code	REMOVE SC
            //2398	NewService_IVR_SMS	IVR_SMS
            //2396	NewService_SMS	SMS
            //2397	NewService_IVR	IVR
            string Command = @"select 
round(
(select count (*) from (select  distinct status from TKSTATUS where ticketid=:tkid and status like ('PEND%')))
/
(
select 
(Case  CLASSSTRUCTUREID 
                                       when '2399' then 6
                                       when '2400' then 4
                                       when '2396' then 9
                                       when '2397' then 9
                                       when '2398' then 8 end)
from ticket where ticketid=:tkid),2 )*100 progress, (select 
case lower(status) 
when 'closed' then 'progress-bar-success'
when 'retmkt' then 'progress-bar-danger'
when 'retra' then 'progress-bar-danger'
when 'retra' then 'progress-bar-danger'
else 'progress-bar-danger' end style  from ticket where ticketid=:tkid
) style , (select description  from ticket where ticketid=:tkid)  description ,
(select status  from ticket where ticketid=:tkid) status  from dual";
            if (ticketNumbers.Count != 0 )
            {
                foreach (int i in ticketNumbers)
                {
                    Models.Ticket y = new Models.Ticket();
                    y.DESCRIPTION = "";

                        y = this._db.Query<Models.Ticket>(Command, new { tkid = i }).SingleOrDefault();
                    
                    if (String.IsNullOrEmpty(y.DESCRIPTION) == false) 
                    {
                        tt.Add(y);
                    }
                }
            }
            else
            {
                Exception ex = new Exception("No items requested for the progress bar");
                throw ex;
            }
            if (tt.Count == 0)
            {
                Exception ex = new Exception("No items exist for the progress bar");
                throw ex;
            }
            return tt;
        }
Пример #2
0
        public string ExitVehicle(string licensePlate, DateTime endTime, decimal payedMoney)
        {
            var vehicle = this.vehicleParkData.GetVehicle(licensePlate);
            if (vehicle == null)
            {
                return string.Format(Message.NoSuchVehicle, licensePlate);
            }

            var startTime = this.vehicleParkData.GetExpectedTimeForVehicle(vehicle);
            int endHours = (int)Math.Round((endTime - startTime).TotalHours);

            var parkedAt = this.vehicleParkData.GetParkedSpot(vehicle);
            var ticket = new Ticket(vehicle, payedMoney, parkedAt, endHours);

            this.vehicleParkData.RemoveVehicle(vehicle);

            return ticket.ToString();
        }
Пример #3
0
 public void Add(Ticket ticket)
 {
     this.tickets.Add(ticket);
     this.tickets.Save();
 }