示例#1
0
        private void PrintListBookAdmin(AdminControl adminControl1)
        {
            OleDbCommand command = new OleDbCommand("SELECT * FROM [Books]", myConnection);

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

            adminControl1.flowLayoutPanel1.Controls.Clear();
            Random random = new Random();

            while (reader.Read())
            {
                ElBookList Item = new ElBookList();

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

                Item.gunaLabel1.Text  = reader[1].ToString();
                Item.gunaLabel3.Text  = reader[2].ToString();
                Item.gunaLabel4.Text += reader[0].ToString();

                adminControl1.flowLayoutPanel1.Controls.Add(Item);
            }
            reader.Close();
            myConnection.Close();
        }
示例#2
0
        private void PrintStatisticAdmin(AdminControl adminControl1)
        {
            OleDbCommand command = new OleDbCommand("SELECT COUNT(*) FROM Books", myConnection);

            myConnection.Open();
            adminControl1.CountBooks.Text = "0" + command.ExecuteScalar().ToString();
            myConnection.Close();

            command = new OleDbCommand("SELECT COUNT(*) FROM Users", myConnection);
            myConnection.Open();
            adminControl1.CountUsers.Text = "0" + command.ExecuteScalar().ToString();
            myConnection.Close();

            Random random = new Random();

            adminControl1.CountBuyBooks.Text = "0" + random.Next(0, 30);

            adminControl1.DataTime.Text = DateTime.Now.Day.ToString() + "." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Year.ToString();
        }
示例#3
0
        //-------------------------------- Admin
        private void btnAdmin_Click(object sender, EventArgs e)
        {
            SearchPanel.Location = new Point(26, 11);
            btnBack.Visible      = false;
            _obj = this;

            if (InfoPanel.Controls.Count > 0)
            {
                InfoPanel.Controls.RemoveAt(0);
            }
            AdminControl adminControl1 = new AdminControl();

            InfoPanel.Controls.Add(adminControl1);
            adminControl1.Dock = DockStyle.Fill;
            adminControl1.BringToFront();

            PrintListUserAdmin(adminControl1);
            PrintListBookAdmin(adminControl1);
            PrintStatisticAdmin(adminControl1);
        }
示例#4
0
        private void PrintListUserAdmin(AdminControl adminControl1)
        {
            OleDbCommand command = new OleDbCommand("SELECT * FROM [Users]", myConnection);

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

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

            while (reader.Read())
            {
                ElUserList Item = new ElUserList();
                Item.gunaLabel1.Text += reader[0].ToString();
                Item.gunaLabel3.Text += reader[1].ToString();
                Item.gunaLabel4.Text += reader[2].ToString();
                Item.gunaLabel2.Text += random.Next(1, 15).ToString();

                adminControl1.flowLayoutPanel3.Controls.Add(Item);
            }
            reader.Close();
            myConnection.Close();
        }