Esempio n. 1
0
        }//клик на ПОИСК МАРШРУТА

        private void SearchStopsMenu()
        {
            GridColumn1.ItemsSource = null;
            GridColumn2.Items.Clear();
            GridColumn3.Items.Clear();
            KursWorkEntities db = new KursWorkEntities();

            string s = Convert.ToString(SeacrhButton.SelectedItem);
            //try
            //{
            IQueryable <Stop> queryableStop = from t in db.Stop
                                              where t.StopName == s
                                              select t;
            ObservableCollection <SomeShit> keka = new ObservableCollection <SomeShit>();

            foreach (Stop t in queryableStop)
            {
                ListBoxItem listBoxItem = new ListBoxItem();
                listBoxItem.Content   = t.StopName;
                listBoxItem.Selected += ListBoxItem_Selected;
                GridColumn2.Items.Add(listBoxItem);
            }
            IQueryable <Route> queryableRoute = from t in db.Stop
                                                where t.StopName == s
                                                select t.Route;

            foreach (Route t in queryableRoute)
            {
                SomeShit some = new SomeShit(t.RouteName);
                some.isFav = "true";
                keka.Add(some);
            }
            GridColumn1.ItemsSource = keka;
        }//клик на ПОИСК
Esempio n. 2
0
        }//Раскрытие списка

        private void StopMenu()
        {
            TitleOfSelected.Text = "Остановки";
            //GridColumn1.Items.Clear();
            GridColumn1.SelectionChanged -= GridColumn1_SelectionChanged1;
            GridColumn1.SelectionChanged -= MetroSelect;
            GridColumn1.SelectionChanged -= Stops_Time;
            GridColumn1.ItemsSource       = null;
            GridColumn2.Items.Clear();
            KursWorkEntities  db                 = new KursWorkEntities();
            IQueryable <Stop> queryable          = from t in db.Stop select t;
            ObservableCollection <SomeShit> keka = new ObservableCollection <SomeShit>();

            foreach (Stop ds in queryable)
            {
                ListBoxItem item = new ListBoxItem();
                SomeShit    ss   = new SomeShit(ds.Route.RouteType + "  " + ds.Route.RouteNumber + ".  " + ds.StopName);
                ss.isFav = "false";
                keka.Add(ss);
            }

            GridColumn1.ItemsSource       = keka;
            GridColumn1.SelectionChanged -= GridColumn1_SelectionChanged1;
            GridColumn1.SelectionChanged += Stops_Time;
        }//Клик на Остановки
Esempio n. 3
0
        }//клик на МЕТРО

        private void FavoriteMenu()
        {
            TitleOfSelected.Text          = "Избранное";
            GridColumn1.SelectionChanged -= GridColumn1_SelectionChanged1;
            GridColumn1.SelectionChanged -= MetroSelect;
            GridColumn1.ItemsSource       = null;
            KursWorkEntities db = new KursWorkEntities();
            ObservableCollection <SomeShit> keka = new ObservableCollection <SomeShit>();
            var queryableUser = db.Users
                                .Where(c => c.UserLogin == Users.Login)
                                .FirstOrDefault();

            try
            {
                SomeShit someShit = new SomeShit(queryableUser.UserFavourite);
                someShit.isFav = "true";

                keka.Add(someShit);
                GridColumn1.ItemsSource = keka;
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Необходимо войти");
            }
        }//клик на ИЗБРАННОЕ
Esempio n. 4
0
        private void MetroSelect(object sender, SelectionChangedEventArgs e)
        {
            GridColumn2.Items.Clear();
            ListBox listBox = (ListBox)sender;

            SomeShit someShit = (SomeShit)listBox.SelectedItems[0];
            string   TempStr  = someShit.text;


            KursWorkEntities db = new KursWorkEntities();

            IQueryable <int> query = from t in db.Metro
                                     where t.NameBranch == TempStr
                                     select t.ID;

            int cifra = query.FirstOrDefault();

            IQueryable <Metro_Branch> queryable = from t in db.Metro_Branch
                                                  where t.Number == cifra
                                                  select t;

            foreach (Metro_Branch t in queryable)
            {
                ListBoxItem listBoxItem = new ListBoxItem();
                listBoxItem.Content   = t.NameStation;
                listBoxItem.Selected += NameMetroStation_Time;
                GridColumn2.Items.Add(listBoxItem);
            }
        }
Esempio n. 5
0
        private void GridColumn1_SelectionChanged1(object sender, SelectionChangedEventArgs e)//Вывод остановок
        {
            GridColumn2.Items.Clear();
            ListBox listBox = (ListBox)sender;

            SomeShit someShit = (SomeShit)listBox.SelectedItems[0];

            //----------------------------------
            someShit.isFav = "true";
            //----------------------------------
            string           TempStr   = someShit.text;
            string           sad       = "  ";
            int              index     = TempStr.IndexOf(sad) + 3;
            string           FinalStr  = TempStr.Remove(0, index);
            KursWorkEntities db        = new KursWorkEntities();
            IQueryable <int> queryable = from t in db.Route
                                         where t.RouteName == FinalStr
                                         select t.RouteID;
            List <int> listT = queryable.ToList();

            int Id = Convert.ToInt32(listT[0]);

            IQueryable <string> StopQuery = from t in db.Stop
                                            where t.StopNum == Id
                                            select t.StopName;


            foreach (string s in StopQuery)
            {
                ListBoxItem listBoxItem = new ListBoxItem();
                listBoxItem.Selected += ListBoxItem_Selected;
                listBoxItem.Content   = s;
                GridColumn2.Items.Add(listBoxItem);
            }
        }
Esempio n. 6
0
        private void logIn(TextBlock In)
        {
            KursWorkEntities db       = new KursWorkEntities();
            string           tempLog  = RegLogin.Text;
            string           tempPass = RegPassword.Password;


            if (Users.Login != null && Users.Password != null)
            {
                MessageBox.Show("Необходимо выйти");
                return;
            }
            string validate = "^[a-zA-Z0-9]+$";

            Regex regex = new Regex(validate);

            if (regex.IsMatch(tempLog))
            {
                ;
            }
            else
            {
                MessageBox.Show("Неправильно введён логин");
            }


            var hasNumber        = new Regex(@"[0-9]+");
            var hasUpperChar     = new Regex(@"[A-Z]+");
            var hasMinimum6Chars = new Regex(@".{6,}");

            if (hasNumber.IsMatch(RegPassword.Password) && hasUpperChar.IsMatch(RegPassword.Password) && hasMinimum6Chars.IsMatch(RegPassword.Password))
            {
                ;
            }
            else
            {
                MessageBox.Show("Неправильно введён пароль: Необходимо присутствие цифры, буквы в верхнем регистре и длина пароля минимум 6 символов");
                return;
            }



            IQueryable <Users> temp = from t in db.Users where t.UserLogin == tempLog && t.UserPassword == tempPass select t;



            db.Users.Where(t => t.UserLogin == tempLog && t.UserPassword == tempPass);
            foreach (Users usrs in temp)
            {
                MessageBox.Show("Аутентификация прошла успешно");
                Users.Login    = RegLogin.Text;
                Users.Password = RegLogin.Text;
                In.Text        = "Выйти";
            }


            Close();
        }
Esempio n. 7
0
        private void ListBoxItem_Selected(object sender, RoutedEventArgs e)//маршруты-остановки-время
        {
            ListBoxItem       temp      = (ListBoxItem)sender;
            string            content   = Convert.ToString(temp.Content);
            KursWorkEntities  db        = new KursWorkEntities();
            IQueryable <Stop> SomeQuery = from t in db.Stop
                                          where t.StopName == content
                                          select t;

            foreach (Stop t in SomeQuery)
            {
                foreach (Time tt in t.Time)
                {
                    GridColumn3.Items.Add(tt.Hour + " : " + tt.Minute);
                }
            }
            #region oldVers
            //GridColumn2.Items.Clear();

            //ListBoxItem listBox = (ListBoxItem)sender;



            //string temp = Convert.ToString(listBox.Content);


            ////---------------------------тут всё норм
            //string sad = "  ";
            //int index = temp.IndexOf(sad)+3;
            //string FinalStr = temp.Remove(0, index);
            //KursWorkEntities db = new KursWorkEntities();
            //IQueryable<int> queryable = from t in db.Route
            //                            where t.RouteName == FinalStr
            //                            select t.RouteID;
            //List<int> listT = queryable.ToList();

            //int Id=Convert.ToInt32(listT[0]);

            //IQueryable<string> StopQuery = from t in db.Stop
            //                             where t.StopNum == Id
            //                             select t.StopName;


            //foreach(string s in StopQuery)
            //{
            //    ListBoxItem listBoxItem = new ListBoxItem();
            //    listBoxItem.Selected += List_Selected;
            //    listBoxItem.Content = s;
            //    GridColumn2.Items.Add(listBoxItem);
            //}


            #endregion
        }
Esempio n. 8
0
        private void Initialzation()
        {
            KursWorkEntities    db        = new KursWorkEntities();
            IQueryable <string> queryable = from t in db.Stop
                                            select t.StopName;

            foreach (string s in queryable)
            {
                FromCmb.Items.Add(s);
                WhereCmb.Items.Add(s);
            }
        }
Esempio n. 9
0
        private void InitlzationSearchBut()
        {
            KursWorkEntities db = new KursWorkEntities();

            IQueryable <string> queryable = from t in db.Stop
                                            select t.StopName;

            foreach (string s in queryable)
            {
                SeacrhButton.Items.Add(s);
            }
        }
Esempio n. 10
0
        private void AutobusMenu()//клик на АВТОБУС
        {
            GridColumn1.SelectionChanged -= GridColumn1_SelectionChanged1;
            GridColumn1.SelectionChanged -= MetroSelect;
            GridColumn1.SelectionChanged -= Stops_Time;
            GridColumn1.ItemsSource       = null;
            GridColumn2.Items.Clear();
            GridColumn3.Items.Clear();

            TitleOfSelected.Text = "Автобус";
            KursWorkEntities   db    = new KursWorkEntities();
            IQueryable <Route> Query = from t in db.Route
                                       where t.RouteType == "Автобус"
                                       select t;
            UnitOfWork unitOfWork = new UnitOfWork();

            //var prot = unitOfWork.route.GetAll();

            //var t =from f in prot
            //       where f.RouteType



            ObservableCollection <SomeShit> keka = new ObservableCollection <SomeShit>();

            if (GridColumn1.Items.Count == 0)
            {
                foreach (Route t in Query)
                {
                    keka.Add(new SomeShit(t.RouteNumber + "   " + t.RouteName));
                }

                GridColumn1.ItemsSource       = keka;
                GridColumn1.SelectionChanged += GridColumn1_SelectionChanged1;
            }
            else
            {
                GridColumn1.ItemsSource = null;
                foreach (Route t in Query)
                {
                    keka.Add(new SomeShit(t.RouteNumber + "   " + t.RouteName));
                }
                GridColumn1.ItemsSource       = keka;
                GridColumn1.SelectionChanged += GridColumn1_SelectionChanged1;
            }
        }
Esempio n. 11
0
        }//Клик на Остановки

        private void MetroMenu()
        {
            GridColumn1.SelectionChanged -= GridColumn1_SelectionChanged1;
            GridColumn1.ItemsSource       = null;
            GridColumn2.Items.Clear();
            GridColumn3.Items.Clear();
            TitleOfSelected.Text = "Станции метро";
            KursWorkEntities dB = new KursWorkEntities();
            ObservableCollection <SomeShit> keka = new ObservableCollection <SomeShit>();
            IQueryable <Metro> temp2             = from t in dB.Metro
                                                   select t;

            foreach (Metro t in temp2)
            {
                SomeShit ss = new SomeShit(t.NameBranch);
                ss.isFav = "true";
                keka.Add(ss);
            }
            GridColumn1.SelectionChanged += MetroSelect;
            GridColumn1.ItemsSource       = keka;
        }//клик на МЕТРО
Esempio n. 12
0
        private void TrollebusMenu()
        {
            TitleOfSelected.Text          = "Троллейбус";
            GridColumn1.SelectionChanged -= GridColumn1_SelectionChanged1;
            GridColumn1.SelectionChanged -= MetroSelect;
            GridColumn1.SelectionChanged -= Stops_Time;
            GridColumn1.ItemsSource       = null;
            GridColumn2.Items.Clear();
            GridColumn3.Items.Clear();

            KursWorkEntities   db    = new KursWorkEntities();
            IQueryable <Route> Query = from t in db.Route
                                       where t.RouteType == "Троллейбус"
                                       select t;


            ObservableCollection <SomeShit> keka = new ObservableCollection <SomeShit>();

            if (GridColumn1.ItemsSource == null)
            {
                foreach (Route t in Query)
                {
                    keka.Add(new SomeShit(t.RouteNumber + "   " + t.RouteName));
                }

                GridColumn1.ItemsSource       = keka;
                GridColumn1.SelectionChanged += GridColumn1_SelectionChanged1;
            }
            else
            {
                GridColumn1.ItemsSource = null;
                foreach (Route t in Query)
                {
                    keka.Add(new SomeShit(t.RouteNumber + "   " + t.RouteName));
                }
                GridColumn1.ItemsSource = keka;

                GridColumn1.SelectionChanged += GridColumn1_SelectionChanged1;
            }
        }//клик на ТРОЛЛЕЙБУС
Esempio n. 13
0
        private void NameMetroStation_Time(object sender, RoutedEventArgs e)
        {
            GridColumn3.Items.Clear();
            ListBoxItem listBox = (ListBoxItem)sender;
            string      TempStr = Convert.ToString(listBox.Content);

            KursWorkEntities db = new KursWorkEntities();


            IQueryable <int> SomeQuery = from t in db.Metro_Branch
                                         where t.NameStation == TempStr
                                         select t.ID;
            int chislo = SomeQuery.FirstOrDefault();

            IQueryable <Metro_Time> queryable = from t in db.Metro_Time
                                                where t.ID == chislo
                                                select t;

            foreach (Metro_Time t in queryable)
            {
                GridColumn3.Items.Add(t.Hours + " : " + t.Minuts);
            }
        }
Esempio n. 14
0
        private void Stops_Time(object sender, SelectionChangedEventArgs e)//ОСТАНОВКИ-ВРЕМЯ
        {
            GridColumn2.Items.Clear();
            GridColumn3.Items.Clear();
            ListBox           listBox   = (ListBox)sender;
            SomeShit          someShit  = (SomeShit)listBox.SelectedItems[0];
            string            TempStr   = someShit.text;
            string            sad       = ". ";
            int               index     = TempStr.IndexOf(sad) + 3;
            string            FinalStr  = TempStr.Remove(0, index);
            KursWorkEntities  db        = new KursWorkEntities();
            IQueryable <Stop> SomeQuery = from t in db.Stop
                                          where t.StopName == FinalStr
                                          select t;

            foreach (Stop t in SomeQuery)
            {
                foreach (Time tt in t.Time)
                {
                    GridColumn3.Items.Add(tt.Hour + " : " + tt.Minute);
                }
            }
        }
Esempio n. 15
0
        private void FavoriteBtn(object sender, RoutedEventArgs e)
        {
            if (Users.Login == null && Users.Password == null)
            {
                MessageBox.Show("Необходимо войти или зарегестрироваться");
                return;
            }

            KursWorkEntities   db        = new KursWorkEntities();
            IQueryable <Users> queryable = from t in db.Users
                                           select t;

            Button self          = (Button)sender;
            string nameOstanovka = (string)self.Tag;

            foreach (Users t in queryable)
            {
                if (t.UserFavourite == nameOstanovka)
                {
                    MessageBox.Show("Пользователь уже содержит этот объект");
                    return;
                }
            }

            var queryableUser = db.Users
                                .Where(c => c.UserLogin == Users.Login)
                                .FirstOrDefault();

            queryableUser.UserFavourite = nameOstanovka;

            db.SaveChanges();



            MessageBox.Show(nameOstanovka);
        }
Esempio n. 16
0
        private void Button_Click(object sender, RoutedEventArgs e)//registration
        {
            if (Users.Login != null && Users.Password != null)
            {
                MessageBox.Show("Надо выйти");
                Close();
                return;
            }

            string validateForLogin = "******";

            Regex regex = new Regex(validateForLogin);

            if (regex.IsMatch(LoginTB.Text))
            {
                ;
            }
            else
            {
                MessageBox.Show("Неправильно введён логин");
                return;
            }
            var hasNumber        = new Regex(@"[0-9]+");
            var hasUpperChar     = new Regex(@"[A-Z]+");
            var hasMinimum6Chars = new Regex(@".{6,}");

            if (hasNumber.IsMatch(PasswordTB.Password) && hasUpperChar.IsMatch(PasswordTB.Password) && hasMinimum6Chars.IsMatch(PasswordTB.Password))
            {
                ;
            }
            else
            {
                MessageBox.Show("Неправильно введён пароль: Необходимо присутствие цифры, буквы в верхнем регистре и длина пароля минимум 6 символов");
                return;
            }

            if (IsValidEmail(EmailTB.Text))
            {
                ;
            }
            else
            {
                MessageBox.Show("неправильно введена почта");
                return;
            }

            KursWorkEntities dB = new KursWorkEntities();



            Users users = new Users()
            {
                UserLogin    = LoginTB.Text,
                UserEmail    = EmailTB.Text,
                UserPassword = PasswordTB.Password
            };

            try
            {
                dB.Users.Add(users);
                dB.SaveChanges();
                MessageBox.Show("Регистрация прошла успешно");
            }
            catch (DbEntityValidationException ex)
            {
                foreach (DbEntityValidationResult validationError in ex.EntityValidationErrors)
                {
                    MessageBox.Show("Object: " + validationError.Entry.Entity.ToString());
                    MessageBox.Show("");
                    foreach (DbValidationError err in validationError.ValidationErrors)
                    {
                        MessageBox.Show(err.ErrorMessage + "");
                    }
                }
            }
            Close();
        }
Esempio n. 17
0
 public Repozitory_Time(KursWorkEntities context)
 {
     this.db = context;
 }
Esempio n. 18
0
 public RepozitoryStop(KursWorkEntities context)
 {
     this.db = context;
 }
Esempio n. 19
0
        private void Search()
        {
            #region OLD
            //string s1 = Convert.ToString(FromCmb.SelectedItem);
            //string s2= Convert.ToString(WhereCmb.SelectedItem);

            //List<string> result = new List<string>();
            //if (s1 == "" || s2 == "")
            //{
            //    MessageBox.Show("Заполните поля");
            //    return;
            //}
            //KursWorkEntities db = new KursWorkEntities();

            //var query = db.Stop
            //    .Where(c => c.StopName == s1)
            //    .FirstOrDefault();
            //var query2 = db.Stop
            //    .Where(c => c.StopName == s2)
            //    .FirstOrDefault();

            ////прушинских - ленина
            //// id=2 counter=2
            //int ID = query.StopNum;
            //int counter = query.StopCounter;

            ////прушинских - ленина
            //// id=1 counter=15
            //int ID2 = query2.StopNum;
            //int counter2 = query2.StopCounter;

            //int check = query.StopID;//28
            //int check2=query2.StopID;//24

            //if (ID == ID2)
            //{
            //    if (counter < counter2)
            //    {
            //        IQueryable<string> FinalQuery3 = from t in db.Stop
            //                                         where t.StopNum == ID && t.StopCounter >= counter && t.StopCounter <= counter2
            //                                         select t.StopName;

            //        foreach (string s in FinalQuery3)
            //        {
            //            result.Add(s);
            //        }
            //    }
            //    else
            //    {
            //        IQueryable<string> FinalQuery3 = from t in db.Stop
            //                                         where t.StopNum == ID && t.StopCounter >= counter2 && t.StopCounter <= counter
            //                                         select t.StopName;

            //        foreach (string s in FinalQuery3)
            //        {
            //            result.Add(s);
            //        }
            //        result.Reverse();
            //    }


            //}
            //else if (check < check2)
            //{
            //    IQueryable<string> FinalQuery1 = from t in db.Stop
            //                                     where t.StopNum == ID && t.StopCounter >= counter
            //                                     select t.StopName;

            //    foreach (string s in FinalQuery1)
            //    {
            //        result.Add(s);
            //    }

            //    IQueryable<string> FinalQuery2 = from t in db.Stop
            //                                     where t.StopNum == ID2 && t.StopCounter <= counter2
            //                                     select t.StopName;
            //    foreach (string ss in FinalQuery2)
            //    {
            //        result.Add(ss);
            //    }
            //}
            //else
            //{
            //    query = db.Stop
            //        .Where(c => c.StopName == s2)
            //        .FirstOrDefault();

            //    query2= db.Stop
            //        .Where(c => c.StopName == s1)
            //        .FirstOrDefault();

            //    IQueryable<string> FinalQuery1 = from t in db.Stop
            //                                     where t.StopNum == ID && t.StopCounter <= counter
            //                                     select t.StopName;

            //    foreach (string s in FinalQuery1)
            //    {
            //        result.Add(s);
            //    }
            //    result.Reverse();

            //    IQueryable<string> FinalQuery2 = from t in db.Stop
            //                                     where t.StopNum == ID2 && t.StopCounter >= counter2
            //                                     select t.StopName;
            //    List<string> rez = new List<string>();
            //    foreach (string ss in FinalQuery2)
            //    {
            //        rez.Add(ss);
            //    }
            //    rez.Reverse();
            //    result.AddRange(rez);


            //}
            //    if (result.Count == 0)
            //    {
            //        MessageBox.Show("Подбор маршрута невозможен");
            //    }


            //    foreach (string s in result)
            //    {
            //        MessageBox.Show(s);
            //    }
            #endregion
            Information.Children.Clear();
            Information.Visibility = Visibility.Visible;

            LabelMarsh.Visibility = Visibility.Visible;
            string s1 = Convert.ToString(FromCmb.SelectedItem);
            string s2 = Convert.ToString(WhereCmb.SelectedItem);

            List <string> result = new List <string>();
            if (s1 == "" || s2 == "")
            {
                MessageBox.Show("Заполните поля");
                return;
            }
            KursWorkEntities db = new KursWorkEntities();

            var query = db.Stop
                        .Where(c => c.StopName == s1)
                        .FirstOrDefault();
            var query2 = db.Stop
                         .Where(c => c.StopName == s2)
                         .FirstOrDefault();

            int check  = query.StopNum;
            int check2 = query2.StopNum;
            int ID     = query.StopID;  //25 n
            int ID2    = query2.StopID; //28 n

            if (ID2 > ID)
            {
                #region
                //IQueryable<string> queryable = from t in db.Stop
                //                               where t.StopID <= ID2 && t.StopID >= ID
                //                               select t.StopName;
                //foreach (string t in queryable)
                //{
                //    result.Add(t);
                //    MessageBox.Show(t);
                //}
                #endregion
                if (check != check2)
                {
                    IQueryable <string> FinalQuery3 = from t in db.Stop
                                                      where t.StopID <= ID2 && t.StopID >= ID && t.StopNum == check
                                                      select t.StopName;
                    string firstOne = FinalQuery3.ToList().First();
                    string lastOne  = FinalQuery3.ToList().Last();

                    var queryable = db.Stop
                                    .Where(c => c.StopID <= ID2 && c.StopID >= ID && c.StopNum == check)//для маршрутов с другим id
                                    .FirstOrDefault();


                    string info = queryable.Route.RouteType + "  " + queryable.Route.RouteNumber;


                    Drow(Information, firstOne, lastOne, info);

                    //-------------------------------------------------------------------------------------------------------

                    var queryable2 = db.Stop
                                     .Where(c => c.StopID <= ID2 && c.StopID >= ID && c.StopNum == check2)//для маршрутов с другим id
                                     .FirstOrDefault();

                    IQueryable <string> FinalQuery3_2 = from t in db.Stop
                                                        where t.StopID <= ID2 && t.StopID >= ID && t.StopNum == check2
                                                        select t.StopName;
                    string firstTwo = FinalQuery3_2.ToList().First();
                    string lastTwo  = FinalQuery3_2.ToList().Last();
                    string info2    = queryable2.Route.RouteType + "  " + queryable2.Route.RouteNumber;
                    Information2.Visibility = Visibility.Visible;
                    Drow(Information2, firstTwo, lastTwo, info2);
                }
                else
                {
                    var queryable = db.Stop
                                    .Where(c => c.StopID <= ID2 && c.StopID >= ID)
                                    .FirstOrDefault();
                    string info = queryable.Route.RouteNumber + "  " + queryable.Route.RouteType;


                    IQueryable <string> queryable22 = from t in db.Stop
                                                      where t.StopID <= ID2 && t.StopID >= ID
                                                      select t.StopName;

                    string firstTwo = queryable22.ToList().First();
                    string lastTwo  = queryable22.ToList().Last();
                    Drow(Information, firstTwo, lastTwo, info);
                }
            }
            else if (ID2 < ID)
            {
                if (check != check2)
                {
                    var queryable = db.Stop
                                    .Where(c => c.StopID <= ID2 && c.StopID >= ID && c.StopNum == check)//для маршрутов с другим id
                                    .FirstOrDefault();

                    IQueryable <string> FinalQuery3 = from t in db.Stop
                                                      where t.StopID <= ID2 && t.StopID >= ID && t.StopNum == check
                                                      select t.StopName;
                    string firstOne = FinalQuery3.ToList().First();
                    string lastOne  = FinalQuery3.ToList().Last();
                    string info     = queryable.Route.RouteType + "  " + queryable.Route.RouteNumber;
                    Drow(Information, firstOne, lastOne, info);


                    IQueryable <string> FinalQuery3_2 = from t in db.Stop
                                                        where t.StopID <= ID2 && t.StopID >= ID && t.StopNum == check2
                                                        select t.StopName;
                    var queryable2 = db.Stop
                                     .Where(c => c.StopID <= ID2 && c.StopID >= ID && c.StopNum == check)//для маршрутов с другим id
                                     .FirstOrDefault();


                    string firstTwo = FinalQuery3_2.ToList().First();
                    string lastTwo  = FinalQuery3_2.ToList().Last();
                    string info2    = queryable2.Route.RouteType + "  " + queryable2.Route.RouteNumber;
                    Information2.Visibility = Visibility.Visible;
                    Drow(Information2, firstTwo, lastTwo, info2);
                }
                else
                {
                    IQueryable <string> queryable = from t in db.Stop
                                                    where t.StopID <= ID && t.StopID >= ID2
                                                    select t.StopName;
                    var queryableInf = db.Stop
                                       .Where(c => c.StopID <= ID && c.StopID >= ID2)
                                       .FirstOrDefault();

                    string info = queryableInf.Route.RouteNumber + "  " + queryableInf.Route.RouteType;

                    foreach (string t in queryable)
                    {
                        result.Add(t);
                    }
                    result.Reverse();
                    string firstOne = result.First();
                    string firstTwo = result.Last();
                    Drow(Information, firstOne, firstTwo, info);
                }
            }
        }
Esempio n. 20
0
 public RepozitoryMetro_Branch(KursWorkEntities context)
 {
     this.db = context;
 }