Esempio n. 1
0
        public BindableCollection <Trip> Get_AllTripWasGone()
        {
            ListTripWasGone.Clear();
            sql = $"SELECT CD.*,TV.HOTEN FROM CHUYENDI AS CD JOIN THANHVIEN AS TV ON CD.MACD = TV.MACD WHERE CD.TRANGTHAI=0 AND TV.TRANGTHAI=1 ";
            DataTable dt = Connection.GetALL_Data(sql);

            foreach (DataRow row in dt.Rows)
            {
                Trip trip = new Trip();
                trip.TripID   = row["MACD"].ToString();
                trip.TripName = row["TENCD"].ToString();
                trip.Status   = (int)row["TRANGTHAI"];
                trip.Lenght   = row["DODAI"].ToString();
                string dateStart = row["NGAYDI"].ToString();
                if (dateStart != "")
                {
                    var date = DateTime.Parse(dateStart);
                    trip.StartDate = date.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                string dateEnd = row["NGAYKT"].ToString();
                if (dateEnd != "")
                {
                    var date = DateTime.Parse(dateEnd);
                    trip.EndDate = date.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                trip.MemberName = row["HOTEN"].ToString();
                ListTripWasGone.Add(trip);
            }
            return(ListTripWasGone);
        }
Esempio n. 2
0
        public BindableCollection <Trip> Get_AllTrip()
        {
            ListTripWasGone.Clear();
            sql = $"SELECT * FROM CHUYENDI AS CD ";
            DataTable dt = Connection.GetALL_Data(sql);

            foreach (DataRow row in dt.Rows)
            {
                Trip trip = new Trip();
                trip.Amount++;
                trip.TripID    = row["MACD"].ToString();
                trip.TripName  = row["TENCD"].ToString();
                trip.Status    = (int)row["TRANGTHAI"];
                trip.Lenght    = row["DODAI"].ToString();
                trip.StartDate = row["NGAYDI"].ToString();
                trip.EndDate   = row["NGAYKT"].ToString();
                ListTripWasGone.Add(trip);
            }
            return(ListTripWasGone);
        }