예제 #1
0
        private void BtnHome_Click(object sender, EventArgs e)
        {
            DashboardForm df = new DashboardForm("userID");

            this.Hide();
            df.Show();
        }
예제 #2
0
        //Method To Login
        #region
        public void LoginMethod()
        {
            using (SqlConnection sqlCon = new SqlConnection(connectionString))
            {
                sqlCon.Open();
                string         query = "select UserID from Table_Login where Username = '******' and Password = '******'";
                SqlDataAdapter sda   = new SqlDataAdapter(query, sqlCon);
                DataTable      dtbl  = new DataTable();
                sda.Fill(dtbl);

                SqlDataReader rd  = null;
                SqlCommand    cmd = new SqlCommand(query, sqlCon);
                rd = cmd.ExecuteReader();
                while (rd.Read())
                {
                    userID = string.Format("{0}", rd["UserID"].ToString());
                }

                rd.Close();

                if (dtbl.Rows.Count == 1)
                {
                    DashboardForm df = new DashboardForm(userID);
                    this.Hide();
                    df.Show();
                }
                else
                {
                    MessageBox.Show("Please check Username and Password");
                    ClearLoginForm();
                }
            }
        }
예제 #3
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            string message = Obj_data.Login(txt_UserName.Text, txt_Password.Text);

            if (message == "User Login Successfully")
            {
                MessageBox.Show(message);
                this.Hide();
                var DashboardForm_Obj = new DashboardForm();
                DashboardForm_Obj.Closed += (s, args) => this.Close();
                DashboardForm_Obj.Show();
            }
            else
            {
                MessageBox.Show(message);
            }
        }