Ejemplo n.º 1
0
        public ParkTicket GetTicket(int ID)
        {
            ParkTicket pt = new ParkTicket();

            using (var con = new SqlConnection(GC.ConnectionString))
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }

                Query = "select * from ParkTicketView where id='" + ID + "'";

                using (var com = new SqlCommand(Query, con))
                {
                    Reader = com.ExecuteReader();

                    while (Reader.Read())
                    {
                        pt.TicketID   = Convert.ToInt32(Reader["id"].ToString());
                        pt.DriverName = Reader["FirstName"].ToString() + " " + Reader["LastName"].ToString();
                        pt.License    = Reader["license"].ToString();
                        pt.ParkName   = Reader["ParkName"].ToString();
                        pt.Date       = Convert.ToDateTime(Reader["Date"].ToString());
                    }

                    com.Dispose();
                }

                con.Close();
            }

            return(pt);
        }
Ejemplo n.º 2
0
        public ParkTicket GetTicket(int ParkID, int CarID)
        {
            ParkTicket pt = new ParkTicket();

            using (var con = new SqlConnection(GC.ConnectionString))
            {
                con.Open();

                Query = "Select * from ParkTicketView ptv inner join Park_Ticket pt on ptv.id=pt.id inner join car_park cp on pt.car_park_id=cp.id inner join car_driver cd on pt.car_driver_id=cd.id where cp.park_id='" + ParkID + "' and cd.car_id='" + CarID + "'";

                using (var com = new SqlCommand(Query, con))
                {
                    Reader = com.ExecuteReader();

                    while (Reader.Read())
                    {
                        pt.TicketID   = Convert.ToInt32(Reader["id"].ToString());
                        pt.DriverName = Reader["FirstName"].ToString() + " " + Reader["LastName"].ToString();
                        pt.License    = Reader["license"].ToString();
                        pt.ParkName   = Reader["ParkName"].ToString();
                        pt.Date       = Convert.ToDateTime(Reader["Date"].ToString());
                    }
                    com.Dispose();
                }
                con.Close();
            }
            return(pt);
        }
Ejemplo n.º 3
0
        private async void ProcessTicket(int ParkId, int CarId)
        {
            ufunctions = new UserFunctions();
            ParkTicket pt = new ParkTicket();

            pt = await ufunctions.GetParkTicket(ParkId, CarId);

            ticketid.Text      = pt.TicketID.ToString();
            ticketdate.Text    = pt.Date.ToLongDateString();
            ticketdriver.Text  = pt.DriverName;
            ticketlicense.Text = pt.License;
        }