+
-
+
-
+
+
+
Random Sex
@@ -96,10 +160,10 @@
Female
-
+
-
-
+
+
diff --git a/iDentity/iDentity.aspx.cs b/iDentity/iDentity.aspx.cs
index b29b81b..7fb4ee9 100644
--- a/iDentity/iDentity.aspx.cs
+++ b/iDentity/iDentity.aspx.cs
@@ -4,6 +4,7 @@
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
+using RestSharp;
namespace iDentity
{
@@ -11,42 +12,127 @@ public partial class iDentity : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
- picture.Visible = false;
+ //If a picture hasn't been loaded, don't show the picture div.
+ if (face.Src == "#")
+ {
+ picture.Visible = false;
+ }
+ ///////////////////////////////////////////////////////
+
+ //Determines which Age-related div to show on screen.//
+ randAge.Style.Add("display","none");
+ setAge.Style.Add("display", "none");
+ ageRange.Style.Add("display", "none");
+ if (ageSelector.SelectedValue == "0")
+ {
+ randAge.Style.Add("display", "inline-block");
+ }
+ else if (ageSelector.SelectedValue == "1")
+ {
+ setAge.Style.Add("display", "inline-block");
+ }
+ else
+ {
+ ageRange.Style.Add("display", "inline-block");
+ }
+ ///////////////////////////////////////////////////////
+
+ //Determines which Name-related div to show on screen//
+ randName.Style.Add("display", "none");
+ setName.Style.Add("display", "none");
+ if (nameSelector.SelectedValue == "0")
+ {
+ randName.Style.Add("display", "inline-block");
+ }
+ else
+ {
+ setName.Style.Add("display", "inline-block");
+ }
+ ///////////////////////////////////////////////////////
+
}
+ private static RestClient birthAPI = new RestClient("https://localhost:44325/api/BirthDate");
+
+ //submit_Click is called when the "Generate ID!" button is clicked.
protected void submit_Click(object sender, EventArgs e)
{
- string link = "https://fakeface.rest/face/view?";
- picture.Visible = true;
+ string link = "https://fakeface.rest/face/view?"; //initialize face's query
+ string birthDate = "?"; //initialize birthdate query
+ int age;
+ string sex = "";
+ Random randNum = new Random();
+ ///////Age Selector Query///////
if (ageSelector.SelectedValue == "0")
{
- //no value = random
+ age = randNum.Next(10, 75); //generate a random age
+ link = link +"minimum_age=" + age + "&maximum_age=" + age;
+ birthDate = birthDate + "Age=" + age;
}
else if (ageSelector.SelectedValue == "1")
{
- link = link+ "minimum_age=" + oneAge.Text + "&maximum_age=" + oneAge.Text;
+ link = link + "minimum_age=" + oneAge.Text + "&maximum_age=" + oneAge.Text;
+ birthDate = birthDate + "Age=" + oneAge.Text;
}
else if (ageSelector.SelectedValue == "2")
{
link = link + "minimum_age=" + ageMin.Text + "&maximum_age=" + ageMax.Text;
+ birthDate = birthDate + "minAge=" + ageMin.Text + "&maxAge=" + ageMax.Text;
}
-
+ ////////////////////////////////
+
+ ///////Sex Selector Query///////
if (sexSelector.SelectedValue == "0")
{
- //no value = random
+ int randSex = randNum.Next(2);
+ if (randSex == 1)
+ {
+ sex = "male";
+ }
+ else sex = "female";
}
- else if (sexSelector.SelectedValue == "1")
+ if (sexSelector.SelectedValue == "1" || sex == "male")
{
link = link + "&gender=male";
+ sexText.InnerHtml = "Sex : Male";
}
- else if (sexSelector.SelectedValue == "2")
- {
+ else {
link = link + "&gender=female";
+ sexText.InnerHtml = "Sex : Female";
}
+ ////////////////////////////////
+
+ //Address Query/////////////////
+ /*
+ * Here, we need to generate a legitimate-enough address. I'm thinking that we can add a Zip-Code selector (text box),
+ * assuming we're generating addresses based off of zip-codes. That way, the consumer has the option
+ * to customize the fake identity as much as they want to, but still have the option to keep it
+ * completely random.
+ *
+ * To-do list:
+ * find or create an API that takes a ZIP (or really, anything) and creates a street address
+ * implement it -here-
+ *
+ *
+ * addressText.InnerHTML = address_query;
+ */
+ ////////////////////////////////
+
- face.Src = link;
+ face.Src = link; //Call on fakeface.rest API to get face with desired attributes (above)
+ picture.Visible = true; //Make picture visible once face is loaded
+
+ ///////BirthDate API Call///////
+ RestRequest birthRequest = new RestRequest(birthDate,
+ Method.GET);
+ IRestResponse
> birthResponse =
+ birthAPI.Execute>(birthRequest);
+ ////////////////////////////////
+
+ birthDateText.InnerHtml = "Birthdate: " + birthResponse.Content; //Set Birthdate in HTML
+
}
}
diff --git a/iDentity/iDentity.aspx.designer.cs b/iDentity/iDentity.aspx.designer.cs
index ff0827e..9a66476 100644
--- a/iDentity/iDentity.aspx.designer.cs
+++ b/iDentity/iDentity.aspx.designer.cs
@@ -41,6 +41,87 @@ public partial class iDentity
///
protected global::System.Web.UI.HtmlControls.HtmlImage face;
+ ///
+ /// sexText control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl sexText;
+
+ ///
+ /// birthDateText control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl birthDateText;
+
+ ///
+ /// addressText control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl addressText;
+
+ ///
+ /// nameSelector control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.RadioButtonList nameSelector;
+
+ ///
+ /// randomName control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.ListItem randomName;
+
+ ///
+ /// specificName control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.ListItem specificName;
+
+ ///
+ /// randName control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl randName;
+
+ ///
+ /// setName control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl setName;
+
+ ///
+ /// oneName control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox oneName;
+
///
/// ageSelector control.
///
diff --git a/iDentity/iDentity.csproj b/iDentity/iDentity.csproj
index da83923..d004ef9 100644
--- a/iDentity/iDentity.csproj
+++ b/iDentity/iDentity.csproj
@@ -44,6 +44,9 @@
+
+ ..\packages\RestSharp.106.11.7\lib\net452\RestSharp.dll
+
diff --git a/iDentity/packages.config b/iDentity/packages.config
index a644c96..425e9f5 100644
--- a/iDentity/packages.config
+++ b/iDentity/packages.config
@@ -6,4 +6,5 @@
+
\ No newline at end of file
From d46ef61c4d0f09b8a2a96c84fd9901cfa7b44a3d Mon Sep 17 00:00:00 2001
From: prichard38 <63981592+prichard38@users.noreply.github.com>
Date: Tue, 9 Mar 2021 00:52:59 -0500
Subject: [PATCH 2/3] comments added, functionalities added
---
iDentity/iDentity.aspx | 2 +-
iDentity/iDentity.aspx.cs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/iDentity/iDentity.aspx b/iDentity/iDentity.aspx
index badb564..7815e62 100644
--- a/iDentity/iDentity.aspx
+++ b/iDentity/iDentity.aspx
@@ -11,7 +11,7 @@
.auto-style1 {
width: 340px;
height: 340px;
- }
+ }