Exemplo n.º 1
0
        public Travel GetById(int id)
        {
            try
            {
                string sql = "SELECT ReisagentID, AccomodationID, CustomerID, Discount, DepartureDate, Insurance, Transport, price FROM Travel WHERE TravelID = @TravelID";
                List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("@TravelID", id.ToString())
                };

                DataSet results = ExecuteSql(sql, parameters);
                Travel  c       = DataSetParser.DataSetToTravel(results, 0);
                return(c);
            }
            catch
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        public List <Travel> GetAll()
        {
            List <Travel> TravelList = new List <Travel>();

            try
            {
                string sql = "SELECT TravelId, ReisagentID, AccomodationID, CustomerID, Discount, DepartureDate, Insurance, Transport, price FROM Travel";

                DataSet results = ExecuteSql(sql, new List <KeyValuePair <string, string> >());

                for (int x = 0; x < results.Tables[0].Rows.Count; x++)
                {
                    Travel c = DataSetParser.DataSetToTravel(results, x);
                    TravelList.Add(c);
                }
                return(TravelList);
            }
            catch
            {
                return(null);
            }
        }