Пример #1
0
 public Weight(Weight weight)
 {
     Pounds = weight.Pounds;
     Id = 0;
     Date = weight.Date;
     CatKey = weight.CatKey;
 }
Пример #2
0
 public Scale(Weight weight)
 {
     _current = weight;
     InitializeComponent();
 }
Пример #3
0
 private void WeighACatNoBindings(Cat cat, Weight weight)
 {
     Scale dlg = new Scale(weight.Pounds, weight.Date);
     if (DialogResult.OK == dlg.ShowDialog())
     {
         weight.Pounds = dlg.Pounds;
         weight.Date = dlg.WeighDate;
         _model.SaveObject<Weight>(weight);
         cat.CurrentWeight = weight;
     }
 }
Пример #4
0
 private void WeighACatWithBindings(Cat cat, Weight weight)
 {
     Scale dlg = new Scale(weight);
     if (DialogResult.OK == dlg.ShowDialog())
     {
         _model.SaveObject<Weight>(weight);
         cat.CurrentWeight = weight;
     }
 }
Пример #5
0
 public void WeighACat(Cat cat)
 {
     if (Equals(null, _model)) return;
     _model.GetCurrentWeight(cat);
     if (Equals(null, cat.CurrentWeight))
     {
         cat.CurrentWeight = new Weight();
         cat.CurrentWeight.CatKey = cat.Id;
     }
     Weight newWeight = new Weight(cat.CurrentWeight);
     WeighACatNoBindings(cat, newWeight);
     WeighACatWithBindings(cat, newWeight);
 }