public static List <object> ColumnsMappings() { return(new List <object>() { TypesConverter.GetResource("STATIONS_NAME"), }); }
public static List <object> ColumnsMappings() { return(new List <object>() { TypesConverter.GetResource("TRAINS_ID"), TypesConverter.GetResource("TRAINS_START"), TypesConverter.GetResource("TRAINS_FINISH") }); }
public static List <object> ColumnsMappings() { return(new List <object>() { TypesConverter.GetResource("TRAINS_ID"), TypesConverter.GetResource("CARRIAGE_TYPE_NAME"), TypesConverter.GetResource("CARRIAGES_AMOUNT") }); }
public static List <object> ColumnsMappings() { return(new List <object>() { TypesConverter.GetResource("RACES_ID"), TypesConverter.GetResource("RACES_START_TIME"), TypesConverter.GetResource("RACES_FORWARD") }); }
public static List <object> ColumnsMappings() { return(new List <object>() { TypesConverter.GetResource("TRAINS_START"), TypesConverter.GetResource("TRAINS_FINISH"), TypesConverter.GetResource("TICKETS_CARRIAGE_NUMBER"), TypesConverter.GetResource("TICKETS_PLACE_NUMBER") }); }
public static List <object> ColumnsMappings() { return(new List <object>() { TypesConverter.GetResource("RACES_ID"), TypesConverter.GetResource("TRAINS_ID"), TypesConverter.GetResource("TRAINS_START"), TypesConverter.GetResource("TRAINS_FINISH"), TypesConverter.GetResource("ProfitRecord_Amount"), TypesConverter.GetResource("ProfitRecord_Profit") }); }
public void LanguageChanged() { int i = 0; foreach (ComboBoxItem item in TablesComboBox.Items) { string name = tables[i++]; if (name != "USERS" && name != "PERMISSION_TYPE") { item.Content = TypesConverter.GetResource(name); } } }
public static List <TrainDestinations> GetTrainsThroughStation(string name) { List <TrainDestinations> result = new List <TrainDestinations>(); RailwaysEntities context = RailwaysData.sharedContext; List <int> ID = GetCityIdByName(name); if (ID.Count == 0) { MessageBox.Show(String.Format(TypesConverter.GetResource("Queries_CityNotExist"), name)); return(result); } string filter = String.Format("And TRAINS.ID in (select STOPS.TRAIN_ID from STOPS where STOPS.STATION_ID={0})\n", ID[0]); List <TrainsDestinationHelp> help = GetTrainDestinationsHelp(filter); result = GetTrainDestinationsByHelpInfo(help); return(result); }
private void TablesComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var selectedItem = TablesComboBox.SelectedItem as ComboBoxItem; RailwaysEntities context = RailwaysData.sharedContext; string tableName = selectedItem.Tag as string; if (tableName != null) { curTableName = tableName; editingType = context.GetType().GetProperty(tableName).PropertyType.GetGenericArguments()[0]; dynamic query = context.GetType().GetProperty(tableName).GetValue(context, null); DataTab.ItemsSource = null; object collection = TypesConverter.CreateGenericList(editingType); MethodInfo mListAdd = collection.GetType().GetMethod("Add"); foreach (dynamic q in query) { mListAdd.Invoke(collection, new object[] { q }); } DataTab.ItemsSource = (IEnumerable)collection; DataTab.DataContext = context.GetType().GetProperty(tableName).GetValue(context, null); int numberOfDomains = RailwaysDBQueries.GetNumberOfDomainsInTable(tableName); for (int i = DataTab.Columns.Count - 1; i >= numberOfDomains; --i) { DataTab.Columns.RemoveAt(i); } columnsOriginalHeaders.Clear(); foreach (DataGridColumn column in DataTab.Columns) { column.IsReadOnly = curTableName == "TICKETS" || curTableName == "LOGTABLE" || curTableName == "LOGGINGACTIONS" || (column.Header as string) == "ID"; columnsOriginalHeaders.Add((string)column.Header); column.Header = TypesConverter.GetResource(curTableName + "_" + (column.Header as string)); } if (curTableName != "LOGTABLE" && curTableName != "LOGGINGACTIONS") { LoggingManager.LogAction(3, curTableName); } } }
public static List <RACE> GetProperRaces(string startCity, string finCity) { List <RACE> result = new List <RACE>(); RailwaysEntities context = RailwaysData.sharedContext; List <int> sID = GetCityIdByName(startCity); if (sID.Count == 0) { MessageBox.Show(String.Format(TypesConverter.GetResource("Queries_CityNotExist"), startCity)); return(result); } List <int> fID = GetCityIdByName(finCity); if (fID.Count == 0) { MessageBox.Show(String.Format(TypesConverter.GetResource("Queries_CityNotExist"), finCity)); return(result); } List <TrainIDAndStopNum> trains = context.ExecuteStoreQuery <TrainIDAndStopNum>("select one.TRAIN_ID,one.STOP_NUMBER,sn from(\n" + "select STOPS.TRAIN_ID,STOPS.STOP_NUMBER from STOPS where STATION_ID={0}) one\n" + "inner join\n" + "(select two.TRAIN_ID,two.STOP_NUMBER as sn from(\n" + "select STOPS.TRAIN_ID,STOPS.STOP_NUMBER from STOPS where STATION_ID={1}) two) three\n" + "on one.TRAIN_ID=three.TRAIN_ID", sID[0], fID[0]).ToList(); foreach (TrainIDAndStopNum tr in trains) { string condition = String.Empty; if (tr.STOP_NUMBER < tr.sn) { condition = " And FORWARD=0"; } if (tr.STOP_NUMBER > tr.sn) { condition = " And FORWARD=1"; } result.AddRange(context.ExecuteStoreQuery <RACE>("select * from RACES\n" + "where TRAIN_ID={0}" + condition, tr.TRAIN_ID).ToList()); } return(result); }
private void Window_Loaded(object sender, RoutedEventArgs e) { tables = RailwaysDBQueries.GetUserTablesNames(); for (int i = 0; i < tables.Count; ++i) { tables[i] = tables[i].Replace(" ", String.Empty); } if (tables != null) { foreach (string name in tables) { if (name != "USERS" && name != "PERMISSION_TYPE" && name != "sysdiagrams") { ComboBoxItem item = new ComboBoxItem(); item.Content = TypesConverter.GetResource(name); item.Tag = name; TablesComboBox.Items.Add(item); } } } ; }