private void createSession(string token, string user) { Sessions newSession = new Sessions(); newSession.Token = token; newSession.UserId = user; _hl7Context.Sessions.Add(newSession); _hl7Context.SaveChanges(); }
private async Task <Boolean> saveTransaction(PeticionEntrante ordersData, string messageString) { RequestBuilderUtil utilData = new RequestBuilderUtil(); Transacciones newTransaction = new Transacciones(); string orderID = utilData.compuseOrderId(ordersData.Orc4_placerGroupNumer); newTransaction.Peticion = messageString; newTransaction.Estado = 0; newTransaction.Fecha = DateTime.Now; newTransaction.Completas = 0; newTransaction.Pruebas = ordersData.ListaORB.Count(); newTransaction.Siapsid = orderID; newTransaction.Ox = ordersData.Orc1_orderControl; newTransaction.Orc = int.Parse(ordersData.Orc2_placerOrderNumer); if (newTransaction.Ox == CoreConfiguration.ModificacionString) { _context.RemoveRange(_context.His2lis.Where(data => data.Orden == orderID)); _context.RemoveRange(_context.Ohistidx.Where(data => data.Orden == orderID)); _context.RemoveRange(_context.Oficha.Where(data => data.Custom == decimal.Parse(orderID))); _context.RemoveRange(_context.OtPerfil.Where(data => data.OtPerfilOrder == decimal.Parse(orderID))); _context.RemoveRange(_context.Ot.Where(data => data.TCustom == decimal.Parse(orderID))); var deleteCount = _context.SaveChanges(); var oldTransaction = _hl7Context.Transacciones.Where(data => data.Siapsid == ordersData.Orc4_placerGroupNumer); foreach (Transacciones tran in oldTransaction) { tran.Estado = 8; } _hl7Context.Transacciones.UpdateRange(oldTransaction); _hl7Context.SaveChanges(); } _hl7Context.Transacciones.Add(newTransaction); var result = await _hl7Context.SaveChangesAsync(); return(result > 0); }