Example #1
0
        public void TestMethodWithNumbersAndSpecialCharactersAndUniqueVowel()
        {
            string test = "aAb.Bcf5eaAbBABa+cfotre";

            IStream stream = new ManipulateText(test);
            char    result = CheckText.FirstChar(stream);

            Assert.AreEqual('o', result);
        }
Example #2
0
        public void TestMethodSimple()
        {
            string test = "fe";

            IStream stream = new ManipulateText(test);
            char    result = CheckText.FirstChar(stream);

            Assert.AreEqual('e', result);
        }
Example #3
0
        public void TestMethodWithNumbers()
        {
            string test = "aAbBcf5eaAbBABacf";

            IStream stream = new ManipulateText(test);
            char    result = CheckText.FirstChar(stream);

            Assert.AreEqual('\0', result);
        }
Example #4
0
        public void TestMethodOnlyNumbers()
        {
            string test = "546789";

            IStream stream = new ManipulateText(test);
            char    result = CheckText.FirstChar(stream);

            Assert.AreEqual('\0', result);
        }
Example #5
0
        public void TestMethodOnlyConsonants()
        {
            string test = "CdKyt";

            IStream stream = new ManipulateText(test);
            char    result = CheckText.FirstChar(stream);

            Assert.AreEqual('\0', result);
        }
Example #6
0
        public void TestMethodManyCharacters()
        {
            string test = "aAbBABacfeaAbBABacf";

            IStream stream = new ManipulateText(test);
            char    result = CheckText.FirstChar(stream);

            Assert.AreEqual('e', result);
        }
Example #7
0
        protected void Confirm_Click(object sender, EventArgs e)
        {
            if (NameText.Text == "")
            {
                Response.Write("<script>alert('用户名不能为空!')</script>");
                NameText.Focus();
                return;
            }
            else if (WordText.Text == "")
            {
                Response.Write("<script>alert('密码不能为空!')</script>");
                WordText.Focus();
                return;
            }
            else if (CheckText.Text != checkNum.ToString())
            {
                Response.Write("<script>alert('验证码错误!')</script>");
                CheckText.Focus();
                return;
            }
            string        strConn = ConfigurationManager.ConnectionStrings["TSGConnectionString1"].ConnectionString;
            SqlConnection conn    = new SqlConnection(strConn);
            DataSet       ds      = new DataSet();

            conn.Open();
            if (DropDownList1.SelectedValue == "普通读者")
            {
                string     lendSql = "SELECT * FROM PATRON WHERE PATRONID = \'" + NameText.Text + "\' AND PASSWORD = \'" + WordText.Text + "\'";
                SqlCommand lendCmd = new SqlCommand(lendSql, conn);
                try {
                    SqlDataReader dr = lendCmd.ExecuteReader();
                    if (dr.Read())
                    {
                        Response.Redirect("library.aspx");
                    }
                    else
                    {
                        Response.Write("<script>alert('用户名或密码错误!')</script>");
                    }
                }
                catch {
                    Response.Write("<script>alert('系统错误,请检查输入!')</script>");
                }
                finally {
                    library.figure = "普通读者";
                }
            }
            else
            {
                string lendSql = "SELECT * FROM USERS WHERE USERID = \'" + NameText.Text +
                                 "\' AND PASSWORD = \'" + WordText.Text +
                                 "\' AND ROLE = \'" + DropDownList1.SelectedValue + "\'";
                SqlCommand lendCmd = new SqlCommand(lendSql, conn);
                try {
                    SqlDataReader dr = lendCmd.ExecuteReader();
                    if (dr.Read())
                    {
                        library.figure = DropDownList1.SelectedValue;
                        Response.Redirect("library.aspx");
                    }
                    else
                    {
                        Response.Write("<script>alert('用户名或密码错误!')</script>");
                    }
                }
                catch (Exception err) {
                    Response.Write("<script>alert('系统错误,请检查输入!')</script>");
                }
                finally {
                    library.figure = DropDownList1.SelectedValue;
                }
            }
        }