private void CreateNewJob(MemoItem memo) { CalendarJob job = new CalendarJob(); job.UserId = memo.UserId; job.MemoItemId = memo.Id; job.JobMethod = CalendarJobMethodEnum.GoogleAPI; job.JobStatus = CalendarJobStatusEnum.Pending; job.Active = true; DBController.DbGenericData.Add(job); ShareMemo(memo, job); }
public void Add(MemoItem pInsertItem) { pInsertItem.CreationDate = DateTime.Now; var sqlItems = new SqlItemList(); sqlItems.Add(new SqlItem("title", pInsertItem.title)); sqlItems.Add(new SqlItem("description", pInsertItem.Description)); sqlItems.Add(new SqlItem("CreationDate", pInsertItem.CreationDate)); sqlItems.Add(new SqlItem("date", pInsertItem.Date)); sqlItems.Add(new SqlItem("RepeatEvery", pInsertItem.RepeatEvery)); sqlItems.Add(new SqlItem("Shared", pInsertItem.Shared)); sqlItems.Add(new SqlItem("UserId", pInsertItem.UserId)); SetInsertIntoSql(SynnDataProvider.TableNames.DiaryData, sqlItems); ExecuteSql(); }
public void ChangeAsync(int id, MemoItem memoItem) { using (SqliteConnection db = new SqliteConnection("Filename=sqliteData.db")) { db.Open(); SqliteCommand updateCommand = new SqliteCommand("UPDATE MemoItemTable SET DateCreated = @date , Title = @title , Text = @text WHERE Id = @id;"); updateCommand.Connection = db; updateCommand.Parameters.AddWithValue("@date", memoItem.DateCreated); updateCommand.Parameters.AddWithValue("@title", memoItem.Title); updateCommand.Parameters.AddWithValue("@text", memoItem.Text); updateCommand.Parameters.AddWithValue("@id", id); updateCommand.ExecuteReader(); db.Close(); } }
private void ShareMemo(MemoItem memo, CalendarJob job) { if (memo.Shared) { UserMemoSharingSettings sharingSettings = DBController.DbGenericData.GetGenericData <UserMemoSharingSettings> (new UserMemoSharingSettingsSearchParameters { OwnerUserId = memo.UserId }).FirstOrDefault(); if (sharingSettings != null) { foreach (var sharedUser in sharingSettings.UsersToShare) { job.UserId = sharedUser; DBController.DbGenericData.Add(job); } } } }
public async Task <Unit> Handle(AddOrUpdateMemoHintCommand request, CancellationToken cancellationToken) { var memoItem = await _dbContext.MemoItems.FirstOrDefaultAsync(x => x.Memo == request.Memo, cancellationToken); if (memoItem == null) { memoItem = new MemoItem(request.Memo, request.Type, request.Category, request.AccountFrom, request.AccountTo); await _dbContext.MemoItems.AddAsync(memoItem, cancellationToken); } else { memoItem.UpdateMemoItem(request.Memo, request.Type, request.Category, request.AccountFrom, request.AccountTo); } await _dbContext.SaveChangesAsync(cancellationToken); return(Unit.Value); }
public void AddAsync(MemoItem memoItem) { //throw new NotImplementedException(); using (SqliteConnection db = new SqliteConnection("Filename=sqliteData.db")) { db.Open(); SqliteCommand insertCommand = new SqliteCommand(); insertCommand.Connection = db; insertCommand.CommandText = "INSERT INTO MemoItemTable (DateCreated,Title,Text) VALUES (@date,@title,@text);"; insertCommand.Parameters.AddWithValue("@date", memoItem.DateCreated); insertCommand.Parameters.AddWithValue("@title", memoItem.Title); insertCommand.Parameters.AddWithValue("@text", memoItem.Text); insertCommand.ExecuteReader(); db.Close(); } }
public void DeleteAsync(MemoItem memoItem) { //throw new NotImplementedException(); using (SqliteConnection db = new SqliteConnection("Filename=sqliteData.db")) { db.Open(); SqliteCommand deleteCommand = new SqliteCommand("DELETE FROM MemoItemTable WHERE Id = @id AND DateCreated = @date AND Title = @title AND Text = @text;"); deleteCommand.Connection = db; deleteCommand.Parameters.AddWithValue("@id", memoItem.Id); deleteCommand.Parameters.AddWithValue("@date", memoItem.DateCreated); deleteCommand.Parameters.AddWithValue("@title", memoItem.Title); deleteCommand.Parameters.AddWithValue("@text", memoItem.Text); deleteCommand.ExecuteReader(); db.Close(); } }
public void addMemo(string memoIdx, bool withEffect = false) { MemoItem button = (MemoItem)UIPackage.CreateObject("UIMain", "MemoItem").asCom; this.AddChild(button); MemoInfo info = null; GameStaticData.getInstance().memoInfo.TryGetValue(memoIdx, out info); if (info == null) { info = GameStaticData.getInstance().memoInfo["default"]; } button.memoId = info.memoId; allShownMemo.Add(button); button.SetXY(info.fixedX, info.fixedY); button.setDesp(info.desp); button.onChanged.Add(delegate() { if (button.selected) { if (selected.Count > MAX_COMBINATION_COUNT) { return; } selected.Add(button); } else { selected.Remove(button); } ((MemoPanel)(this.parent.asCom)).updateDetail(selected); }); if (withEffect) { button.alpha = 0; button.TweenFade(1, 1f).OnComplete(delegate() { ((MemoPanel)(this.parent.asCom)).combineCallback(); }); } }
public static TelegramReplyMessage RequestMemoHintMessage(TelegramMessage msg, MemoItem memo) { return(new TelegramReplyMessage { ChatId = msg.ChatId, ReplyMarkup = new ReplyKeyboardMarkup(new[] { new KeyboardButton(YesAnswer), new KeyboardButton(NoAnswer), }), Text = "Use this data?\n" + $"Type {memo.Type}\n" + $"Category: {memo.Category ?? "🚫"}\n" + $"Account from: {memo.AccountFrom ?? "🚫"}\n" + $"Account to: {memo.AccountTo ?? "🚫"}\n" }); }
/// <summary> /// 导航到MemoDetailPage /// </summary> /// <param name="memoItem"></param> public void NavagateToMemoDetailPage(MemoItem memoItem) { //throw new NotImplementedException(); _memoDetailFrame.Navigate(typeof(MemoDetailPage), memoItem); }
public RequestMemoHintQuery(TelegramMessage msg, MemoItem memoItem) : base(msg) { MemoItem = Guard.Against.Null(memoItem, nameof(memoItem)); }
private void ShareItem(MemoItem memoItem) { shared?.Invoke(this, memoItem); }
private void RemoveItem(MemoItem memoItem) { deleted?.Invoke(this, memoItem); }