public static void ExecuteCommandWriter(IWriterService proxy, int op, X509Certificate2 signCert) { string name = ""; if (op != 0) { name = HelperFunctions.ReadDatabaseName(); } switch (op) { case 1: CheckIfExecuted(proxy.CreateDB(name, DigitalSignature.Create(name, "SHA1", signCert))); break; case 2: CheckIfExecuted(proxy.DeleteDB(name, DigitalSignature.Create(name, "SHA1", signCert))); break; case 3: Element tmpElem = Element.LoadFromConsole(); CheckIfExecuted(proxy.WriteDB(name, tmpElem, DigitalSignature.Create(name, "SHA1", signCert))); break; case 4: List <Element> elems = proxy.ReadDB(name, DigitalSignature.Create(name, "SHA1", signCert)); Console.WriteLine("Ids of all elements:"); DisplayAllElements(elems, true); Element toEdit = GetElementToEdit(elems); Element newElem = Element.LoadFromConsole(); newElem.Id = toEdit.Id; CheckIfExecuted(proxy.EditDB(name, newElem, DigitalSignature.Create(name, "SHA1", signCert))); break; case 5: DisplayAllElements(proxy.ReadDB(name, DigitalSignature.Create(name, "SHA1", signCert))); break; case 6: string city = HelperFunctions.ReadCity(); Console.Write("Prosecna plata za grad " + city + ": "); Console.WriteLine(proxy.MedianMonthlyIncomeByCity(name, city, DigitalSignature.Create(name, "SHA1", signCert))); break; case 7: string country = HelperFunctions.ReadCountry(); Console.WriteLine("Unesi godinu:"); int year = int.Parse(Console.ReadLine()); float medianMonthlyIncome = proxy.MedianMonthlyIncome(name, country, year, DigitalSignature.Create(name, "SHA1", signCert)); Console.WriteLine("Prosecna plata za " + country + " u " + year + " god.:" + medianMonthlyIncome); break; case 8: var tmpDict = proxy.MaxIncomeByCountry(name, DigitalSignature.Create(name, "SHA1", signCert)); Console.WriteLine("Najveca plata za svaku drzavu:"); foreach (KeyValuePair <string, Element> kvp in tmpDict) { Console.WriteLine(kvp.Key + " : id:" + kvp.Value.Id + " plata:" + kvp.Value.Income); } break; case 0: Console.WriteLine("Cao poz"); break; } }