//Дорівнює protected void ButtonResult_Click(object sender, EventArgs e) { try { a = (double)ViewState["a"]; b = Convert.ToDouble(TextBox1.Text); action = (int)ViewState["action"]; switch (action) { case 1: TextBox1.Text = Convert.ToString(SCClass.Addition(a, b)); ViewState["b"] = TextBox1.Text; break; case 2: TextBox1.Text = Convert.ToString(SCClass.Subtraction(a, b)); ViewState["b"] = TextBox1.Text; break; case 3: TextBox1.Text = Convert.ToString(SCClass.Multiplication(a, b)); ViewState["b"] = TextBox1.Text; break; case 4: TextBox1.Text = Convert.ToString(SCClass.Division(a, b)); ViewState["b"] = TextBox1.Text; break; } } catch { ERROR(); } }
//Операції public void ActionControl(int act) { try { if (ViewState["b"] != null) { a = (double)ViewState["b"]; action = (int)ViewState["action"]; b = Convert.ToDouble(TextBox1.Text); switch (action) { case 1: result = (SCClass.Addition(a, b)); ViewState["b"] = result; break; case 2: result = (SCClass.Subtraction(a, b)); ViewState["b"] = result; break; case 3: result = (SCClass.Multiplication(a, b)); ViewState["b"] = result; break; case 4: result = (SCClass.Division(a, b)); ViewState["b"] = result; break; } ViewState["a"] = result; ViewState["action"] = act; TextBox1.Text = null; } else { a = Convert.ToDouble(TextBox1.Text); ViewState["a"] = a; ViewState["b"] = a; ViewState["action"] = act; TextBox1.Text = null; } } catch { ERROR(); } }