Ejemplo n.º 1
0
        private void BntBackClinicHome_Click(object sender, EventArgs e)
        {
            ClinicProfile cp = new ClinicProfile(ci);

            this.Visible = false;
            cp.Visible   = true;
        }
        private void Btn_login_Click_1(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_userid.Text) || string.IsNullOrEmpty(txt_password.Text))
            {
                MessageBox.Show("Userid or Passwor Missing.");
            }
            else
            {
                try
                {
                    string sql = "select * from login where userid = '" + this.txt_userid.Text + "' AND password = '******' ;";
                    Ds = DataAccess.GetDataSet(sql);

                    User user = new User(Ds);

                    if (user.Status.Equals("admin"))
                    {
                        sql = "select * from admin where userid = '" + this.txt_userid.Text + "';";
                        Ds  = DataAccess.GetDataSet(sql);
                        Admin ad = new Admin(Ds);

                        AdminProfile ap = new AdminProfile(ad);
                        this.Visible = false;
                        ap.Visible   = true;
                    }
                    else if (user.Status.Equals("doctor"))
                    {
                        sql = "select * from doctor where userid = '" + this.txt_userid.Text + "';";
                        Ds  = DataAccess.GetDataSet(sql);
                        Doctor dr = new Doctor(Ds);

                        DoctorProfile dp = new DoctorProfile(dr);
                        this.Visible = false;
                        dp.Visible   = true;
                    }
                    else if (user.Status.Equals("patient"))
                    {
                        sql = "select * from patient where userid = '" + this.txt_userid.Text + "';";
                        Ds  = DataAccess.GetDataSet(sql);

                        Patient pa = new Patient(Ds);

                        PatientProfile pp = new PatientProfile(pa);
                        this.Visible = false;
                        pp.Visible   = true;
                    }
                    else if (user.Status.Equals("clinic"))
                    {
                        sql = "select * from clinic where userid = '" + this.txt_userid.Text + "';";
                        Ds  = DataAccess.GetDataSet(sql);

                        Clinic c = new Clinic(Ds);

                        ClinicProfile ci = new ClinicProfile(c);
                        this.Visible = false;
                        ci.Visible   = true;
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Userid and Password dosen't match!");
                }
            }
        }