//根据酒店编号查询酒店信息,显示在酒店客房信息管理页面 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 searchTelephone(string id /*身份证号码*/) { string sql = "select Laccount from LoginInfo where Lid='" + id + "'"; string telephone = DatabaseLink.GetSingleData(sql);//将查询结果存于table表中 return(telephone); }
//查询个人信息,用于显示在完善个人信息界面 public DataTable searchUserInfo(string id /*身份证号码*/) { string sql = "select * from UserInfo where Uid='" + id + "'"; 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); }
internal ClassFileDetails(string setClassName, string setPath, System.DateTime setUpdateTime) { className = setClassName; path = setPath; updateTime = setUpdateTime; DatabaseLink.StoreClassFileDetails(this); }
//根据酒店所在省市和酒店名称模糊查询 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 searchRoomType() { string sql = "select * from RoomType order by Tid asc"; DataTable table = DatabaseLink.GetData(sql);//将查询结果存于table表中 return(table); }
//根据类型编号查询客房类型 public string searchRoomType(string id /*客房类型编号*/) { string sql = "select Ttype from RoomType where Tid='" + id + "'"; string type = DatabaseLink.GetSingleData(sql);//将查询结果存于table表中 return(type); }
//根据身份证号查询客户姓名,显示在要填写的订单上 public string searchUserName(string id /*身份证号码*/) { string sql = "select Uname from UserInfo where Uid='" + id + "'"; string username = DatabaseLink.GetSingleData(sql);//将查询结果存于table表中 return(username); }
//根据手机账号查询身份证号码 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 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 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 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); }
private void _InitializeDatabase() { m_database = new DatabaseLink(System.AppDomain.CurrentDomain.BaseDirectory + @"tags.db", "TagDB"); //ensure that the tags and filetags tables exist in the database m_database.ExecuteNonQuery(@"CREATE TABLE IF NOT EXISTS [Tags] ([id] INTEGER NOT NULL PRIMARY KEY UNIQUE, [label] TEXT NOT NULL UNIQUE, [color] TEXT NOT NULL UNIQUE, [children] TEXT NOT NULL DEFAULT '');"); m_database.ExecuteNonQuery(@"CREATE INDEX IF NOT EXISTS [Label_Index] on [Tags](label);"); m_database.ExecuteNonQuery(@"CREATE TABLE IF NOT EXISTS [FileTags] ([path] TEXT NOT NULL PRIMARY KEY UNIQUE, [tags] TEXT NOT NULL UNIQUE);"); }
public override DatabaseLink <T> Inspect(string label, DatabaseLink <T> value, object parent, DatabaseInspector inspectorWindow) { if (value == null) { value = new DatabaseLink <T>(); } if (!string.IsNullOrEmpty(label)) { GUILayout.BeginHorizontal(); GUILayout.Label(label, GUILayout.Width(width)); } var valueEntry = value.Value; using (var h = string.IsNullOrEmpty(label) ? new HorizontalScope() : new HorizontalScope(GUI.skin.box)) { GUILayout.Label((valueEntry as INamedEntry)?.EntryName ?? valueEntry?.ID.ToString() ?? $"Drag and drop: {DatabaseListView.FormatTypeName(typeof(T).Name)}"); if (h.rect.Contains(Event.current.mousePosition) && (Event.current.type == EventType.DragUpdated || Event.current.type == EventType.DragPerform)) { var guid = (Guid)DragAndDrop.GetGenericData("Item"); var dragEntry = DatabaseInspector.CultCache.Get(guid); var dragValid = dragEntry is T && dragEntry != valueEntry; if (Event.current.type == EventType.DragUpdated) { DragAndDrop.visualMode = dragValid ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.Rejected; } else if (Event.current.type == EventType.DragPerform) { if (dragValid) { DragAndDrop.AcceptDrag(); value.LinkID = guid; return(value); } } } if (value.LinkID != Guid.Empty) { if (GUILayout.Button("-", GUILayout.Width((EditorGUIUtility.singleLineHeight - 3) * 2), GUILayout.Height(EditorGUIUtility.singleLineHeight - 3))) { value.LinkID = Guid.Empty; } } } if (!string.IsNullOrEmpty(label)) { GUILayout.EndHorizontal(); } return(value); }
//public ServerInfo(string conn, string name) //{ // this._connection = conn; // this._name = name; // this._databases = new List<IDatabaseInfo>(); // loader = new SchemaLoader(MyMeta.dbDriver.SQL, "SqlClient", "C#", this._connection); //} public ServerInfo(DatabaseLink link) { _link = link; this._connection = link.ConnectionString; this._schemaConnection = link.SchemaConnectionString; this._name = link.ServerName; this._databases = new List<IDatabaseInfo>(); loader = new SchemaLoader(MyMeta.dbDriver.SQL, "SqlClient", "C#", link.SchemaConnectionString); }
//根据客户身份证号查询订单,显示在客户订单管理页面 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 deleteRoomType(string id /*客房类型编号*/) { string sql = "delete from RoomType where Tid='" + id + "'"; int num = DatabaseLink.UpdateData(sql); if (num > 0) { return(true); } else { return(false); } }
//修改密码 public bool updatePassword(string newPassword /*新密码*/, string id /*身份证号*/) { string sql = "update LoginInfo set Lpassword='******' where Lid='" + id + "'"; int num = DatabaseLink.UpdateData(sql); if (num > 0) { return(true); } else { return(false); } }
//注册,添加登录信息 public bool addLoginInfo(loginInfo g) { string sql = "insert into LoginInfo values('" + g.Lid + "','" + g.Laccount + "','" + g.Lpassword + "')"; int num = DatabaseLink.UpdateData(sql); if (num > 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 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 addUserInfo(userInfo s /*个人信息对象*/) { string sql = "insert into UserInfo values('" + s.Uid + "','" + s.Uname + "','" + s.Usex + "','" + s.Ubirthday + "','" + s.Uemail + "')"; int num = DatabaseLink.UpdateData(sql); if (num > 0) { return(true); } else { return(false); } }
//修改个人基本信息 public bool updateUserInfo(userInfo s, string id /*根据登录名查询的身份证号*/) { string sql = "update UserInfo set Uname='" + s.Uname + "',Usex='" + s.Usex + "',Ubirthday='" + s.Ubirthday + "',Uemail='" + s.Uemail + "' where Uid='" + id + "'"; int num = DatabaseLink.UpdateData(sql); if (num > 0) { return(true); } else { return(false); } }
//查询酒店编号是否已存在 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 deleteHotelInfo(string id /*酒店编号*/) { string sql = "delete from HotelInfo where Hid='" + id + "'"; int num = DatabaseLink.UpdateData(sql); if (num > 0) { return(true); } else { return(false); } }
//修改账号绑定的手机号 public bool updateLoginAccount(string newTelephone /*新手机号*/, string id /*身份证号*/) { string sql = "update LoginInfo set Laccount='" + newTelephone + "' where Lid='" + id + "'"; int num = DatabaseLink.UpdateData(sql); if (num > 0) { return(true); } else { return(false); } }