Ejemplo n.º 1
0
        public static void GuardarObjeto(ObjetoBase objetoGuardar)
        {
            Type tipo = objetoGuardar.GetType();

            if (!almacen.ContainsKey(tipo))
            {
                almacen.Add(tipo, new Dictionary <long, ObjetoBase>());
            }

            if (almacen[tipo].ContainsKey(objetoGuardar.Id))
            {
                if (ActivarLog)
                {
                    Log.EscribirLog("ALAMCEN <-   : ACTUALIZADO. [OBJETO: " + tipo.Name + " ID: " + objetoGuardar.Id + "]");
                }
                almacen[tipo][objetoGuardar.Id] = objetoGuardar;
            }
            else
            {
                if (ActivarLog)
                {
                    Log.EscribirLog("ALAMCEN <-   : AGREGADO [OBJETO: " + tipo.Name + " ID: " + objetoGuardar.Id + "]");
                }
                almacen[tipo].Add(objetoGuardar.Id, objetoGuardar);
            }
        }
Ejemplo n.º 2
0
        private Boolean existeObjetoModificado(ObjetoBase objAgregado)
        {
            foreach (ObjetoBase obj in objetosModificados)
            {
                Type t  = obj.GetType();
                Type t2 = objAgregado.GetType();

                if (t == t2 && objAgregado.Id == obj.Id)
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
 //agregar un elemento a lista
 public void AgregadoRapidoAListaRelacionada(ObjetoBase objeto, String nombreLista)
 {
     try
     {
         Type   tipo = this.GetType();
         String nombreTablaRelacion = tipo.Name + "_X_" + objeto.GetType().Name + "_" + nombreLista;
         objeto.dbAcceso = this.dbAcceso;
         long   idObjetoLista = objeto.Guardar();
         String query         = "insert into " + nombreTablaRelacion + "(_Contenedor, _Contenido) values (@_Contenedor, @_Contenido)";
         dbAcceso.EjecutarConsulta(query, new List <object>()
         {
             id, idObjetoLista
         });
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }