private void loginbt_Click(object sender, EventArgs e)
        {
            string st;
            string user = UserName.Text;
            string pass = UserPass.Text;

            if (user != null && pass != null)
            {
                DataAccess db = new DataAccess();
                if (radioButtondoclog.Checked)
                {
                    st = "select * from Doctor where User_name='" + user + "' and Password='******';";
                    DataTable dt = db.Data(st);
                    if (dt.Rows.Count == 1)
                    {
                        DHome.dd = dt;
                        DoctorsPortal p = new DoctorsPortal();
                        this.Hide();
                        p.Show();
                    }
                    else
                    {
                        MessageBox.Show("invalid username or password");
                    }
                }
                else if (radioButtonpatientlog.Checked)
                {
                    st = "select * from Patient where User_name='" + user + "' and Password='******';";
                    DataTable dt = db.Data(st);
                    if (dt.Rows.Count == 1)
                    {
                        PHome.ds = dt;
                        PatientsPortal p = new PatientsPortal();
                        this.Hide();
                        p.Show();
                    }
                    else
                    {
                        MessageBox.Show("invalid username or password");
                    }
                }
                else if (adminradiobtnlog.Checked)
                {
                    st = "select * from Admin where User_name='" + user + "' and Password='******';";
                    DataTable dt = db.Data(st);
                    if (dt.Rows.Count == 1)
                    {
                        //MessageBox.Show("admin");
                        admin a = new admin();
                        this.Hide();
                        a.Show();
                    }
                    else
                    {
                        MessageBox.Show("invalid username or password");
                    }
                }
                else
                {
                    MessageBox.Show("Let us know whether you're a doctor or a patient!!");
                }
            }
            else
            {
                MessageBox.Show("Maybe you left some fields blank!!");
            }
        }
        private void createbtn_Click(object sender, EventArgs e)
        {
            DataAccess db = new DataAccess();

            if (radioButtondoc.Checked)
            {
                string st;
                int    flag = 0, noentry = 0, id;

                if (name != null && add != null && pass != null && cpass != null && username != null && special != null && ((hospital1 != null && hos1time != null) || (hospital2 != null && hos2time != null)))
                {
                    st = "select * from Doctor where Name='" + name + "' and Address ='" + add + "';";
                    DataTable dd = db.Data(st);
                    if (dd.Rows.Count != 1)
                    {
                        st = "INSERT INTO Doctor(Name,Address,User_Name,Password,Specialist) VALUES ('" + name + "','" + add + "','" + username + "','" + pass + "','" + special + "');";
                        db.Execute(st);
                        st = "select * from Doctor where Name='" + name + "' and Address ='" + add + "';";
                        dd = db.Data(st);
                        int    a;
                        string s      = dd.Rows[0]["Id"].ToString();
                        bool   result = Int32.TryParse(s, out a);
                        id = a;
                    }
                    else
                    {
                        int    a;
                        string s      = dd.Rows[0]["Id"].ToString();
                        bool   result = Int32.TryParse(s, out a);
                        id = a;
                    }
                    if (hospital1 != null && hos1time != null && noentry == 0)
                    {
                        hospital1 = hospital1.Replace(' ', '_');
                        flag      = 1;
                        noentry   = 0;
                    }
                    else if ((hospital1 != null && hos1time == null) || (hospital1 == null && hos1time != null))
                    {
                        noentry = 1;
                    }
                    if (hospital2 != null && hos2time != null && noentry == 0)
                    {
                        hospital2 = hospital2.Replace(' ', '_');

                        flag    = 1;
                        noentry = 0;
                    }
                    else if ((hospital2 != null && hos2time == null) || (hospital2 == null && hos2time != null))
                    {
                        noentry = 1;
                    }
                    if (flag == 0)
                    {
                        MessageBox.Show("You haven't chosen any hospital!! ");
                    }
                    else if (noentry == 1)
                    {
                        MessageBox.Show("You missed something!!");
                    }
                    else
                    {
                        if (hospital1 != null)
                        {
                            st = "INSERT INTO " + hospital1 + "(Id,Name,Address,Specialist,Slot) VALUES ( '" + id + "','" + name + "','" + add + "','" + special + "','" + hos1time + "');";
                            db.Execute(st);
                        }
                        if (hospital2 != null)
                        {
                            st = "INSERT INTO " + hospital2 + "(Id,Name,Address,Specialist,Slot) VALUES ( '" + id + "','" + name + "','" + add + "','" + special + "','" + hos2time + "');";
                            db.Execute(st);
                        }

                        //doctor's portal
                        st = "select * from Doctor where User_name='" + username + "' and Password='******';";
                        DataTable dt = db.Data(st);
                        DHome.dd = dt;
                        DoctorsPortal p = new DoctorsPortal();
                        this.Hide();
                        p.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Maybe you left some fields blank!!");
                }
            }
            else if (radioButtonpatient.Checked || adminradiobtn.Checked)
            {
                if (name != null && add != null && pass != null && cpass != null && username != null)
                {
                    if (pass == cpass)
                    {
                        string st;
                        if (radioButtonpatient.Checked)
                        {
                            st = "INSERT INTO patient(Name,Address,User_name,Password) VALUES ('" + name + "','" + add + "','" + username + "','" + pass + "');";
                        }
                        else
                        {
                            st = "INSERT INTO Admin(Name,Address,User_name,Password) VALUES ('" + name + "','" + add + "','" + username + "','" + pass + "');";
                        }
                        db.Execute(st);
                        if (radioButtonpatient.Checked)
                        {
                            st = "select * from Patient where User_name='" + username + "' and Password='******';";
                            DataTable dt = db.Data(st);
                            PHome.ds = dt;
                            PatientsPortal p = new PatientsPortal();
                            this.Hide();
                            p.Show();
                        }
                        else
                        {
                            admin a = new admin();
                            this.Hide();
                            a.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Password and Confirm Password doesnt match!!");
                    }
                }
                else
                {
                    MessageBox.Show("Maybe you left some fields blank!!");
                }
            }
            else
            {
                MessageBox.Show("Let us know whether you're a doctor or a patient!!");
            }
        }