Example #1
0
        public static int CompareScenicByTourName(Chuyen a, Chuyen b)
        {
            string x = a.TenTour;
            string y = b.TenTour;

            //return String.Compare(x, y);
            return(CompareLength(x, y));
        }
Example #2
0
        public static int CompareScenicByStartPlace(Chuyen a, Chuyen b)
        {
            string x = a.XuatPhat;
            string y = b.XuatPhat;

            //return String.Compare(x, y);
            return(CompareLength(x, y));
        }
Example #3
0
 public List <Chuyen> FindByCodeTourAndStatus(int _tourCode, int _status)
 {
     if (List == null)
     {
         List = Chuyen.All();
     }
     return(List.FindAll(delegate(Chuyen t){
         return t.MTour == _tourCode && t.TrangThai == _status;
     }));
 }
Example #4
0
 public Chuyen Single(int code)
 {
     if (List == null)
     {
         List = Chuyen.All();
     }
     return(List.Find(delegate(Chuyen t) {
         return t.MChuyen == code;
     }));
 }
Example #5
0
 public List <Chuyen> FindByCodeTour(int _tourCode)
 {
     if (List == null)
     {
         List = Chuyen.All();
     }
     return(List.FindAll(delegate(Chuyen t)
     {
         return t.MTour == _tourCode;
     }));
 }
Example #6
0
 public List <Chuyen> FindByStatus(int _status)
 {
     if (List == null)
     {
         List = Chuyen.All();
     }
     return(List.FindAll(delegate(Chuyen t)
     {
         return t.TrangThai == _status;
     }));
 }
Example #7
0
 private bool Find(Chuyen trip, List <DatCho> orders)
 {
     for (int i = 0; i < orders.Count; i++)
     {
         if (orders[i].MChuyen == trip.MChuyen)
         {
             orders.RemoveAt(i);
             return(true);
         }
     }
     return(false);
 }
Example #8
0
        public List <Chuyen> FindByLessThanPrice(double _price)
        {
            List <Chuyen> result = new List <Chuyen>();

            if (List == null)
            {
                List = Chuyen.All();
            }
            result = List.FindAll(delegate(Chuyen t) {
                return(t.Gia <= _price);
            });
            IOrderedEnumerable <Chuyen> temp = result.OrderByDescending(x => x.Gia);

            result = new List <Chuyen>();
            foreach (Chuyen item in temp)
            {
                result.Add(item);
            }
            return(result);
        }
Example #9
0
        public List <Tour> Find(List <Chuyen> trips)
        {
            List <Tour>   result    = new List <Tour>();
            List <Chuyen> tripscopy = new List <Chuyen>();

            foreach (Chuyen item in trips)
            {
                Chuyen i = new Chuyen();
                i.MTour = item.MTour;
                tripscopy.Add(i);
            }

            foreach (Tour item in List)
            {
                if (Find(item, tripscopy))
                {
                    result.Add(item);
                }
            }
            return(result);
        }
Example #10
0
 public Trips()
 {
     List = new List <Chuyen>();
     List = Chuyen.All();
 }
Example #11
0
        public static bool Update(Chuyen c)
        {
            object rs = DataProvider.Instance.ExecuteNonQuery("Chuyen_Update", c.MChuyen, c.MTour, c.NgayDi, c.NgayVe, c.Gia, c.TrangThai);

            return(MyConvert.ToInt32(rs) > 0 ? true : false);
        }
Example #12
0
        public static int Add(Chuyen c)
        {
            object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("@MChuyen", "Chuyen_Add", c.MChuyen, c.MTour, c.NgayDi, c.NgayVe, c.Gia, c.TrangThai);

            return(MyConvert.ToInt32(rs));
        }