示例#1
0
        public List <MaterialTable> GetMaterial()
        {
            List <MaterialTable> materials = new List <MaterialTable>();

            try
            {
                connection.Open();
                var command = new OleDbCommand();
                command.Connection  = connection;
                command.CommandText = "select * from Materials";
                var reader = command.ExecuteReader();

                while (reader.Read())
                {
                    MaterialTable material = new MaterialTable();
                    material.material_type = reader.GetString(1);
                    material.width         = reader.GetString(2);
                    material.height        = reader.GetString(3);
                    materials.Add(material);
                }

                materials.Sort();
                reader.Close();
                connection.Close();
                return(materials);
            }
            catch (Exception e) { }
            finally { }

            return(materials);
        }
示例#2
0
        public int CompareTo(Object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            MaterialTable other = obj as MaterialTable;

            return(this.material_type.CompareTo(other.material_type));
        }