Advertisement
Kirsiina

juu

Oct 24th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.48 KB | None | 0 0
  1. try
  2.             {
  3.  
  4.                 string maara;
  5.                 int value = (int)numericUpDown1.Value;
  6.                 maara = "" + (e95 - value);
  7.                 double hinta = Convert.ToDouble(e95hinta) * value;
  8.  
  9.                 if (value > e95)
  10.                 {
  11.                     MessageBox.Show("Valitettavasti tankkaus epäonnistui. Ota yhteys henkilökuntaan.");
  12.                 }
  13.                 else
  14.                 {
  15.                     DialogResult result = MessageBox.Show("Tankataan E95, hintaa " + hinta + "€", "Oletko varma?", MessageBoxButtons.YesNo);
  16.  
  17.                     if (result == DialogResult.Yes)
  18.                     {
  19.                         e95 = int.Parse(maara);
  20.                         using (StreamWriter sw = new StreamWriter(tiedostoPolku))
  21.                         {
  22.                             sw.WriteLine(e95);
  23.                             sw.WriteLine(e98);
  24.                             sw.WriteLine(diesel);
  25.                         }
  26.  
  27.                         using (StreamWriter sw = new StreamWriter(tiedostoPolku2, true))
  28.                         {
  29.                             string time = DateTime.Now.ToString();
  30.                             sw.WriteLine(time + " ostettu " + value + " litraa E95");
  31.                         }
  32.  
  33.                         kiitoslabel.Visible = true;
  34.  
  35.                     }
  36.                 }
  37.  
  38.             }
  39.             catch
  40.             {
  41.                 MessageBox.Show("Jotain meni pieleen");
  42.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement