Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ChallengeEpicSpyAssetTracker
- {
- public partial class Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if(!Page.IsPostBack)
- {
- string[] assets = new string[0];
- double[] elections = new double[0];
- double[] acts = new double[0];
- ViewState.Add("Assets", assets);
- ViewState.Add("Elections", elections);
- ViewState.Add("Acts", acts);
- }
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- string[] assets = (string[])ViewState["Assets"];
- double[] elections = (double[])ViewState["Elections"];
- double[] acts = (double[])ViewState["Acts"];
- //int newIndex = assets.GetUpperBound(0);
- int elements = assets.Length + 1;
- Array.Resize(ref assets, elements);
- Array.Resize(ref elections, elements);
- Array.Resize(ref acts, elements);
- int newIndex = assets.GetUpperBound(0);
- assets[newIndex] = assetTextBox.Text;
- elections[newIndex] = double.Parse(electionsTextBox.Text);
- acts[newIndex] = double.Parse(actsTextBox.Text);
- ViewState["Asssets"] = assets;
- ViewState["Elections"] = elections;
- ViewState["Acts"] = acts;
- resultLabel.Text= String.Format("Total Elections Rigged: {0} </br>Average of subterfurge per asset{1:N2}</br> (Last Asset Added: {2})",
- elections.Sum(), acts.Average(), assets[newIndex]);
- //resultLabel.Text = String.Format("Last Asset Added: {2} </br>Elections Total: {0} </br>Average of subterfurge per asset{1:N2}", elections.Sum(), acts.Average(), assets);
- assetTextBox.Text = "";
- electionsTextBox.Text = "";
- actsTextBox.Text = "";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement