public SupplyDialog(DialogState dialogState, long?id = null) : base(dialogState, id) { if (id.HasValue) { _supply = EntityManager.GetSupply(id.Value); Organization = _supply.GetOrganization(); ResponsiblePerson = _supply.GetResponsiblePerson(); Bill = _supply.GetBill(); } else { _supply = new Supply() { SupplyId = EntityManager.GetNextSupplyId() }; Bill = new Bill() { BillId = EntityManager.GetNextBillId(), SupplyId = _supply.SupplyId }; } InitializeComponentAndSetDialogButtons(); }