private static Action ParseLogic(this int slot) { _act = null; var petGuid = GoldenPet.GetGuidInSlot(slot); var petInfo = GoldenPet.GetPetInfo(petGuid); var objectType = new Logic.Logic(); var name = "Npc" + petInfo.EntryId; var methodInfo = objectType.GetType().GetMethod(name); if (methodInfo != null) { Logging.Write(Color.MediumSpringGreen, "Найдена логика для пета ID:{0} из слота:{1}", petInfo.EntryId, slot); Action method = delegate { methodInfo.Invoke(objectType, null); }; _act = method; } if (methodInfo != null) { return(_act); } Logging.Write(Color.MediumSpringGreen, "Не найдена логика для пета ID:{0} из слота:{1}", petInfo.EntryId, slot); if (PetBattleEasy.Only1) { _act = GetOnly1; } if (!PetBattleEasy.Only1) { _act = GetCastInstant; } //_act += delegate { GoldenPet.GetChangePet(); }; return(_act); }
private void StartProgram(Settings p_Settings) { Logger.SetLogger(new FormLogger(richTextBox1, LogLevel.Info)); Task.Run(() => { try { _logic = new Logic.Logic(p_Settings, gMapControl1, summaryPanel); _logic.Execute().Wait(); } catch (PtcOfflineException) { Logger.Write("PTC Servers are probably down OR your credentials are wrong. Try google", LogLevel.Error); Logger.Write("Trying again in 20 seconds..."); Thread.Sleep(20000); new Logic.Logic(new Settings(), gMapControl1, summaryPanel).Execute().Wait(); } catch (AccountNotVerifiedException) { Logger.Write("Account not verified. - Exiting"); Environment.Exit(0); } catch (Exception ex) { Logger.Write($"Unhandled exception: {ex}", LogLevel.Error); new Logic.Logic(new Settings(), gMapControl1, summaryPanel).Execute().Wait(); } }); System.Console.ReadLine(); }
public void saveClient(Logic.Logic logic, Client client) { if (logic.clients.allClients.Where(x => x.id == client.id).Count() > 0) { updateClient(client); } else { createClient(client); } updateClients(logic); }
public void saveCategory(Logic.Logic logic, Category cat) { if (logic.orders.allOrders.Where(x => x.id == cat.id).Count() > 0) { updateCategory(cat); } else { createCategory(cat); } updateCategories(); }
public void saveOrder(Logic.Logic logic, Order order) { if (logic.orders.allOrders.Where(x => x.id == order.id).Count() > 0) { updateOrder(order); } else { createOrder(order); } updateOrders(); }
private void updateOrderInfo(Logic.Logic logic, double rowHeight) { FullCompositionLabel.FontSize = FONT_SIZE_HIGHLIGHT * scaleFont; FullCompositionTextBlock.FontSize = FONT_SIZE_NORMAL * scaleFont; FullCompositionTextBlock.Text = string.Empty; HistoryLabel.FontSize = FONT_SIZE_HIGHLIGHT * scaleFont; HistoryTextBlock.FontSize = FONT_SIZE_NORMAL * scaleFont; if (logic.orders.selectedOrder != null) { List <OrderItem> composition = logic.orders.allOrderItems.Where(x => x.order_id == logic.orders.selectedOrder.id).ToList(); for (int index = 0; index < composition.Count(); index++) { string s = composition[index].getFullName(logic, true) + Environment.NewLine; var parts = s.Split(new[] { "<b>", "</b>" }, StringSplitOptions.None); bool isbold = false; foreach (var part in parts) { if (isbold) { FullCompositionTextBlock.Inlines.Add(new Bold(new Run(part))); } else { FullCompositionTextBlock.Inlines.Add(new Run(part)); } isbold = !isbold; } } HistoryTextBlock.Text = string.Empty; List <OrderLog> history = logic.orders.allOrderLogs.Where(x => x.id_order == logic.orders.selectedOrder.id).OrderByDescending(x => x.version).ToList(); for (int i = 0; i < history.Count(); i++) { DateTime time = DateTime.Parse(history[i].moment); HistoryTextBlock.Inlines.Add(new Run(string.Format("{0}.{1} {2}:{3}, ", time.Day, time.Month, time.Hour, time.Minute))); HistoryTextBlock.Inlines.Add(new Run(string.Format("{0}({1})(вер.{2}), \n", history[i].host, logic.auth.usersFromDB.First(x => x.id == history[i].id_user).name, history[i].version))); HistoryTextBlock.Inlines.Add(new Run(string.Format("{0}, \n", history[i].action))); HistoryTextBlock.Inlines.Add(new Run(string.Format("{0}, \n{1}\n\n", history[i].value_was, history[i].value_now))); } } }
private void btnCalculate_Click(object sender, EventArgs e) { Logic.Logic logic = new Logic.Logic(); CalculateVatRequest request = CreateCalculateVatRequest(); CalculateVatResponse response = logic.HandleCalculateRequest(request) as CalculateVatResponse; if (response != null && response.IsValid) { //zakładając że chcemy zaokrąglenie response.Result = Math.Round(response.Result, 2, MidpointRounding.AwayFromZero); tbBrutto.Text = String.Format("{0:0.##}", response.Result); } else { // można też gdzieś wrzucić komunikaty walidacyjne tbBrutto.Text = String.Empty; } }
public string getFullName(Logic.Logic logic, bool bold = false) { string fullName = string.Format("<b>{0} шт.</b>, {1}({2}), ", size, name, id_catalog); var addins = logic.orders.allOrderItemAddins.Where(x => x.id_order_item == id); foreach (var addin in addins) { fullName = string.Format("{0}{1}{2}, ", fullName, addin.remove ? "-" : "+", logic.products.allAddins.Where(x => x.id == addin.id_addin).First()); } fullName = string.Format("{0}<b>{1} руб.</b>", fullName, price * count); if (!bold) { fullName = fullName.Replace("<b>", string.Empty); fullName = fullName.Replace("</b>", string.Empty); } return(fullName); }
public static Task MemberJoin(VoiceStateUpdateEventArgs e) { var chn = e.Channel; Logic.Logic lg = Logic.Logic.GetInstanse(); if (!lg.isStarted(e.Guild)) { return(Task.CompletedTask); } if (chn != null) { var _participants = chn.Users.ToList(); for (int i = 0; i < _participants.Count; i++) { if (_participants[i].IsBot == true) { _participants.Remove(_participants[i]); } } lg.updateParticipants(_participants, e.Guild); } return(Task.CompletedTask); }
public RunLogics() { Console.WriteLine("Enter Student Number"); StudentNum = int.Parse(Console.ReadLine()); Logics = new Logic.Logic(); }
public void updateClients(Logic.Logic logic) { logic.clients.allClients = getClients(); }
private void updateFilterInfo(Logic.Logic logic, double rowHeight) { rowHeight /= 4; DateLabel.Margin = new Thickness(0, rowHeight * 0, 0, 0); DateLabel.FontSize = FONT_SIZE_NORMAL * scaleFont; DateGrid.Margin = new Thickness(0, rowHeight * 1, 0, 0); DateFrom.FontSize = FONT_SIZE_NORMAL * scaleFont; DateTo.FontSize = FONT_SIZE_NORMAL * scaleFont; DateGrid.Height = rowHeight; TimeLabel.Margin = new Thickness(0, rowHeight * 2, 0, 0); TimeLabel.FontSize = FONT_SIZE_NORMAL * scaleFont; TimeGrid.Margin = new Thickness(0, rowHeight * 3, 0, 0); TimeFrom.FontSize = FONT_SIZE_NORMAL * scaleFont; TimeTo.FontSize = FONT_SIZE_NORMAL * scaleFont; TimeGrid.Height = rowHeight; NumberLabel.Margin = new Thickness(0, rowHeight * 4, 0, 0); NumberLabel.FontSize = FONT_SIZE_NORMAL * scaleFont; NumberGrid.Margin = new Thickness(0, rowHeight * 5, 0, 0); NumberFrom.FontSize = FONT_SIZE_NORMAL * scaleFont; NumberTo.FontSize = FONT_SIZE_NORMAL * scaleFont; NumberGrid.Height = rowHeight; PhoneLabel.Margin = new Thickness(0, rowHeight * 6, 0, 0); PhoneLabel.FontSize = FONT_SIZE_NORMAL * scaleFont; PhoneGrid.Margin = new Thickness(0, rowHeight * 7, 0, 0); PhoneText.FontSize = FONT_SIZE_NORMAL * scaleFont; PhoneGrid.Height = rowHeight; CategoryLabel.Margin = new Thickness(0, rowHeight * 8, 0, 0); CategoryLabel.FontSize = FONT_SIZE_NORMAL * scaleFont; CategoryGrid.Margin = new Thickness(0, rowHeight * 9, 0, 0); CategoryText.FontSize = FONT_SIZE_NORMAL * scaleFont; CategoryGrid.Height = rowHeight; ProductLabel.Margin = new Thickness(0, rowHeight * 10, 0, 0); ProductLabel.FontSize = FONT_SIZE_NORMAL * scaleFont; ProductGrid.Margin = new Thickness(0, rowHeight * 11, 0, 0); ProductText.FontSize = FONT_SIZE_NORMAL * scaleFont; ProductGrid.Height = rowHeight; DiscountLabel.Margin = new Thickness(0, rowHeight * 12, 0, 0); DiscountLabel.FontSize = FONT_SIZE_NORMAL * scaleFont; DiscountGrid.Margin = new Thickness(0, rowHeight * 13, 0, 0); DiscountFrom.FontSize = FONT_SIZE_NORMAL * scaleFont; DiscountTo.FontSize = FONT_SIZE_NORMAL * scaleFont; DiscountGrid.Height = rowHeight; DeletedGrid.Margin = new Thickness(0, rowHeight * 14, 0, 0); DeletedLabel.FontSize = FONT_SIZE_NORMAL * scaleFont; }
/// <summary> /// This method keeps the main thread alive, and displays the menu. /// </summary> internal void Watcher() { this.Help(); while (this.run) { string s = Console.ReadLine(); int i; bool b = int.TryParse(s, out i); while (!b) { Console.WriteLine("Hibás Opció! Listázom a lehetőségeket."); this.Help(); s = Console.ReadLine(); b = int.TryParse(s, out i); } Logic.Logic logic = new Logic.Logic(); try { switch (i) { case 1: { Console.WriteLine("Listázom az összes elérhető adatbázis neveket."); List <string> list = logic.GetAllTableNames(); Console.WriteLine(string.Join(", ", list)); break; } case 2: { List <string> list = logic.GetAllTableNames(); Console.WriteLine("Írd be a tábla nevét amiből listázni szeretnél!"); string dbname = Console.ReadLine(); while (!list.Contains(dbname)) { Console.WriteLine("Írd be a tábla nevét amiből listázni szeretnél!"); dbname = Console.ReadLine(); } Console.WriteLine(dbname + " LISTÁZÁS."); Console.WriteLine(); if (dbname == "extrak") { Console.WriteLine(logic.GetExtrasData()); } else if (dbname == "modellek") { Console.WriteLine(logic.GetCarsData()); } else if (dbname == "automarkak") { Console.WriteLine(logic.GetBrandsData()); } else if (dbname == "modellextrakapcsolo") { Console.WriteLine(logic.GetModelExtraKeysData()); } break; } case 3: { List <string> list = logic.GetAllTableNames(); Console.WriteLine("Írd be a tábla nevét ahova hozzá kívánsz adni értéket!"); string dbname = Console.ReadLine(); while (!list.Contains(dbname)) { Console.WriteLine("Írd be a tábla nevét ahova hozzá kívánsz adni értéket!"); dbname = Console.ReadLine(); } if (dbname == "extrak") { // string categoryname, string name, int price, string color, bool canbeusedmoretimes Console.WriteLine("Írj be egy kategória nevet."); string category = Console.ReadLine(); Console.WriteLine("Írj be egy nevet hozzá."); string name = Console.ReadLine(); Console.WriteLine("Írj be egy árat."); string price = Console.ReadLine(); int pricee; bool b2 = int.TryParse(price, out pricee); while (!b2) { Console.WriteLine("Írj be egy árat."); price = Console.ReadLine(); b2 = int.TryParse(price, out pricee); } Console.WriteLine("Írj be egy színt."); string color = Console.ReadLine(); Console.WriteLine("Többször használható? 0 - Nem, 1 - Igen"); string canbeused = Console.ReadLine(); int canbeusedmorenumber; bool b3 = int.TryParse(canbeused, out canbeusedmorenumber); while (!b3 || (canbeusedmorenumber != 0 && canbeusedmorenumber != 1)) { Console.WriteLine("Többször használható? 0 - Nem, 1 - Igen"); canbeused = Console.ReadLine(); b3 = int.TryParse(canbeused, out canbeusedmorenumber); } bool success = logic.InsertExtraData(category, name, pricee, color, canbeusedmorenumber == 1); string text = success ? "Sikeres bevitel." : "Sikertelen bevitel"; Console.WriteLine(text); } else if (dbname == "modellek") { // int brandid, string name, DateTime releasedate, int enginevolume, int horsepower, int baseprice Console.WriteLine( "Ahhoz, hogy egy új autót adj hozzá, már léteznie kell a márkájának az adatbázisban. Szükséged lesz az ID-jére."); Console.WriteLine("Megvan már? y / n?"); string yorno = Console.ReadLine(); if (yorno != "n") { BrandDoesntExist: Console.WriteLine("Írd be a márka ID-jét!"); string id = Console.ReadLine(); int idy; bool b2 = int.TryParse(id, out idy); while (!b2) { Console.WriteLine("Írd be a márka ID-jét!"); id = Console.ReadLine(); b2 = int.TryParse(id, out idy); } if (!logic.CheckIfBrandExists(idy)) { Console.WriteLine("Nem létezik a márka id!"); goto BrandDoesntExist; } Console.WriteLine("Írd be az autó nevét!"); string carname = Console.ReadLine(); Console.WriteLine("Írd be az autó megjelenésének dátumát! (yyyy-mm-dd)"); string cardate = Console.ReadLine(); DateTime cardatey; bool b3 = DateTime.TryParse(cardate, out cardatey); while (!b3) { Console.WriteLine("Írd be az autó megjelenésének dátumát! (yyyy-mm-dd)"); cardate = Console.ReadLine(); b3 = DateTime.TryParse(cardate, out cardatey); } Console.WriteLine("Írd be az autó motortérfogatát!"); string carvolume = Console.ReadLine(); int carvolumey; bool b4 = int.TryParse(carvolume, out carvolumey); while (!b4) { Console.WriteLine("Írd be az autó motortérfogatát!"); carvolume = Console.ReadLine(); b4 = int.TryParse(carvolume, out carvolumey); } Console.WriteLine("Írd be az autó lóerejét!"); string carhorse = Console.ReadLine(); int carhorsey; bool b5 = int.TryParse(carhorse, out carhorsey); while (!b5) { Console.WriteLine("Írd be az autó lóerejét!"); carhorse = Console.ReadLine(); b5 = int.TryParse(carhorse, out carhorsey); } Console.WriteLine("Írd be az autó árát!"); string carprice = Console.ReadLine(); int carpricey; bool b6 = int.TryParse(carprice, out carpricey); while (!b6) { Console.WriteLine("Írd be az autó árát!"); carprice = Console.ReadLine(); b6 = int.TryParse(carprice, out carpricey); } bool success = logic.InsertCarData(idy, carname, cardatey, carvolumey, carhorsey, carpricey); string text = success ? "Sikeres bevitel." : "Sikertelen bevitel"; Console.WriteLine(text); } } else if (dbname == "automarkak") { // string name, string country, string url, int foundation, int annualtraffic Console.WriteLine("Írj be egy márkanevet."); string name = Console.ReadLine(); Console.WriteLine("Írj be egy ország nevet ahonnan származik."); string country = Console.ReadLine(); Console.WriteLine("Írd be a weboldalát a márkának."); string web = Console.ReadLine(); Console.WriteLine("Írd be a márka alapításának évét."); string foundation = Console.ReadLine(); int foundationy; bool b2 = int.TryParse(foundation, out foundationy); while (!b2) { Console.WriteLine("Írd be a márka alapításának évét."); foundation = Console.ReadLine(); b2 = int.TryParse(foundation, out foundationy); } Console.WriteLine("Írd be a márka éves forgalmát."); string annual = Console.ReadLine(); int annualy; bool b3 = int.TryParse(annual, out annualy); while (!b3) { Console.WriteLine("Írd be a márka éves forgalmát."); annual = Console.ReadLine(); b3 = int.TryParse(annual, out annualy); } bool success = logic.InsertBrandData(name, country, web, foundationy, annualy); string text = success ? "Sikeres bevitel." : "Sikertelen bevitel"; Console.WriteLine(text); } else if (dbname == "modellextrakapcsolo") { ReAddExtraShit: Console.WriteLine("Írd be melyik autó idhez adjunk hozzá extrát!"); string carid = Console.ReadLine(); int caridy; bool b2 = int.TryParse(carid, out caridy); while (!b2) { Console.WriteLine("Írd be melyik autó idhez adjunk hozzá extrát!"); carid = Console.ReadLine(); b2 = int.TryParse(carid, out caridy); } Console.WriteLine("Írd be a hozzáadandó extra idjét!"); string extraid = Console.ReadLine(); int extraidy; bool b3 = int.TryParse(extraid, out extraidy); while (!b3) { Console.WriteLine("Írd be a hozzáadandó extra idjét!"); extraid = Console.ReadLine(); b3 = int.TryParse(extraid, out extraidy); } if (!logic.DoesCarExist(caridy)) { Console.WriteLine("Az autó ID nem is létezik!"); goto ReAddExtraShit; } if (!logic.DoesExtraExist(extraidy)) { Console.WriteLine("Az extra ID nem is létezik!"); goto ReAddExtraShit; } bool success = logic.InsertCarExtraData(caridy, extraidy); string text = success ? "Sikeres bevitel." : "Sikertelen bevitel"; Console.WriteLine(text); } else { Console.WriteLine("Hibás opció!"); } break; } case 4: { List <string> list = logic.GetAllTableNames(); Console.WriteLine("Írd be a tábla nevét amiből törölni szeretnél!"); string dbname = Console.ReadLine(); while (!list.Contains(dbname)) { Console.WriteLine("Írd be a tábla nevét amiből törölni szeretnél!"); dbname = Console.ReadLine(); } Console.WriteLine("Írd be a törlendő rekord azonosítóját!"); string idofval = Console.ReadLine(); int idofvaly; bool b2 = int.TryParse(idofval, out idofvaly); while (!b2) { Console.WriteLine("Írd be a törlendő rekord azonosítóját!"); idofval = Console.ReadLine(); b2 = int.TryParse(idofval, out idofvaly); } bool success; if (dbname == "extrak") { success = logic.DeleteExtraData(idofvaly); } else if (dbname == "automarkak") { success = logic.DeleteBrandData(idofvaly); } else if (dbname == "modellek") { success = logic.DeleteCarData(idofvaly); } else { Console.WriteLine("Nincs ilyen opció!"); return; } string text = success ? "Sikeres törlés." : "Sikertelen törlés"; Console.WriteLine(text); break; } case 5: { List <string> list = logic.GetAllTableNames(); Console.WriteLine("Írd be a tábla nevét amiben rekordot szeretnél módosítani!"); string dbname = Console.ReadLine(); while (!list.Contains(dbname)) { Console.WriteLine("Írd be a tábla nevét amiben rekordot szeretnél módosítani!"); dbname = Console.ReadLine(); } IDDoesNotExist: Console.WriteLine("Írd be a kiválasztott rekord ID-jét!"); string dbid = Console.ReadLine(); int dbidy; bool b2 = int.TryParse(dbid, out dbidy); while (!b2) { Console.WriteLine("Írd be a kiválasztott rekord ID-jét!"); dbid = Console.ReadLine(); b2 = int.TryParse(dbid, out dbidy); } if (dbname == "extrak") { if (!logic.CheckIfExtraIDExists(dbidy)) { Console.WriteLine("Nincs ilyen ID a " + dbname + " nevű táblában!"); goto IDDoesNotExist; } Console.WriteLine("Írj be egy kategória nevet."); string category = Console.ReadLine(); Console.WriteLine("Írj be egy nevet hozzá."); string name = Console.ReadLine(); Console.WriteLine("Írj be egy árat."); string price = Console.ReadLine(); int pricee; bool b22 = int.TryParse(price, out pricee); while (!b22) { Console.WriteLine("Írj be egy árat."); price = Console.ReadLine(); b22 = int.TryParse(price, out pricee); } Console.WriteLine("Írj be egy színt."); string color = Console.ReadLine(); Console.WriteLine("Többször használható? 0 - Nem, 1 - Igen"); string canbeused = Console.ReadLine(); int canbeusedmorenumber; bool b3 = int.TryParse(canbeused, out canbeusedmorenumber); while (!b3 || (canbeusedmorenumber != 0 && canbeusedmorenumber != 1)) { Console.WriteLine("Többször használható? 0 - Nem, 1 - Igen"); canbeused = Console.ReadLine(); b3 = int.TryParse(canbeused, out canbeusedmorenumber); } bool success = logic.UpdateExtraData(dbidy, category, name, pricee, color, canbeusedmorenumber == 1); string text = success ? "Sikeres update." : "Sikertelen update"; Console.WriteLine(text); } else if (dbname == "automarkak") { if (!logic.CheckIfBrandExists(dbidy)) { Console.WriteLine("Nincs ilyen ID a " + dbname + " nevű táblában!"); goto IDDoesNotExist; } Console.WriteLine("Írj be egy márkanevet."); string name = Console.ReadLine(); Console.WriteLine("Írj be egy ország nevet ahonnan származik."); string country = Console.ReadLine(); Console.WriteLine("Írd be a weboldalát a márkának."); string web = Console.ReadLine(); Console.WriteLine("Írd be a márka alapításának évét."); string foundation = Console.ReadLine(); int foundationy; bool b22 = int.TryParse(foundation, out foundationy); while (!b22) { Console.WriteLine("Írd be a márka alapításának évét."); foundation = Console.ReadLine(); b22 = int.TryParse(foundation, out foundationy); } Console.WriteLine("Írd be a márka éves forgalmát."); string annual = Console.ReadLine(); int annualy; bool b3 = int.TryParse(annual, out annualy); while (!b3) { Console.WriteLine("Írd be a márka éves forgalmát."); annual = Console.ReadLine(); b3 = int.TryParse(annual, out annualy); } bool success = logic.UpdateBrandData(dbidy, name, country, web, foundationy, annualy); string text = success ? "Sikeres update." : "Sikertelen update"; Console.WriteLine(text); } else if (dbname == "modellek") { if (!logic.CheckIfCarIDExists(dbidy)) { Console.WriteLine("Nincs ilyen ID a " + dbname + " nevű táblában!"); goto IDDoesNotExist; } BrandDoesntExist: Console.WriteLine("Írd be a márka ID-jét!"); string id = Console.ReadLine(); int idy; bool b22 = int.TryParse(id, out idy); while (!b22) { Console.WriteLine("Írd be a márka ID-jét!"); id = Console.ReadLine(); b22 = int.TryParse(id, out idy); } if (!logic.CheckIfBrandExists(idy)) { Console.WriteLine("Nem létezik a márka id!"); goto BrandDoesntExist; } Console.WriteLine("Írd be az autó nevét!"); string carname = Console.ReadLine(); Console.WriteLine("Írd be az autó megjelenésének dátumát! (yyyy-mm-dd)"); string cardate = Console.ReadLine(); DateTime cardatey; bool b3 = DateTime.TryParse(cardate, out cardatey); while (!b3) { Console.WriteLine("Írd be az autó megjelenésének dátumát! (yyyy-mm-dd)"); cardate = Console.ReadLine(); b3 = DateTime.TryParse(cardate, out cardatey); } Console.WriteLine("Írd be az autó motortérfogatát!"); string carvolume = Console.ReadLine(); int carvolumey; bool b4 = int.TryParse(carvolume, out carvolumey); while (!b4) { Console.WriteLine("Írd be az autó motortérfogatát!"); carvolume = Console.ReadLine(); b4 = int.TryParse(carvolume, out carvolumey); } Console.WriteLine("Írd be az autó lóerejét!"); string carhorse = Console.ReadLine(); int carhorsey; bool b5 = int.TryParse(carhorse, out carhorsey); while (!b5) { Console.WriteLine("Írd be az autó lóerejét!"); carhorse = Console.ReadLine(); b5 = int.TryParse(carhorse, out carhorsey); } Console.WriteLine("Írd be az autó árát!"); string carprice = Console.ReadLine(); int carpricey; bool b6 = int.TryParse(carprice, out carpricey); while (!b6) { Console.WriteLine("Írd be az autó árát!"); carprice = Console.ReadLine(); b6 = int.TryParse(carprice, out carpricey); } bool success = logic.UpdateCarData(dbidy, idy, carname, cardatey, carvolumey, carhorsey, carpricey); string text = success ? "Sikeres update." : "Sikertelen update"; Console.WriteLine(text); } else if (dbname == "modellextrakapcsolo") { Console.WriteLine("Írd be a törlendő carextra idjét!"); string extraid = Console.ReadLine(); int extraidy; bool b3 = int.TryParse(extraid, out extraidy); while (!b3) { Console.WriteLine("Írd be a törlendő carextra idjét!"); extraid = Console.ReadLine(); b3 = int.TryParse(extraid, out extraidy); } bool success = logic.DeleteCarExtraKey(extraidy); string text = success ? "Sikeres törlés." : "Sikertelen törlés"; Console.WriteLine(text); } else { Console.WriteLine("Nincs ilyen opció!"); return; } break; } case 6: { List <string> list = logic.GetAllTableNames(); Console.WriteLine("Írd be a tábla nevét amiben átlagot szeretnél lekérdezni!"); string dbname = Console.ReadLine(); while (!list.Contains(dbname)) { Console.WriteLine("Írd be a tábla nevét amiben átlagot szeretnél lekérdezni!"); dbname = Console.ReadLine(); } if (dbname == "extrak") { Console.WriteLine("Írj be egy létező extra színt! Akár lehet 'nincs' is."); Console.WriteLine("Ha érvénytelen a program -1-t fog visszadobni."); string color = Console.ReadLine(); float avg = logic.GetAverageForExtraColor(color); Console.WriteLine("Átlag a " + color + " színre: " + avg); } else if (dbname == "automarkak") { BrandDoesntExist: Console.WriteLine("Írd be a márka ID-jét!"); string id = Console.ReadLine(); int idy; bool b22 = int.TryParse(id, out idy); while (!b22) { Console.WriteLine("Írd be a márka ID-jét!"); id = Console.ReadLine(); b22 = int.TryParse(id, out idy); } if (!logic.CheckIfBrandExists(idy)) { Console.WriteLine("Nem létezik a márka id!"); goto BrandDoesntExist; } float avg = logic.GetAverageAmountForBrand(idy); Console.WriteLine("Átlag a márkákban: " + avg); } else if (dbname == "modellek") { Console.WriteLine("Írj be egy létező ország nevet!"); Console.WriteLine("Ha érvénytelen a program -1-t fog visszadobni."); string country = Console.ReadLine(); float avg = logic.GetAverageAmountForBrandByCountry(country); Console.WriteLine("Átlag a " + country + " országra nézve: " + avg); } else { Console.WriteLine("Nincs ilyen opció!"); return; } break; } case 7: { WebClient client = new WebClient(); Console.WriteLine("Adj meg egy ár minimum értéket!"); string pricemin = Console.ReadLine(); Console.WriteLine("Adj meg egy ár maximum értéket!"); string pricemax = Console.ReadLine(); Console.WriteLine("Adj meg egy minimum év értéket!"); string yearmin = Console.ReadLine(); Console.WriteLine("Adj meg egy maximum év értéket!"); string yearmax = Console.ReadLine(); Console.WriteLine("Adj meg egy minimum motortérfogat értéket!"); string enginevolumemin = Console.ReadLine(); Console.WriteLine("Adj meg egy maximum motortérfogat értéket!"); string enginevolumemax = Console.ReadLine(); Console.WriteLine("Adj meg egy minimum lóerő értéket!"); string horsemin = Console.ReadLine(); Console.WriteLine("Adj meg egy maximum lóerő értéket!"); string horsemax = Console.ReadLine(); client.Encoding = Encoding.UTF8; string fullresponse = client.DownloadString(Program.JAVAURL + "?releasedate=" + yearmin + "-" + yearmax + "&enginevolume=" + enginevolumemin + "-" + enginevolumemax + "&horsepower=" + horsemin + "-" + horsemax + "&baseprice=" + pricemin + "-" + pricemax); if (fullresponse.Contains("Hiba!") || fullresponse.Contains("Hibás") || fullresponse.Contains("SYNTAX")) { Console.WriteLine("HIBÁS LEKÉRDEZÉS: " + fullresponse); } else { Console.WriteLine("Válasz: " + fullresponse); CarJSONData car = JsonConvert.DeserializeObject <CarJSONData>(fullresponse); int releasedate = int.Parse(car.RELEASEDATE); int enginevolume = int.Parse(car.ENGINEVOLUME); int horsepower = int.Parse(car.HORSEPOWER); int baseprice = int.Parse(car.BASEPRICE); BrandDoesntExist: Console.WriteLine("Írd be az autó márka ID-jét!"); string id = Console.ReadLine(); int idy; bool b2 = int.TryParse(id, out idy); while (!b2) { Console.WriteLine("Írd be az autó márka ID-jét!"); id = Console.ReadLine(); b2 = int.TryParse(id, out idy); } if (!logic.CheckIfBrandExists(idy)) { Console.WriteLine("Nem létezik a márka id!"); goto BrandDoesntExist; } Console.WriteLine("Adj meg egy autó típusának nevét végül a folytatáshoz!"); string carname = Console.ReadLine(); bool success = logic.InsertCarData(idy, carname, new DateTime(releasedate, 1, 10), enginevolume, horsepower, baseprice); string text = success ? "Sikeres bevitel." : "Sikertelen bevitel"; Console.WriteLine(text); } break; } default: { Console.WriteLine("Hibás Opció! Listázom a lehetőségeket."); this.Help(); break; } } } catch (Exception ex) { Console.WriteLine("Hiba történt: " + ex.Message); } } }