public void Find() { RepositoryClass repositoryClass = new RepositoryClass(); Stack <Restoran> restorans = repositoryClass.SearchRest(Text_find.Text); foreach (Restoran restoran in restorans) { MemoryStream ms = new MemoryStream(restoran.imagedata); System.Drawing.Image newImage = System.Drawing.Image.FromStream(ms); UserControl1 userControl1 = new UserControl1(); BitmapImage bi = new BitmapImage(); bi.BeginInit(); MemoryStream ms2 = new MemoryStream(); newImage.Save(ms2, System.Drawing.Imaging.ImageFormat.Bmp); ms2.Seek(0, SeekOrigin.Begin); bi.StreamSource = ms2; bi.EndInit(); userControl1.im.Source = bi; userControl1.Name_Of_Rest.Content = restoran.Name; time = DateTime.Now.ToShortTimeString(); string DBTIME = restoran.WorkTime; if (CheckTime.IsChecked == true) { Time_Work(time, DBTIME); } if (flag) { if (SelectItems == null) { Result_panel.Children.Add(userControl1); } else { if (restoran.Type == SelectItems) { Result_panel.Children.Add(userControl1); } } } flag = true; } }
public void Find() { RepositoryClass repositoryClass = new RepositoryClass(); Stack <Restoran> restorans = repositoryClass.SearchRest(Name_Of_Rest.Content.ToString()); foreach (Restoran restoran in restorans) { PagesofRest pagesofRest = new PagesofRest(); pagesofRest.Images.Source = this.im.Source; pagesofRest.Images.HorizontalAlignment = HorizontalAlignment.Left; pagesofRest.Rest_name.Content = restoran.Name; pagesofRest.Location.Text = restoran.Street; pagesofRest.Discription_blok.Text = restoran.Disk; string type = restoran.Type; pagesofRest.Types.Source = new BitmapImage(new Uri(ChoiceIconf(type), UriKind.Relative)); pagesofRest.Price.Text = restoran.Price; pagesofRest.time_of_work.Text = restoran.WorkTime; string time = DateTime.Now.ToShortTimeString(); Time_Work(time, pagesofRest.time_of_work.Text); string Cordinate = restoran.Cord; string[] Cordinatesplit = Cordinate.Split(','); CultureInfo et = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); double x = double.Parse(Cordinatesplit[0]); Thread.CurrentThread.CurrentCulture = et; CultureInfo et2 = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); double y = double.Parse(Cordinatesplit[1]); Thread.CurrentThread.CurrentCulture = et; pagesofRest.Second_name.Text = Name_Of_Rest.Content.ToString(); pagesofRest.Loadmap(x, y); MainWindow window = (MainWindow)Application.Current.MainWindow; window.GridMain.Children.Clear(); window.GridMain.Children.Add(pagesofRest); } }