Example #1
0
 public void CheckActivateCabinet()
 {
     string[] args = { Login + "@localhost" };
     AvailableTicketsCount = AL.CatchIntResult(Connected, "call throwCountAvailableTickets", args);
     if (AvailableTicketsCount == 0)
     {
         LK_Empty.Visibility    = Visibility.Visible;
         LK_NotEmpty.Visibility = Visibility.Collapsed;
     }
     else
     {
         LK_Empty.Visibility    = Visibility.Collapsed;
         LK_NotEmpty.Visibility = Visibility.Visible;
         MySqlDataAdapter ad    = new MySqlDataAdapter();
         string           Query = "call throwAvailableTicketsWithInfo('" + Login + "@localhost')";
         ad.SelectCommand = new MySqlCommand(Query, Connected);
         System.Data.DataTable table = new System.Data.DataTable();
         ad.Fill(table);
         table.Columns[0].ColumnName  = "Номер билета";
         table.Columns[1].ColumnName  = "Номер поезда";
         table.Columns[2].ColumnName  = "Номер вагона";
         table.Columns[3].ColumnName  = "Номер места";
         table.Columns[4].ColumnName  = "Время отправления";
         table.Columns[5].ColumnName  = "Дата отправления";
         table.Columns[6].ColumnName  = "Станция отправления";
         table.Columns[7].ColumnName  = "Время прибытия";
         table.Columns[8].ColumnName  = "Дата прибытия";
         table.Columns[9].ColumnName  = "Станция прибытия";
         ShowBuyedTickets.ItemsSource = table.DefaultView;
     }
 }
Example #2
0
        private void ThrowTrainListToTable()
        {
            var test = new List <TableFillKostil>();

            for (int i = 0; i < Routs.Count; i++)
            {
                for (int j = 0; j < TrainsList.Count; j++)
                {
                    if (TrainsList[j] != "-1")
                    {
                        string[] Args = { ArrivalStation, Routs[i], TrainsList[j] };
                        Arrival_ID = AL.CatchIntResult(_connection, "select GetArrivalID", Args);
                        string[] args = { DepartureStation, Routs[i], TrainsList[j] };
                        Departure_ID = AL.CatchIntResult(_connection, "select GetDepartureID", args);
                        if ((Arrival_ID != -1) && (Departure_ID != -1))
                        {
                            var TrainData = AL.TrainInfo(_connection, TrainsList[j], Arrival_ID, Departure_ID);
                            test.Add(new TableFillKostil(TrainData[0], TrainData[1], TrainData[2], TrainData[3], TrainData[4], TrainData[5]));
                        }
                    }
                }
            }
            if (test.Count != 0)
            {
                ChooseTrainGRID.ItemsSource = test;
            }
            else
            {
                AL.MessageErrorShow("При загрузке поездов произошла ошибка. Сообщите об этом администратору", "Ошибка");
            }
        }