Пример #1
0
        protected void showButton_Click(object sender, EventArgs e)
        {
            SpeedCalculator nVehicle = (SpeedCalculator)ViewState["Vehicle"];

            if (ViewState["Vehicle"] != null)
            {
                double maxSpeed = nVehicle.GetMaxSpeed();
                double minSpeed = nVehicle.GetMinSpeed();
                double avgSpeed = nVehicle.GetAvgSpeed();
                maxTextBox.Text         = maxSpeed.ToString();
                minTextBox.Text         = minSpeed.ToString();
                avgTextBox.Text         = avgSpeed.ToString();
                vehicleNameTextBox.Text = string.Empty;
                regNoTextBox.Text       = string.Empty;
            }
        }
Пример #2
0
 protected void speedEnterButton_Click(object sender, EventArgs e)
 {
     if (ViewState["Vehicle"] != null && String.IsNullOrWhiteSpace(speedTextBox.Text) == false)
     {
         showErrorLabel.Text = String.Empty;
         SpeedCalculator newVehicle = (SpeedCalculator)ViewState["Vehicle"];
         newVehicle.speedList.Add(Double.Parse(speedTextBox.Text));
         ViewState["Vehicle"] = newVehicle;
         speedTextBox.Text    = string.Empty;
     }
     else
     {
         showErrorLabel.Text      = "Fill the blank field properly";
         showErrorLabel.ForeColor = System.Drawing.Color.Red;
     }
 }