Пример #1
0
 private void Printer_Load(object sender, EventArgs e)
 {
     if (File.Exists("cashier.json"))
     {
         string data = File.ReadAllText("cashier.json");
         c = JsonConvert.DeserializeObject <Cashier>(data);
     }
     else
     {
         c = new Cashier("", "");
     }
     using (RequestCashierDetails cashierDetails = new RequestCashierDetails(c))
     {
         if (cashierDetails.ShowDialog() != DialogResult.OK)
         {
             startup.Show();
             Close();
             return;
         }
         c = cashierDetails.c;
         string encodedData = JsonConvert.SerializeObject(c);
         File.WriteAllText("cashier.json", encodedData);
     }
     cashierLabel.Text = c.name;
     vatinLabel.Text   = c.vatin;
 }
Пример #2
0
 private void changeDetailsButton_Click(object sender, EventArgs e)
 {
     using (RequestCashierDetails cashierDetails = new RequestCashierDetails(c))
     {
         if (cashierDetails.ShowDialog() == DialogResult.OK)
         {
             c = cashierDetails.c;
         }
     }
     cashierLabel.Text = c.name;
     vatinLabel.Text   = c.vatin;
 }