protected void OnButtonAddEnumItemClicked(object sender, EnumItemClickedEventArgs e)
        {
            if (MyOrmDialog.UoW.IsNew)
            {
                if (CommonDialogs.SaveBeforeCreateSlaveEntity(MyOrmDialog.EntityObject.GetType(), typeof(Contract)))
                {
                    MyOrmDialog.UoW.Save();
                }
                else
                {
                    return;
                }
            }
            ITdiDialog dlg = null;

            switch ((ContractType)e.ItemEnum)
            {
            case ContractType.ShortLease:
                dlg = new ContractShortLeaseDlg(CounterpartyUoW.Root);
                break;

            case ContractType.LongLease:
                dlg = new ContractLongLeaseDlg(CounterpartyUoW.Root);
                break;

            case ContractType.Maintenance:
                dlg = new ContractMaintenanceDlg(CounterpartyUoW.Root);
                break;
            }

            MyTab.TabParent.AddTab(dlg, MyTab);
        }
        protected void OnButtonEditClicked(object sender, EventArgs e)
        {
            var        selected = treeCounterpartyContracts.GetSelectedObject <ContractsVMNode>();
            ITdiDialog dlg      = null;

            switch (selected.ContractType)
            {
            case ContractType.ShortLease:
                dlg = new ContractShortLeaseDlg(selected.Id);
                break;

            case ContractType.LongLease:
                dlg = new ContractLongLeaseDlg(selected.Id);
                break;

            case ContractType.Maintenance:
                dlg = new ContractMaintenanceDlg(selected.Id);
                break;
            }

            MyTab.TabParent.AddTab(dlg, MyTab);
        }