Ejemplo n.º 1
0
        public bool DeleteDB(string name)
        {
            Console.WriteLine("Command: DELETEDB " + name);
            Database db = new Database(name);

            ReplicatorProxy.DeleteDataBaseReplicator(name);
            return(db.DeleteDB());
        }
Ejemplo n.º 2
0
        public bool WriteDB(string name, Element e)
        {
            Console.WriteLine("Command: WriteDB " + name);
            Database db        = new Database(name);
            bool     returnVal = db.AddElement(e);

            ReplicatorProxy.SendUpdateToReplicator(db);
            return(returnVal);
        }
Ejemplo n.º 3
0
        public bool EditDB(string name, Element element)
        {
            Console.WriteLine("Command: EDIT " + name);
            Database db        = new Database(name);
            bool     returnVal = db.EditElement(element);

            ReplicatorProxy.SendUpdateToReplicator(db);
            return(returnVal);
        }
Ejemplo n.º 4
0
        public bool CreateDB(string name)
        {
            Console.WriteLine("Command: CREATEDB " + name);
            Database db = new Database(name);

            db.ForceSaveToDisk();
            //cisto reda radi da postoji kopija prazne baze hahaha :D
            ReplicatorProxy.SendUpdateToReplicator(db);
            return(true);
        }
Ejemplo n.º 5
0
 public static void SendUpdateToReplicator(Database db)
 {
     try {
         using (ReplicatorProxy rp = new ReplicatorProxy(new NetTcpBinding(), Config.ReplicatorServiceAddress)) {
             rp.SendElements(db.Name, db.Elements);
         }
     } catch {
         Console.WriteLine("Error while connecting to DBReplicator service. Database is not replicated");
     }
 }
Ejemplo n.º 6
0
 public static void DeleteDataBaseReplicator(string databaseName)
 {
     try
     {
         using (ReplicatorProxy rp = new ReplicatorProxy(new NetTcpBinding(), Config.ReplicatorServiceAddress))
         {
             rp.DeleteDataBase(databaseName);
         }
     }
     catch
     {
         Console.WriteLine("Error while connecting to DBReplicator service. Database is not replicated");
     }
 }