当前位置: 首页>>代码示例>>C#>>正文


C# SQLite.SQLiteConnection.FindWithQuery方法代码示例

本文整理汇总了C#中SQLite.SQLiteConnection.FindWithQuery方法的典型用法代码示例。如果您正苦于以下问题:C# SQLite.SQLiteConnection.FindWithQuery方法的具体用法?C# SQLite.SQLiteConnection.FindWithQuery怎么用?C# SQLite.SQLiteConnection.FindWithQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLite.SQLiteConnection的用法示例。


在下文中一共展示了SQLite.SQLiteConnection.FindWithQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowPendingContactOptions

		private void ShowPendingContactOptions()
		{
			try {
				UIActionSheet actionSheet;
				actionSheet = new UIActionSheet();
				if (!string.IsNullOrEmpty(this.mobile))
					actionSheet.AddButton(this.mobile);
				if (!string.IsNullOrEmpty(this.email))
					actionSheet.AddButton(this.email);
				actionSheet.AddButton("Cancel");
				actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) {
					using (var conn = new SQLite.SQLiteConnection(AppDelegate._dbPath)) {
						string recipient = "";
						//int present_thread_id = 0;

						if (actionSheet.ButtonTitle(b.ButtonIndex) == this.mobile) {
							try {
								var phoneUtil = PhoneNumberUtil.GetInstance();
								recipient = phoneUtil.Format(phoneUtil.Parse(this.mobile, AppDelegate.GetCountryCode()), PhoneNumberFormat.E164);
							} catch (Exception e) {
								recipient = this.mobile;
							}
						} else if (actionSheet.ButtonTitle(b.ButtonIndex) == this.email) {
							recipient = this.email;
						}

						if (actionSheet.ButtonTitle(b.ButtonIndex) != "Cancel") { 
							/*
							List<PushChatThread> pctList = conn.Query<PushChatThread>("select * from PushChatThread");

							foreach (PushChatThread pct in pctList) {
								if (pct.Number.Equals(recipient)) {
									present_thread_id = pct.ID;
									break;
								}
							}
							*/
							PushChatThread thread = conn.FindWithQuery<PushChatThread>("select * from PushChatThread where Number = ?", recipient);
							//if (present_thread_id == 0) {
							if (thread == null) {
								PushContact contact = conn.FindWithQuery<PushContact>("select * from PushContact where Number = ?", recipient);
								thread = new PushChatThread {
									DisplayName = contact.Name,
									Number = recipient,
									Recipient_id = 0,
									TimeStamp = AppDelegate.CurrentTimeMillis(),
									Message_count = 0,
									Snippet = "",
									Read = 0,
									Type = "PushLocal"
								};
								conn.Insert(thread);
								conn.Commit();
								conn.Close();
								//present_thread_id = pct_val.ID;
							}

							//appDelegate.chatView.setThreadID(present_thread_id);
							appDelegate.chatView.setThreadID(thread.ID);
							appDelegate.chatView.setNumber(recipient);
							appDelegate.chatView.setThreadSelected(thread.DisplayName + " (" + recipient + ")");
							appDelegate.GoToView(appDelegate.chatView);
						}
					}
				};
				actionSheet.ShowInView(View);
			} catch (Exception ex) {
				Console.Write(ex.Message);
			}
		}
开发者ID:Securecom,项目名称:Securecom-Messaging-iOS,代码行数:70,代码来源:ContactListView.cs

示例2: updateChatThread

		private void updateChatThread(IncomingMessage message, string msg)
		{
			// Figure out where the SQLite database will be.
			var conn = new SQLite.SQLiteConnection(_dbPath);
			String number = message.Sender;
			// Check if there is an existing thread for this sender

			PushChatThread thread = conn.FindWithQuery<PushChatThread>("select * from PushChatThread where Number = ?", number);
			if (thread != null) {
				conn.Execute("UPDATE PushChatThread Set Snippet = ?, TimeStamp = ?, Message_count = ?, Read = ?, Type = ? WHERE ID = ?", msg, message.MessageId, 1, 1, "Push", thread.ID);
				conn.Commit();
			} else {
				PushContact contact = conn.FindWithQuery<PushContact>("select * from PushContact where Number = ?", number);
				thread = new PushChatThread {
					DisplayName = contact.Name,
					Number = number,
					Recipient_id = 0,
					TimeStamp = Convert.ToInt64(message.MessageId),
					Message_count = 1,
					Snippet = msg,
					Read = 1,
					Type = "Push"
				};
				conn.Insert(thread);
				//conn.Execute("UPDATE PushChatThread Set Recipient_id = ? WHERE Number = ?", present_thread_id, sender);
			}

			var pmessage = new PushMessage {
				Thread_id = thread.ID,
				Number = number,
				TimeStamp = CurrentTimeMillis(),
				TimeStamp_Sent = Convert.ToInt64(message.MessageId),
				Read = 1,
				Message = msg,
				Status = true,
				Service = "Push"
			};
			conn.Insert(pmessage);
			conn.Commit();
			conn.Close();
			RefreshChatListView();
		}
开发者ID:Securecom,项目名称:Securecom-Messaging-iOS,代码行数:42,代码来源:AppDelegate.cs


注:本文中的SQLite.SQLiteConnection.FindWithQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。