private void InitNote() { SqlConnection con = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\\Users\\Mydruy\\Desktop\\Курсовой\\Курсовой\\Cursach\\Multiplex.mdf;Integrated Security=True"); con.Open(); SqlCommand readCommand = new SqlCommand("SELECT * FROM [Note] ORDER BY id DESC", con); StaticArray staticArray = new StaticArray(); TableUser.Width = this.Width; Button b = new Button(); b.Content = "22"; b.Width = 100; b.Height = 100; TableUser.Rows = 17; TableUser.Columns = 4; using (SqlDataReader dataRead = readCommand.ExecuteReader()) { if (dataRead != null) { while (dataRead.Read()) { Image image = new Image(); image.Width = 100; image.Margin = new Thickness(0, 10, 0, 10); image.Source = (new ImageSourceConverter()).ConvertFromString("pack://application:,,,/Resource/note-" + Convert.ToInt32(dataRead["img"]) + ".png") as ImageSource; // image.Source = (new ImageSourceConverter()).ConvertFromString(dataRead["img"].ToString()) as ImageSource; TableUser.Children.Add(image); Label lab = new Label(); lab.Content = dataRead["text"].ToString(); lab.Foreground = System.Windows.Media.Brushes.White; lab.Margin = new Thickness(0, 30, 0, 0); TableUser.Children.Add(lab); Label lab1 = new Label(); lab1.Content = "Одесский Офисс"; lab1.Foreground = System.Windows.Media.Brushes.White; lab1.Margin = new Thickness(0, 30, 0, 0); TableUser.Children.Add(lab1); Button c = new Button(); c.Tag = dataRead["id"]; c.Click += Pod_Click; c.Content = "Удалить"; c.Width = 100; c.Height = 30; TableUser.Children.Add(c); } } } }
//Выводим данные о сотрудниках void viewListStaff() { SqlConnection con = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\\Users\\Mydruy\\Desktop\\Курсовой\\Курсовой\\Cursach\\Multiplex.mdf;Integrated Security=True"); con.Open(); SqlCommand readCommand = new SqlCommand("SELECT * FROM [Staff]", con); StaticArray staticArray = new StaticArray(); TableUser.Width = this.Width; Button b = new Button(); b.Content = "22"; b.Width = 100; b.Height = 100; TableUser.Rows = 17; TableUser.Columns = 4; using (SqlDataReader dataRead = readCommand.ExecuteReader()) { if (dataRead != null) { while (dataRead.Read()) { Image image = new Image(); image.Width = 100; image.Margin = new Thickness(0, 10, 0, 10); if (dataRead["img"] == "") { image.Source = (new ImageSourceConverter()).ConvertFromString("pack://application:,,,/Resource/user.png") as ImageSource; } else { image.Source = (new ImageSourceConverter()).ConvertFromString(dataRead["img"].ToString()) as ImageSource; } TableUser.Children.Add(image); Label lab = new Label(); lab.Content = dataRead["name"].ToString() + " " + dataRead["famil"].ToString() + " " + dataRead["otch"].ToString(); lab.Foreground = System.Windows.Media.Brushes.White; lab.Margin = new Thickness(0, 30, 0, 0); TableUser.Children.Add(lab); Label lab1 = new Label(); lab1.Content = staticArray.stringPosition[Convert.ToInt32(dataRead["position"])]; lab1.Foreground = System.Windows.Media.Brushes.White; lab1.Margin = new Thickness(0, 30, 0, 0); TableUser.Children.Add(lab1); Button c = new Button(); c.Tag = dataRead["id"]; c.Click += Pod_Click; c.Content = "Подробно"; c.Width = 100; c.Height = 30; TableUser.Children.Add(c); } } } for (int i = 0; i < 100; i++) { } }