示例#1
0
        public void EmailPropertyOK()
        {
            clsOrder AWidget  = new clsOrder();
            string   TestData = "*****@*****.**";

            AWidget.Email = TestData;
            var Error = AWidget.RegEmail(TestData);

            Assert.AreEqual(Error, "");
        }
示例#2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('hello')", true);
        // Response.Redirect("Login.aspx");
        //if (Mobiletxt.Text.GetType() == typeof(int))
        //{

        //}
        //else
        //{
        //    errorText.Text = "Please Enter Mobile as a Integer";
        //    return;
        //}

        //if (Pincodetxt.Text.GetType() == typeof(int))
        //{

        //}
        //else
        //{
        //    errorText.Text = "Please Enter Pincode as a Integer";
        //    return;
        //}

        string constring = ConfigurationManager.ConnectionStrings["studentconn"].ToString();

        con = new SqlConnection(constring);

        Customer customer = new Customer();

        customer.Name     = Nametxt.Text.ToString();
        customer.Address  = Addresstxt.Text.ToString();
        customer.City     = Citytxt.Text.ToString();
        customer.Postcode = Postcodetxt.Text.ToString();
        customer.Mobile   = Mobiletxt.Text.ToString();
        customer.Email    = Emailtxt.Text.ToString();
        customer.Password = Passwordtxt.Text.ToString();

        errorText.Text = "";
        clsOrder order = new clsOrder();
        var      data  = order.RegisterValid(customer.Name, customer.Address, customer.City, customer.Postcode, customer.Mobile, customer.Email, customer.Password);

        if (data == "")
        {
            var nameValid     = order.RegName(customer.Name);
            var addressValid  = order.RegAddress(customer.Address);
            var cityValid     = order.RegCity(customer.City);
            var postcodeValid = order.RegPostCode(customer.Postcode);
            var emailValid    = order.RegEmail(customer.Email);
            var mobileValid   = order.RegMobile(customer.Mobile);
            var passValid     = order.RegPassword(customer.Password);


            nameError.Text     = nameValid;
            addressError.Text  = addressValid;
            cityError.Text     = cityValid;
            postcodeError.Text = postcodeValid;
            emailError.Text    = emailValid;
            mobileError.Text   = mobileValid;
            passwordError.Text = passValid;

            if (nameValid == "" && addressValid == "" && cityValid == "" && postcodeValid == "" && emailValid == "" && mobileValid == "" && passValid == "")
            {
                var response = AddCustomer(customer);
                if (response)
                {
                    Response.Redirect("OrdersLogin.aspx");
                }
            }
        }
        else
        {
            if (data == "Please Enter Your Credentials")
            {
                errorText.Text = data;
            }
            else
            {
                errorText.Text = data;
            }
        }
    }
示例#3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string constring = ConfigurationManager.ConnectionStrings["studentconn"].ToString();

        con = new SqlConnection(constring);

        // var value  = text1.Text;


        Customer customer = new Customer();

        customer.Name     = txt_Nametxt.Text.ToString();
        customer.Address  = txt_Addresstxt.Text.ToString();
        customer.City     = txt_Citytxt.Text.ToString();
        customer.Postcode = txt_Postcodetxt.Text.ToString();
        customer.Mobile   = txt_Mobiletxt.Text.ToString();
        customer.Email    = txt_Emailtxt.Text.ToString();
        customer.Password = txt_Passwordtxt.Text.ToString();

        clsOrder order = new clsOrder();
        var      data  = order.RegisterValid(customer.Name, customer.Address, customer.City, customer.Postcode, customer.Mobile, customer.Email, customer.Password);

        if (data == "")
        {
            var nameValid     = order.RegName(customer.Name);
            var addressValid  = order.RegAddress(customer.Address);
            var cityValid     = order.RegCity(customer.City);
            var postcodeValid = order.RegPostCode(customer.Postcode);
            var emailValid    = order.RegEmail(customer.Email);
            var mobileValid   = order.RegMobile(customer.Mobile);
            var passValid     = order.RegPassword(customer.Password);


            nameError.Text     = nameValid;
            addressError.Text  = addressValid;
            cityError.Text     = cityValid;
            postcodeError.Text = postcodeValid;
            emailError.Text    = emailValid;
            mobileError.Text   = mobileValid;
            passwordError.Text = passValid;

            if (nameValid == "" && addressValid == "" && cityValid == "" && postcodeValid == "" && emailValid == "" && mobileValid == "" && passValid == "")
            {
                var response = UpdateCustomer(customer);
                if (response)
                {
                    Response.Redirect("OrdersLogin.aspx");
                }
            }
        }
        else
        {
            if (data == "Please Enter Your Credentials")
            {
                errorText.Text = data;
            }
            else
            {
                errorText.Text = data;
            }
        }
    }