internal void CreateAndSharePrivately(User from, RaidDescription record) { var raid = new RaidParticipation { Raid = record }; var collection = DB.GetCollection <RaidParticipation>(); collection.Insert(raid); ShareRaidToChat(raid, from.ID); }
private void GetOrCreateRaidDescriptionForUser(User user, out DbSet <RaidDescription> collection, out RaidDescription record) { collection = DB.GetCollection <RaidDescription>(); record = collection.Find(x => x.User.ID == user.ID).FirstOrDefault(); if (null == record) { record = new RaidDescription { User = user, }; collection.Insert(record); } }
private InlineKeyboardMarkup CreateWizardMarkup(User user, RaidDescription record) { InlineKeyboardMarkup result = new InlineKeyboardMarkup(); result.inline_keyboard = new List <List <InlineKeyboardButton> >(); List <InlineKeyboardButton> row; row = new List <InlineKeyboardButton>(); row.Add(new InlineKeyboardButton { text = (string.IsNullOrEmpty(record.Raid) ? "" : "✅ ") + _HTML_(I18N.GetString("Raid")), callback_data = CbqRaid }); row.Add(new InlineKeyboardButton { text = (string.IsNullOrEmpty(record.Gym) ? "" : "✅ ") + _HTML_(I18N.GetString("Gym")), callback_data = CbqGym }); row.Add(new InlineKeyboardButton { text = _HTML_(I18N.GetString("Alignment")), callback_data = CbqAlignment }); result.inline_keyboard.Add(row); row = new List <InlineKeyboardButton>(); row.Add(new InlineKeyboardButton { text = (record.RaidEndTime != default(DateTime) && record.RaidEndTime >= DateTime.UtcNow ? "✅ " : "") + _HTML_(I18N.GetString("Time")), callback_data = CbqTime }); row.Add(new InlineKeyboardButton { text = _HTML_(I18N.GetString("🗑 Reset")), callback_data = CbqClear }); result.inline_keyboard.Add(row); row = new List <InlineKeyboardButton>(); row.Add(new InlineKeyboardButton { text = _HTML_(I18N.GetString("💾 Done")), callback_data = CbqDone }); result.inline_keyboard.Add(row); return(result); }