/// <summary> /// Return the ChatDb object with interop properties /// </summary> /// <param name="id"></param> /// <returns></returns> public ChatDb GetExtended(long id) { ChatDb chat = Get(id); //chat.PlayersList = GetPlayersList(id); return(chat); }
// Here they will be #endregion #endregion public long Save(ChatDb chat) { EntityORM entity = EntityMapping.Map(chat, attributes); // Making sure that ID value is not touched. entity.attributeValue.Remove("ID"); long idChat = crud.Create(table, idColumn, entity); return(idChat); }
public Chat Get(long id) { ChatDb chat = chatDAO.GetExtended(id); Chat chat_newTyped = null; if (chat != null) { chat_newTyped = mapper.Map(chat); } return(chat_newTyped); }
public ChatDb Get(long id) { ChatDb chat = null; List <EntityORM> entities = (List <EntityORM>)(crud.Read(table, attributes, new DbTools.WhereRequest[] { new DbTools.WhereRequest(idColumn, DbTools.RequestOperator.Equal, id) })); if (entities.Any()) { EntityMapping.Map(entities[0], out chat); } return(chat); }
public ChatDb Get(long id) { ChatDb chat = null; EntityORM entity = crud.Read(id, idColumn, attributes, table); if (entity != null) { EntityMapping.Map(entity, out chat); } return(chat); }
// // ExibirChat // private void ExibirChat() { try { ErroOcultar(); chatRepeater.DataSource = ChatDb.UltimasMensagens(); chatRepeater.DataBind(); MultiView1.ActiveViewIndex = 1; } catch (Exception ex) { ErroExibir(ex.Message); } }
public void Update(ChatDb chat) { EntityORM entity = EntityMapping.Map(chat, attributes); entity.attributeValue.Remove("ID"); // getting sure that ID value is not touched bool ifUpdated = crud.Update(chat.Id, table, idColumn, entity); if (ifUpdated) { logger.Info($"Game with id={chat.Id} was successfully updated."); } else { logger.Info($"Updating chat with id={chat.Id} was failed."); } }
// Entrar // protected void entrarButton_Click(object sender, EventArgs e) { try { ErroOcultar(); string nome = nomeTextBox.Text; ChatDb.Entrar(nome); ViewState["nome"] = nome; ExibirChat(); mensagemTextBox.Focus(); mensagemTextBox.Text = string.Empty; } catch (Exception ex) { ErroExibir(ex.Message); } }
public ChatDb Map(Chat chat) { ChatDb chat_newType = new ChatDb(); #region Transfer main attributes chat_newType.Id = chat.Id; chat_newType.ChatName = chat.ChatName; #endregion #region Transfering interop attributes //EMPTY #endregion return(chat_newType); }
// // Enviar mensagem // protected void enviarMensagemButton_Click( object sender, EventArgs e) { string nome = (string)ViewState["nome"]; string mensagem = mensagemTextBox.Text; try { ErroOcultar(); ChatDb.EnviarMensagem(nome, mensagem); ExibirChat(); mensagemTextBox.Focus(); mensagemTextBox.Text = string.Empty; } catch (Exception ex) { ErroExibir(ex.Message); } }
///<summary> ///Maps properties from EntityORM object to ChatDb object ///</summary> public static void Map(EntityORM entity, out ChatDb chat) { chat = new ChatDb(); foreach (KeyValuePair <string, object> aV in entity.attributeValue) { switch (aV.Key) // entity attribute { case "ID": chat.Id = Convert.ToInt64(aV.Value); break; case "CHATNAME": chat.ChatName = aV.Value.ToString(); break; default: break; } } }
///<summary> ///Maps properties from ChatDb object to EntityORM object ///</summary> public static EntityORM Map(ChatDb chat, HashSet <string> attributes) { EntityORM entity = new EntityORM(); foreach (string attribute in attributes) { object value = null; // attribute value switch (attribute) { case "CHATNAME": value = $"\'{chat.ChatName}\'"; break; default: break; } entity.attributeValue.Add(attribute, value); } return(entity); }
public void Update(Chat chat) { ChatDb chatDb = mapper.Map(chat); chatDAO.Update(chatDb); }
public long Create(Chat chat) { ChatDb chatDb = mapper.Map(chat); return(chatDAO.Save(chatDb)); }
public ChatBLL(ChatDb chatDb, IUserContextAccessor userContextAccessor) { _userInfo = userContextAccessor.UserContext.UserInfo; _chatDb = chatDb; }