public Box(int id, BaseObject parent = null, BaseObject child = null, bool loadChildren = true) : base(id, parent, child, loadChildren) { dialogType = typeof(BoxDialog); if (parent != null) { if (parent is Product) { product = (Product)parent; } else { shelf = (Shelf)parent; } } else { product = new Product(IdProduct, null, this, true); } //if (product == null) product = new Product(IdProduct, null, this); //if (shelf == null) shelf = new Shelf(IdShelf, null, this); if (id == 0) { IdStatus = 1; } }
protected override bool GetFields(out string errMessage) { errMessage = ""; Shelf shelf = (Shelf)baseObject; shelf.Num = txtNum.Text; shelf.MaxWeight = int.Parse(txtMaxWeight.Text); shelf.Note = txtNote.Text; return(true); }
protected override void SetFields() { Shelf shelf = (Shelf)baseObject; if (shelf.Id == 0) { Text = "Новая полка"; } else { Text = String.Format("Полка: {0}", shelf.Num); } txtNum.Text = shelf.Num; txtMaxWeight.Text = shelf.MaxWeight.ToString(); txtProcent.Text = shelf.Procent.ToString("0.00"); txtNote.Text = shelf.Note; }