Пример #1
0
        public void PrintProperty(AdminPanel admin)
        {
            OleDbCommand command = new OleDbCommand("SELECT * FROM Announcement", connection);

            connection.Open();
            OleDbDataReader reader = command.ExecuteReader();

            admin.LayoutPanel1.Controls.Clear();
            while (reader.Read())
            {
                ElProperty Item = new ElProperty();

                byte[]       Photo        = (byte[])(reader[16]);
                MemoryStream memoryStream = new MemoryStream(Photo);
                Item.gunaPictureBox2.Image = Image.FromStream(memoryStream);

                Item.gunaLabel1.Text = $"{reader[5]}к    {reader[10]} / {reader[11]} м";
                Item.gunaLabel2.Text = $"{reader[4]} / {reader[3]}";
                Item.gunaLabel3.Text = reader[2].ToString();
                Item.IDLabel.Text    = reader[0].ToString();

                admin.LayoutPanel1.Controls.Add(Item);
            }
            reader.Close();
            connection.Close();
        }
Пример #2
0
        private void gunaButton7_Click(object sender, EventArgs e)
        {
            tableLayoutPanel1.Visible = false;
            SearchPanel.Location      = new Point(60, 11);
            AdminPanel Item = new AdminPanel();

            Item.Dock = DockStyle.Fill;
            Info.Controls.Add(Item);
            PrintCount(Item);
            PrintUser(Item);
            PrintProperty(Item);
            _obj = this;
        }
Пример #3
0
        public void PrintCount(AdminPanel admin)
        {
            OleDbCommand command = new OleDbCommand("SELECT COUNT(*) FROM Announcement", connection);

            connection.Open();
            admin.CountAds.Text = "0" + command.ExecuteScalar().ToString();
            connection.Close();

            OleDbCommand command1 = new OleDbCommand("SELECT COUNT(*) FROM [User]", connection);

            connection.Open();
            admin.CountUsers.Text = "0" + command1.ExecuteScalar().ToString();
            connection.Close();

            Random random = new Random();

            admin.CountBuyAds.Text = "0" + random.Next(20, 40);

            admin.DataTime.Text = DateTime.Now.Day.ToString() + "." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Year.ToString();
        }
Пример #4
0
        public void PrintUser(AdminPanel admin)
        {
            OleDbCommand command = new OleDbCommand("SELECT uUsername, COUNT(*) FROM Announcement Group BY uUsername", connection);

            connection.Open();
            OleDbDataReader reader = command.ExecuteReader();

            admin.flowLayoutPanel3.Controls.Clear();
            Random random = new Random();

            while (reader.Read())
            {
                ElUser Item = new ElUser();
                Item.gunaLabel4.Text += reader[0].ToString();
                Item.gunaLabel2.Text += reader[1].ToString();
                admin.flowLayoutPanel3.Controls.Add(Item);
            }
            reader.Close();
            connection.Close();
        }