Exemple #1
0
        private void button_Click(object sender, EventArgs e)
        {
            temp_id = text_id.Text.ToString();
            temp_pw = text_pw.Text.ToString();

            conn.Open();
            string           sql3 = "SELECT * FROM member";
            SQLiteCommand    cmd2 = new SQLiteCommand(sql3, conn);
            SQLiteDataReader read = cmd2.ExecuteReader();

            string temp = sender.ToString();

            string[] temp_arr = temp.Split(' ');

            switch (temp_arr[temp_arr.Length - 1])
            {
            case "로그인":
                while (read.Read())
                {
                    if (read["user"].ToString().Equals(temp_id) && read["password"].ToString().Equals(temp_pw))
                    {
                        Form1.login_check = 1;
                        text_id.Text      = "";
                        text_pw.Text      = "";
                        Form1.login_check = 1;
                        this.Close();
                        break;
                    }
                }
                break;

            case "취소":
                this.Close();
                break;

            case "회원가입":
                signup = new Form_signup();
                signup.ShowDialog();
                break;

            default:
                MessageBox.Show("아직 구현되지 않았습니다");
                break;
            }


            read.Close();
            conn.Close();
        }
        private void button_Click(object sender, EventArgs e)
        {
            Button btn  = sender as Button;
            string temp = sender.ToString();

            string[] temp_arr = temp.Split(' ');
            switch (temp_arr[temp_arr.Length - 1])
            {
            case "로그인":
                temp_id = text_id.Text.ToString();
                temp_pw = text_pw.Text.ToString();

                conn.Open();
                string           sql3 = "SELECT user, password,id FROM member where user = '******' and password = '******';";
                SQLiteCommand    cmd2 = new SQLiteCommand(sql3, conn);
                SQLiteDataReader read = cmd2.ExecuteReader();

                if (read.HasRows)
                {
                    while (read.Read())
                    {
                        Form1.login_check = 1;
                        text_id.Text      = "";
                        text_pw.Text      = "";
                        id = int.Parse(read["id"].ToString());
                        Form1.login_check = 1;
                        this.Close();
                        break;
                    }
                }
                else
                {
                    MessageBox.Show("로그인 실패! \n다시 확인해주세요.");
                }
                read.Close();
                conn.Close();
                break;

            case "취소":
                this.Close();
                break;

            case "회원가입":
                SQLiteConnection.ClearAllPools();
                signup = new Form_signup();
                signup.ShowDialog();
                break;

            case "아이디찾기":
                find_id1.Visible = true;
                break;

            case "로그인화면이동":
                find_id1.Visible = false;
                break;

            case "비밀번호찾기":     //이거 이름 바꿈
                search_pass1.Visible = true;
                break;

            case "find_password":     //이거 추가
                search_pass1.Visible = false;
                break;

            default:
                MessageBox.Show("아직 구현되지 않았습니다");
                break;

            case "비회원로그인":     //이거 이름 바꿈
                Form1.login_check = 2;
                this.Close();
                break;

            case "passtimeover":
                search_pass1.Visible = false;
                break;

            case "idtimeover":
                find_id1.Visible = false;
                break;

            case "find_id_cancel":
                find_id1.Visible = false;
                break;

            case "pass_cancel":
                search_pass1.Visible = false;
                break;
            }


            //read.Close();
            conn.Close();
        }