private void hideWarning(bool cek, Guna2PictureBox GPB) { if (!cek) { GPB.Visible = true; } else { GPB.Visible = false; } }
private void createPanel(DataRow dr) { Guna2Panel back_panel = new Guna2Panel(); back_panel.BackColor = Color.White; back_panel.Size = new Size(250, 225); back_panel.Margin = new Padding(10, 37, 10, 10); back_panel.Padding = new Padding(5, 5, 5, 5); Guna2Panel top_panel = new Guna2Panel(); top_panel.BackColor = Color.WhiteSmoke; top_panel.Dock = DockStyle.Top; top_panel.Size = new Size(240, 86); top_panel.ShadowDecoration.Depth = 5; top_panel.ShadowDecoration.Shadow = new Padding(3, 3, 3, 0); top_panel.ShadowDecoration.Enabled = true; Guna2Panel bottom_panel = new Guna2Panel(); bottom_panel.BackColor = Color.WhiteSmoke; bottom_panel.Dock = DockStyle.Bottom; bottom_panel.Size = new Size(240, 127); bottom_panel.ShadowDecoration.Depth = 5; bottom_panel.ShadowDecoration.Shadow = new Padding(3, 0, 3, 3); bottom_panel.ShadowDecoration.Enabled = true; Guna2PictureBox profile_pic = new Guna2PictureBox(); profile_pic.Size = new Size(60, 60); profile_pic.SizeMode = PictureBoxSizeMode.Zoom; profile_pic.Location = new Point(20, 13); profile_pic.Image = Resources.default_profile_pic; //Get profile pic //databaseConnection.Open(); //MySqlCommand cmd = databaseConnection.CreateCommand(); //cmd.CommandType = CommandType.Text; //cmd.CommandText = "select student_profile_pic from student_info WHERE student_reg_no = '" + dr["student_reg_no"].ToString() + "'"; //cmd.ExecuteNonQuery(); //DataTable dt = new DataTable(); //MySqlDataAdapter sda = new MySqlDataAdapter(cmd); //sda.Fill(dt); //int i = dt.Rows.Count; //if (i > 0) //{ // String selectQuery = "SELECT student_profile_pic FROM student_info WHERE student_reg_no = '" + dr["student_reg_no"].ToString() + "'"; // MySqlCommand command = new MySqlCommand(selectQuery, databaseConnection); // MySqlDataAdapter da = new MySqlDataAdapter(command); // DataTable table = new DataTable(); // da.Fill(table); // byte[] img = (byte[])table.Rows[0]["student_profile_pic"]; // MemoryStream ms = new MemoryStream(img); // profile_pic.Image = Image.FromStream(ms); // da.Dispose(); //} //else //{ // profile_pic.Image = Resources.default_profile_pic; //} //databaseConnection.Close(); // Guna2HtmlLabel student_name = new Guna2HtmlLabel(); student_name.ForeColor = Color.Black; student_name.Font = new Font("Segoe UI Semibold", 10); student_name.Location = new Point(86, 21); student_name.Text = dr["student_name"].ToString(); Guna2HtmlLabel index_no = new Guna2HtmlLabel(); index_no.Font = new Font("Segoe UI", 10); index_no.ForeColor = Color.DimGray; index_no.Location = new Point(86, 46); index_no.Text = dr["student_reg_no"].ToString(); Guna2PictureBox mail_pic = new Guna2PictureBox(); mail_pic.Image = Resources.mail; mail_pic.Size = new Size(20, 20); mail_pic.SizeMode = PictureBoxSizeMode.Zoom; mail_pic.Location = new Point(40, 32); Guna2PictureBox phone_pic = new Guna2PictureBox(); phone_pic.Image = Resources.phone; phone_pic.Size = new Size(20, 20); phone_pic.SizeMode = PictureBoxSizeMode.Zoom; phone_pic.Location = new Point(40, 71); Guna2HtmlLabel email = new Guna2HtmlLabel(); email.ForeColor = Color.DimGray; email.Font = new Font("Segoe UI", 9); email.Location = new Point(69, 33); email.Text = dr["student_email"].ToString(); Guna2HtmlLabel phone = new Guna2HtmlLabel(); phone.ForeColor = Color.DimGray; phone.Font = new Font("Segoe UI", 9); phone.Location = new Point(69, 73); phone.Text = dr["student_mobile"].ToString(); back_panel.Controls.Add(top_panel); back_panel.Controls.Add(bottom_panel); top_panel.Controls.Add(profile_pic); top_panel.Controls.Add(index_no); top_panel.Controls.Add(student_name); bottom_panel.Controls.Add(mail_pic); bottom_panel.Controls.Add(email); bottom_panel.Controls.Add(phone); bottom_panel.Controls.Add(phone_pic); students_layout.Controls.Add(back_panel); }
private void getLecturers() { databaseConnection.Open(); MySqlCommand cmd = databaseConnection.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select lecturer_name,lecturer_email,lecturer_mobile,lecturer_profile_pic from lecturer_info"; cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); MySqlDataAdapter sda = new MySqlDataAdapter(cmd); sda.Fill(dt); foreach (DataRow row in dt.Rows) { Guna2Panel panel = new Guna2Panel(); panel.Size = new Size(1053, 100); Guna2HtmlLabel lecturer_name = new Guna2HtmlLabel(); lecturer_name.Text = row["lecturer_name"].ToString(); lecturer_name.Location = new Point(126, 22); Guna2HtmlLabel email = new Guna2HtmlLabel(); email.Text = "Email"; email.Location = new Point(126, 64); Guna2HtmlLabel mobile = new Guna2HtmlLabel(); mobile.Text = "Mobile Number"; mobile.Location = new Point(333, 64); LinkLabel email_address = new LinkLabel(); email_address.Text = row["lecturer_email"].ToString(); email_address.Location = new Point(160, 64); LinkLabel mobile_number = new LinkLabel(); mobile_number.Text = row["lecturer_mobile"].ToString(); mobile_number.Location = new Point(413, 64); Guna2PictureBox profile_pic = new Guna2PictureBox(); profile_pic.Size = new Size(100, 100); profile_pic.SizeMode = PictureBoxSizeMode.Zoom; profile_pic.Dock = DockStyle.Left; profile_pic.Image = Resources.default_profile_pic; //if (string.IsNullOrEmpty(row["lecturer_profile_pic"].ToString())) //{ // profile_pic.Image = Resources.download__1_; //} //else //{ // byte[] img = (byte[])row["lecturer_profile_pic"]; // MemoryStream ms = new MemoryStream(img); // Image imgs = Image.FromStream(ms); // profile_pic.Image = imgs; //} panel.Controls.Add(lecturer_name); panel.Controls.Add(email); panel.Controls.Add(mobile); panel.Controls.Add(email_address); panel.Controls.Add(mobile_number); panel.Controls.Add(profile_pic); flowLayoutPanel1.Controls.Add(panel); } }