//查询个人信息,用于显示在完善个人信息界面 public DataTable searchUserInfo(string id /*身份证号码*/) { string sql = "select * from UserInfo where Uid='" + id + "'"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 return(table); }
//查询全部客房类型,显示在客房类型管理界面 public DataTable searchRoomType() { string sql = "select * from RoomType order by Tid asc"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 return(table); }
//查询全部酒店信息,显示在酒店信息查询界面 public DataTable searchHotelInfo() { string sql = "select * from HotelInfo order by Hid asc"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 return(table); }
//根据酒店所在省市和酒店名称模糊查询 public DataTable searchHotelByKey(string province /*酒店所在省市*/, string name /*酒店名称*/) { string sql = "select * from HotelInfo where Hprovince like '%" + province + "%' and Hname like '%" + name + "%'"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 return(table); }
//根据酒店编号查询酒店信息,显示在酒店客房信息管理页面 public DataTable searchHotelById(string id /*酒店编号*/) { string sql = "select * from HotelInfo where Hid='" + id + "'"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 return(table); }
//根据酒店编号查询酒店客房信息,酒店客房信息表和客房类型表连接查询,显示在酒店信息管理页面 public DataTable searchHotelRoomById(string id /*酒店编号*/) { string sql = "select HotelRoomInfo.* , RoomType.* from HotelRoomInfo ,RoomType where HotelRoomInfo.RtypeId = RoomType.Tid and RhotelId='" + id + "' order by Rid asc "; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 return(table); }
//根据手机账号查询身份证号码 public string getCardId(string telephone /*手机账号*/) { string sql_0 = "select Lid from LoginInfo where Laccount='" + telephone + "'"; DataTable table = DatabaseLink.GetData(sql_0); //将查询结果存于table表中 string id = table.Rows[0][0].ToString(); //取table表中的查询结果 return(id); //返回身份证号码 }
//查询密码 public string searchPassword(string id /*身份证号*/) { string sql = "select Lpassword from LoginInfo where Lid='" + id + "'"; DataTable table = DatabaseLink.GetData(sql); //将查询结果存于table表中 string password = table.Rows[0][0].ToString(); //取table表中的查询结果 return(password); //返回密码 }
//根据客房类型查询客房类型编号 public string searchRoomTypeId(string type) { string sql_0 = "select Tid from RoomType where Ttype='" + type + "'"; DataTable table = DatabaseLink.GetData(sql_0); //将查询结果存于table表中 string id = table.Rows[0][0].ToString(); //取table表中的查询结果 return(id); //返回客房类型编号 }
//查询酒店客房类型 public string searchHotelRoomType(string id /*酒店客房编号*/) { string sql = "select Ttype from RoomType , HotelRoomInfo where HotelRoomInfo.RtypeId = RoomType.Tid and Rid='" + id + "'"; DataTable table = DatabaseLink.GetData(sql); //将查询结果存于table表中 string type = table.Rows[0][0].ToString(); //取table表中的查询结果 return(type); }
//查询手机号 public string searchTelephone(string id /*身份证号*/) { string sql = "select Laccount from LoginInfo where Lid='" + id + "'"; DataTable table = DatabaseLink.GetData(sql); //将查询结果存于table表中 string telephone = table.Rows[0][0].ToString(); //取table表中的查询结果 return(telephone); //返回手机号 }
//查询个人订单,显示在我的订单页面 public DataTable searchPersonalOrderInfo(string id /*用户身份证号*/) { string sql = "select UserOrderInfo.*, HotelInfo.* , RoomType.* from " + "UserOrderInfo, HotelInfo , RoomType where UserOrderInfo.OhotelId = HotelInfo.Hid" + " and UserOrderInfo.OtypeId = RoomType.Tid and UserOrderInfo.OcardId = '" + id + "' order by Oid asc"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 return(table); }
//根据客户身份证号查询订单,显示在客户订单管理页面 public DataTable searchUserOrderInfo(string id /*身份证号码*/) { string sql = "select UserOrderInfo.*, HotelInfo.* , Ttype, Uname, Laccount from " + "UserOrderInfo, HotelInfo , RoomType , UserInfo , LoginInfo where UserOrderInfo.OhotelId = HotelInfo.Hid" + " and UserOrderInfo.OtypeId = RoomType.Tid and UserOrderInfo.OcardId = UserInfo.Uid and " + " UserOrderInfo.OcardId = LoginInfo.Lid and OcardId ='" + id + "'"; DataTable ds = DatabaseLink.GetData(sql);//将查询结果存于table表中 return(ds); }
//查询全部订单,显示在客户订单管理界面,多表连接查询 public DataTable searchUserOrderInfo() { string sql = "select UserOrderInfo.*, HotelInfo.* , Ttype, Uname, Laccount from " + "UserOrderInfo, HotelInfo , RoomType , UserInfo , LoginInfo where UserOrderInfo.OhotelId = HotelInfo.Hid" + " and UserOrderInfo.OtypeId = RoomType.Tid and UserOrderInfo.OcardId = UserInfo.Uid and " + " UserOrderInfo.OcardId = LoginInfo.Lid order by Oid asc"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 return(table); }
//查询酒店编号是否已存在 public bool IdisExisted(string id /*酒店编号*/) { string sql = "select Hid from HotelInfo where Hid = '" + id + "'"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 if (table.Rows.Count > 0) {//该酒店客房编号已存在 return(true); } else { return(false); } }
//查询是否添加过客房类型编号 public bool IdisAdded(string id /*客房类型编号*/) { string sql = "select Tid from RoomType where Tid='" + id + "'"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 if (table.Rows.Count > 0) {//已存在 return(true); } else { return(false); } }
//查询是否添加过客房类型 public bool TypeisAdded(string type /*客房类型名*/) { string sql = "select Ttype from RoomType where Ttype='" + type + "'"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 if (table.Rows.Count > 0) {//已存在 return(true); } else { return(false); } }
//查询用户是否完善过个人信息 public bool isImproved(string id /*身份证号*/) { string sql = "select Uid from UserInfo where Uid='" + id + "'"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 if (table.Rows.Count > 0) {//有完善过 return(true); } else { return(false); } }
//身份证号查重 public bool getCardId(string id /*注册时输入的身份证号*/) { string sql = "select Lid from LoginInfo where Lid='" + id + "'"; DataTable table_0 = DatabaseLink.GetData(sql);//将查询结果存于table表中 if (table_0.Rows.Count > 0) {//此身份证号存在 return(true); } else { return(false); } }
//判断登录账号是否存在 public bool getLoginAccount(string telephone /*注册时输入的手机号码*/) { string sql_0 = "select Laccount from LoginInfo where Laccount='" + telephone + "'"; DataTable table_0 = DatabaseLink.GetData(sql_0); //将查询结果存于table表中 if (table_0.Rows.Count > 0) { //此手机账号存在 return(true); } else { return(false); } }
//判断登录账号与密码是否正确 public int getLoginPassword(string telephone, string password) { string sql_0 = "select Laccount from LoginInfo where Laccount='" + telephone + "'"; DataTable table_0 = DatabaseLink.GetData(sql_0);//将查询结果存于table表中 if (table_0.Rows.Count > 0) { //有此手机账号 string sql_1 = "select Lpassword from LoginInfo where Laccount='" + telephone + "'"; DataTable table_1 = DatabaseLink.GetData(sql_1); //将查询结果存于table表中 string pw = table_1.Rows[0][0].ToString(); //取table表中的查询结果 if (password.Equals(pw.Trim())) { return(1);//密码正确 } else { return(0);//密码错误 } } else { return(-1);//无此手机账号 } }