文档介绍:一、HouseManagerDAL数据访问层中设计三个类:(1);;;;;;{lassCustomerService{///ustomerGetCustomerByLoginName(stringname)资料个人收集整理,勿做商业用途{stringsql=("select*fromCustomerswhereLoginName='{0}'",name);资料个人收集整理,勿做商业用途returnGetCustomerBySQL(sql);}///ustomerGetCustomerById(intid){stringsql=("select*fromCustomerswhereCustomerId={0}",id);资料个人收集整理,勿做商业用途returnGetCustomerBySQL(sql);}///私有方法,ustomerGetCustomerBySQL(stringsql)资料个人收集整理,勿做商业用途{using(SqlConnectionconn=newSqlConnection())资料个人收集整理,勿做商业用途{Customerc=null;try{();mandcmd=mand(sql,conn);SqlDataReadersdr=();if(()){c=newCustomer();=(int)sdr["CustomerId"];=sdr["LoginName"].ToString();=sdr["Password"].ToString();}}catch(Exceptionex){();}finally{();}returnc;}}}}(2)在DBHelper中usingSystem;;;{lassDBHelper{publicstaticreadonlystringconnectString="server=.;database=HouseDB;uid=sa;pwd=123456";资料个人收集整理,勿做商业用途}}(3)在HouseService中usingSystem;;;;;;{lassHouseService{///获取所有发布地房屋信息publicstaticIList<House>GetAllHouse(){List<House>houses=newList<House>();using(SqlConnectionconn=newSqlConnection())资料个人收集整理,勿做商业用途{try{();mandcmd=mand("select*fromHouses",conn);资料个人收集整理,勿做商业用途SqlDataReadersdr=();while(()){Househ=newHouse();=(int)sdr["HouseId"];=sdr["HouseTypeName"].ToString();=(int)sdr["Area"];=(sdr["Price"]);=sdr["Address"].ToString();//=((int)sdr["Cust