private void regbtn_CheckedChanged(object sender, EventArgs e) { if (regbtn.Checked) { CustomerFunctions cf = new CustomerFunctions(); DataTable dt = new DataTable(); dt = cf.Select(); customerlist.DataSource = dt; } }
private void cnamebox_TextChanged(object sender, EventArgs e) { if (regbtn.Checked) { string cname = textbox1.Text.Trim(); CustomerFunctions cf = new CustomerFunctions(); DataTable dt = new DataTable(); dt = cf.Search_name(cname); customerlist.DataSource = dt; } }
public async Task CustomersTestAsync() { TestLambdaContext context; APIGatewayProxyRequest request; APIGatewayProxyResponse response; CustomerFunctions functions = new CustomerFunctions(this.DDBClient, this.TableName); // Add a new blog post Customers cust = new Customers(); cust.Name = "The awesome post"; cust.Email = "Content for the awesome blog"; request = new APIGatewayProxyRequest { Body = JsonConvert.SerializeObject(cust) }; context = new TestLambdaContext(); response = await functions.AddCustomerAsync(request, context); Assert.Equal(200, response.StatusCode); var blogId = response.Body; // Confirm we can get the blog post back out request = new APIGatewayProxyRequest { PathParameters = new Dictionary <string, string> { { CustomerFunctions.ID_QUERY_STRING_NAME, blogId } } }; context = new TestLambdaContext(); response = await functions.GetCustomerAsync(request, context); Assert.Equal(200, response.StatusCode); Customers read = JsonConvert.DeserializeObject <Customers>(response.Body); // List the blog posts request = new APIGatewayProxyRequest { }; context = new TestLambdaContext(); response = await functions.GetCustomersAsync(request, context); Assert.Equal(200, response.StatusCode); Customers[] blogPosts = JsonConvert.DeserializeObject <Customers[]>(response.Body); Assert.Single(blogPosts); // Delete the blog post request = new APIGatewayProxyRequest { PathParameters = new Dictionary <string, string> { { CustomerFunctions.ID_QUERY_STRING_NAME, blogId } } }; context = new TestLambdaContext(); response = await functions.RemoveCustomerAsync(request, context); Assert.Equal(200, response.StatusCode); // Make sure the post was deleted. request = new APIGatewayProxyRequest { PathParameters = new Dictionary <string, string> { { CustomerFunctions.ID_QUERY_STRING_NAME, blogId } } }; context = new TestLambdaContext(); response = await functions.GetCustomerAsync(request, context); Assert.Equal((int)HttpStatusCode.NotFound, response.StatusCode); }
protected void btnCreateAccount_Click(object sender, EventArgs e) { if (txtDesiredUsername.Text == "") //CHECKS FOR ANY BLANK FIELDS IN ACCOUNT CREATION { lblErrorMessage.Text = "Please make sure all fields are filled out correctly."; return; } if (txtNewName.Text == "") { lblErrorMessage.Text = "Please make sure all fields are filled out correctly."; return; } if (txtNewEmail.Text == "") { lblErrorMessage.Text = "Please make sure all fields are filled out correctly."; return; } if (txtDesiredPassword1.Text == "") { lblErrorMessage.Text = "Please make sure all fields are filled out correctly."; return; } if (txtDesiredPassword2.Text == "") { lblErrorMessage.Text = "Please make sure all fields are filled out correctly."; return; } if (ddlAccountType.Text == "") { lblErrorMessage.Text = "Please select which account type you are making."; return; } if (txtDesiredPassword1.Text != txtDesiredPassword2.Text) //Checks to make sure the two passwords match { lblErrorMessage.Text = "Your passwords do not match."; return; } OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction(); DBConnect objDB = new DBConnect(); string desiredname = txtDesiredUsername.Text; string sqlCheck = "SELECT * From Accounts WHERE Username = '******'"; DataSet myDS = objDB.GetDataSet(sqlCheck); // String checking = myDS.Tables[0].Rows[0][0].ToString(); if (myDS.Tables[0].Rows.Count > 0) { lblErrorMessage.Text = "Username is already taken. Please select another."; } else //if all fields ok make a new account and redirect to homepage { CustomerFunctions cf = new CustomerFunctions(); string name = txtNewName.Text; string email = txtNewEmail.Text; string username = txtDesiredUsername.Text; string password = txtDesiredPassword1.Text; string accounttype = ddlAccountType.Text; Customer newUser = new Customer(name, email, username, password, accounttype); pxy.AddNewUserDB(username, password, name, email, accounttype); Session["User"] = newUser; Response.Redirect("UserHome.aspx"); } }