public PaymentDBOpera()

        {
            conn = DBConnection.getConnection();
        }
        public PatientDBOper()

        {
            conn = DBConnection.getConnection();
        }
 public LoginDBOpert()
 {
     conn = DBConnection.getConnection();
 }
Exemplo n.º 4
0
 public DoctorDBOper()
 {
     conn = DBConnection.getConnection();
 }
 public CreateUsersDBOpe()
 {
     conn = DBConnection.getConnection();
 }
        public ViewDailyAppoiDBOper()

        {
            conn = DBConnection.getConnection();
        }
 public ManagerDBOper()
 {
     conn = DBConnection.getConnection();
 }
Exemplo n.º 8
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            SqlConnection conn = DBConnection.getConnection();

            string username = txtuname.Text.Trim();
            string password = txtpass.Text.Trim();
            string acctype  = cmbacctype.Text;

            if (this.txtuname.Text == "" || this.txtpass.Text == "")
            {
                MessageBox.Show("Please Enter User Name or Password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return;
            }
            try
            {
                if (cmbacctype.SelectedItem == "Admin")
                {
                    SqlCommand cmd = new SqlCommand("SELECT * FROM UserAcc WHERE Username='******' AND Password='******'", conn);

                    SqlDataAdapter adapt = new SqlDataAdapter(cmd);
                    DataSet        ds    = new DataSet();
                    adapt.Fill(ds);
                    int count = ds.Tables[0].Rows.Count;

                    if (count == 1)
                    {
                        MessageBox.Show("Login Successful!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Hide();
                        AdminPanel ap = new AdminPanel();
                        ap.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid username or password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (cmbacctype.SelectedItem == "Manager")
                {
                    SqlCommand cmd = new SqlCommand("SELECT Username, Password FROM UserAcc WHERE Username='******' AND Password='******'", conn);

                    SqlDataAdapter adapt = new SqlDataAdapter(cmd);
                    DataSet        ds    = new DataSet();
                    adapt.Fill(ds);
                    int count = ds.Tables[0].Rows.Count;

                    if (count == 1)
                    {
                        MessageBox.Show("Login Successful!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Hide();
                        ManagerMenu mm = new ManagerMenu();
                        mm.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid username or password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (cmbacctype.SelectedItem == "Front Officer")
                {
                    SqlCommand cmd = new SqlCommand("SELECT Username, Password FROM UserAcc WHERE Username='******' AND Password='******'", conn);

                    SqlDataAdapter adapt = new SqlDataAdapter(cmd);
                    DataSet        ds    = new DataSet();
                    adapt.Fill(ds);
                    int count = ds.Tables[0].Rows.Count;

                    if (count == 1)
                    {
                        MessageBox.Show("Login Successful!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Hide();
                        ClearkMenu cm = new ClearkMenu();
                        cm.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid username or password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (cmbacctype.SelectedItem == "Doctor")
                {
                    SqlCommand cmd = new SqlCommand("SELECT Username, Password FROM UserAcc WHERE Username='******' AND Password='******'", conn);

                    SqlDataAdapter adapt = new SqlDataAdapter(cmd);
                    DataSet        ds    = new DataSet();
                    adapt.Fill(ds);
                    int count = ds.Tables[0].Rows.Count;

                    if (count == 1)
                    {
                        MessageBox.Show("Login Successful!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Hide();
                        DoctorMenu dm = new DoctorMenu();
                        dm.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid username or password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Login Failed", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.txtuname.Text = "";
                    this.txtpass.Text  = "";
                }
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public FrontOfficeDBOper()
 {
     conn = DBConnection.getConnection();
 }