public void AddEmoji(string groupId, string url) { using (var db = SugarContext.GetInstance()) { var result = db.Queryable <EMOJI>().Where(x => x.GROUP_ID == groupId).ToList().FirstOrDefault(); var list = new List <string>(); if (result == null) { list.Add(url); result = new EMOJI { ID = Guid.NewGuid().ToString("N").ToUpper(), DATETIME_CREATED = DateTime.Now, USER_CREATED = "SYS", STATE = "A", GROUP_ID = groupId, URLS = JsonConvert.SerializeObject(list) }; db.Insertable(result).ExecuteCommand(); } else { var rs = JsonConvert.DeserializeObject <List <string> >(result.URLS); if (!rs.Contains(url)) { rs.Add(url); } result.URLS = JsonConvert.SerializeObject(rs); db.Updateable(result).ExecuteCommand(); } } }
/// <summary> /// Get emoji array for the specified codepoint. /// </summary> /// <param name="codepoint"></param> /// <returns></returns> internal static string[] GetEmoji(string codepoint) { if (EMOJI.ContainsKey(codepoint)) { return(EMOJI[codepoint]); } if (ALTERNATES.ContainsKey(codepoint) && EMOJI.ContainsKey(ALTERNATES[codepoint])) { return(EMOJI[ALTERNATES[codepoint]]); } return(null); }