Esempio n. 1
0
        public static List <Packages> orderby(string coluName)
        {
            SqlConnection   connection = TRAExpertsDB.GetConnection();
            List <Packages> results    = new List <Packages>();

            try
            {
                string sql = "SELECT * FROM Packages order by" + "'" + coluName + "'";

                SqlCommand    command = new SqlCommand(sql, connection);
                SqlDataReader reader  = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
                while (reader.Read())
                {
                    Packages p = new Packages();
                    p.PackageId           = Convert.ToInt32(reader["PackageId"].ToString());
                    p.PkgName             = reader["PkgName"].ToString();
                    p.PkgStartDate        = Convert.ToDateTime(reader["PkgStartDate"].ToString());
                    p.PkgEndDate          = Convert.ToDateTime(reader["PkgEndDate"].ToString());
                    p.PkgDesc             = reader["PkgDesc"].ToString();
                    p.PkgBasePrice        = Convert.ToDouble(reader["PkgBasePrice"].ToString());
                    p.PkgAgencyCommission = Convert.ToDouble(reader["PkgAgencyCommission"].ToString());

                    results.Add(p);
                }
            }
            catch { }

            finally
            {
                connection.Close();
            }
            return(results);
        }
Esempio n. 2
0
        public static List <Supplier> orderby(string coluName)
        {
            SqlConnection   connection = TRAExpertsDB.GetConnection();
            List <Supplier> results    = new List <Supplier>();

            try
            {
                string sql = "SELECT * FROM Suppliers order by" + "'" + coluName + "'";

                SqlCommand    command = new SqlCommand(sql, connection);
                SqlDataReader reader  = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
                while (reader.Read())
                {
                    Supplier s = new Supplier();
                    s.SupplierId = Convert.ToInt32(reader["SupplierId"].ToString());
                    s.SupName    = reader["SupName"].ToString();
                    results.Add(s);
                }
            }
            catch { }

            finally
            {
                connection.Close();
            }
            return(results);
        }
Esempio n. 3
0
        public static List <Products> orderby(string ProdName)
        {
            SqlConnection   connection = TRAExpertsDB.GetConnection();
            List <Products> results    = new List <Products>();

            try
            {
                string sql = "SELECT * FROM Products order by" + "'" + ProdName + "'";

                SqlCommand    command = new SqlCommand(sql, connection);
                SqlDataReader reader  = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
                while (reader.Read())
                {
                    Products p = new Products();
                    p.ProductId = Convert.ToInt32(reader["ProductId"].ToString());
                    p.ProdName  = reader["ProdName"].ToString();
                    results.Add(p);
                }
            }
            catch { }

            finally
            {
                connection.Close();
            }
            return(results);
        }