public Weight(Weight weight) { Pounds = weight.Pounds; Id = 0; Date = weight.Date; CatKey = weight.CatKey; }
public Scale(Weight weight) { _current = weight; InitializeComponent(); }
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; } }
private void WeighACatWithBindings(Cat cat, Weight weight) { Scale dlg = new Scale(weight); if (DialogResult.OK == dlg.ShowDialog()) { _model.SaveObject<Weight>(weight); cat.CurrentWeight = weight; } }
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); }