Example #1
0
        private void btn_logIn_Click(object sender, EventArgs e)
        {
            if (txt_box_login_userid.Text == "" || txt_box_login_password.Text == "")
            {
                MessageBox.Show("Please enter the value");
                txt_box_login_userid.Text   = "";
                txt_box_login_password.Text = "";
                Form1.Instance.PnlContainer.Controls["login"].BringToFront();
            }
            else
            {
                string id       = txt_box_login_userid.Text;
                string password = txt_box_login_password.Text;
                string query    = "SELECT * FROM USER_INFO WHERE USER_ID = '" + id + "' AND PASSWORD = '******'";

                dbobj.readDatathroughAdapter(query, dtUsers);

                if (dtUsers.Rows.Count == 1)
                {
                    dbobj.closeConn();
                    string result = txt_box_login_userid.Text.Substring(0, 1);
                    if (result == "a")
                    {
                        if (!Form1.Instance.PnlContainer.Controls.ContainsKey("admin_panel"))
                        {
                            admin_panel ap = new admin_panel();
                            ap.Dock = DockStyle.Fill;
                            Form1.Instance.PnlContainer.Controls.Add(ap);
                        }
                        Form1.Instance.PnlContainer.Controls["admin_panel"].BringToFront();
                    }

                    else if (result == "p")
                    {
                        if (!Form1.Instance.PnlContainer.Controls.ContainsKey("patient_panel"))
                        {
                            patient_panel pp = new patient_panel();
                            pp.Dock = DockStyle.Fill;
                            Form1.Instance.PnlContainer.Controls.Add(pp);
                        }
                        Form1.Instance.PnlContainer.Controls["patient_panel"].BringToFront();
                    }

                    else if (result == "d")
                    {
                        if (!Form1.Instance.PnlContainer.Controls.ContainsKey("doctor_panel"))
                        {
                            doctor_panel dp = new doctor_panel();
                            dp.Dock = DockStyle.Fill;
                            Form1.Instance.PnlContainer.Controls.Add(dp);
                        }
                        Form1.Instance.PnlContainer.Controls["doctor_panel"].BringToFront();
                    }
                }
                else
                {
                    MessageBox.Show("Please, Enter Valid Information");
                }
            }
        }
Example #2
0
        private void admin_panel_Load(object sender, EventArgs e)
        {
            _obj2 = this;
            admin_panel_home ad_p_h = new admin_panel_home();

            ad_p_h.Dock = DockStyle.Fill;
            panel_ad_right.Controls.Add(ad_p_h);
            panel_ad_right.Controls["admin_panel_home"].BringToFront();
        }