Exemple #1
0
        private void PrintDoctor(DoctorsControl doctorsControl)
        {
            try
            {
                OleDbCommand command = new OleDbCommand("SELECT * FROM [Doctor]", myConnection);
                myConnection.Open();
                OleDbDataReader reader = command.ExecuteReader();

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

                    if (UserName.ToLower() == "admin" && UserPass.ToLower() == "admin")
                    {
                        Item.btnDelete.Visible = true;
                    }

                    byte[]       Photo        = (byte[])(reader[0]);
                    MemoryStream memoryStream = new MemoryStream(Photo);
                    Item.PictureBox.Image   = Image.FromStream(memoryStream);
                    Item.NameProfesion.Text = reader[1].ToString();
                    doctorsControl.tableLayoutPanel1.Controls.Add(Item);
                }
                reader.Close();
                myConnection.Close();
            }
            catch
            {
                myConnection.Close();
            }
        }
Exemple #2
0
        private void btnDoctors_Click(object sender, EventArgs e)
        {
            HomePanel.Controls.RemoveAt(0);
            DoctorsControl doctorsControl = new DoctorsControl();

            if (UserName.ToLower() == "admin" && UserPass.ToLower() == "admin")
            {
                doctorsControl.AddBox.Visible = true;
            }
            PrintDoctor(doctorsControl);
            HomePanel.Controls.Add(doctorsControl);
            doctorsControl.Show();
            doctorsControl.Dock = DockStyle.Fill;
            doctorsControl.BringToFront();
        }