public bool DeleteDB(string name) { Console.WriteLine("Command: DELETEDB " + name); Database db = new Database(name); ReplicatorProxy.DeleteDataBaseReplicator(name); return(db.DeleteDB()); }
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); }
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); }
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); }
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"); } }
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"); } }