Пример #1
0
        public static clsListHouse GetHouses()
        {
            //Liste temporaire
            clsListHouse tmpList = new clsListHouse();

            //Connection a la BDD
            //OleDbConnection myCon = new OleDbConnection(); //connection
            //myCon.ConnectionString = @"Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\Users\pc\Documents\Visual Studio 2015\Projects\prjCSWinADONET\prjCSWinADONET\bin\Debug\data\Sport.mdb";
            //myCon.Open();

            //Commande + Requete SQL
            OleDbCommand cmd = new OleDbCommand(); //commande

            cmd.Connection  = clsGlobal.myCon;
            cmd.CommandText = "SELECT * FROM Houses";
            OleDbDataReader rdHouse = cmd.ExecuteReader();

            while (rdHouse.Read())
            {
                clsAddress ad = new clsAddress(rdHouse["Region"].ToString(), rdHouse["City"].ToString(), rdHouse["Province"].ToString(), rdHouse["StreetAddress"].ToString(), rdHouse["PostalCode"].ToString(), Convert.ToInt32(rdHouse["aptnumber"]));
                clsHouse   eq = new clsHouse(rdHouse["RefHouse"].ToString(), rdHouse["Type"].ToString(), ad, Convert.ToInt32(rdHouse["NbRooms"]), Convert.ToInt32(rdHouse["NbBathroom"]), rdHouse["Size"].ToString(), rdHouse["YearBuilt"].ToString(), Convert.ToDecimal(rdHouse["Price"]), rdHouse["Description"].ToString(), rdHouse["RefEmployee"].ToString(), rdHouse["RefClient"].ToString());
                tmpList.Ajouter(eq);
                eq = null;
            }
            //fermer le reader
            rdHouse.Close();
            //fermer la connection
            // myCon.Close();
            //retourne la valeur tmpList
            return(tmpList);
        }
Пример #2
0
 public clsHouse()
 {
     RefHouse       = "Undefined";
     Type           = "Undefined";
     Address        = new clsAddress();
     NumberRoom     = 00;
     NumberBathroom = 00;
     Size           = "Undefined";
     YearBuilt      = "Undefined";
     Price          = 000;
     Description    = "Undefined";
     RefEmployee    = "Undefined";
     RefClient      = "Undefined";
 }
Пример #3
0
 public clsHouse(string RefHouse, string Type, clsAddress Address, int NumberRoom, int NumberBathromm, string Size,
                 string YearBuilt, decimal Price, string Description, string RefEmployee, string RefClient)
 {
     this.RefHouse       = RefHouse;
     this.Type           = Type;
     this.Address        = Address;
     this.NumberRoom     = NumberRoom;
     this.NumberBathroom = NumberBathromm;
     this.Size           = Size;
     this.YearBuilt      = YearBuilt;
     this.Price          = Price;
     this.Description    = Description;
     this.RefEmployee    = RefEmployee;
     this.RefClient      = RefClient;
 }