コード例 #1
0
ファイル: Register.cs プロジェクト: yashen97/C-Sharp-Project
        private void button4_Click(object sender, EventArgs e)
        {
            Adminlog obj = new Adminlog();

            this.Hide();
            obj.Show();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: yashen97/C-Sharp-Project
        public void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Contains("A"))
            {
                phrm = "admin";
            }
            else
            {
                phrm = "login";
            }


            string         con = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\Database\HMS.mdf;Integrated Security=True;Connect Timeout=30";
            string         qry = "SELECT * From login WHERE username = '******' and password = '******'";
            SqlDataAdapter adp = new SqlDataAdapter(qry, con);
            DataTable      tb  = new DataTable();

            adp.Fill(tb);

            if (tb.Rows.Count == 1 && textBox1.Text.Contains("D") && textBox1.Text.Length == 4)
            {
                drlog obj = new drlog();
                this.Hide();
                obj.Show();
            }

            else if (tb.Rows.Count == 1 && textBox1.Text.Contains("P") && textBox1.Text.Length == 3)
            {
                phrm = "p";
                pharlog obj = new pharlog();
                this.Hide();
                obj.Show();
            }


            else if (tb.Rows.Count == 1 && textBox1.Text.Contains("A") && textBox1.Text.Length == 2)
            {
                Adminlog obj = new Adminlog();
                this.Hide();
                obj.Show();
            }

            else if (tb.Rows.Count == 1 && textBox1.Text.Contains("R") && textBox1.Text.Length == 3)
            {
                PatientDB obj = new PatientDB();
                this.Hide();
                obj.Show();
            }
            else
            {
                MessageBox.Show("Invalid Username or Password");
            }
        }
コード例 #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            Form1  hi = new Form1();
            string ph = Form1.phrm;

            if (ph == "admin")
            {
                Adminlog obj = new Adminlog();
                this.Hide();
                obj.Show();
            }
            else
            {
                this.Hide();
                hi.Show();
            }
        }