Esempio n. 1
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            ITdiTab mytab = DialogHelper.FindParentTab(this);

            if (mytab == null)
            {
                return;
            }

            var parentDlg = DialogHelper.FindParentEntityDialog(this);

            if (parentDlg == null)
            {
                return;
            }

            if (parentDlg.UoW.IsNew)
            {
                if (CommonDialogs.SaveBeforeCreateSlaveEntity(parentDlg.EntityObject.GetType(), typeof(Proxy)))
                {
                    parentDlg.UoW.Save();
                }
                else
                {
                    return;
                }
            }

            ITdiDialog dlg = new ProxyDlg(CounterpartyUoW.Root);

            mytab.TabParent.AddTab(dlg, mytab);
        }
        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);
        }
        void OnButtonAddClicked(object sender, EventArgs e)
        {
            if (MyOrmDialog.UoW.IsNew)
            {
                if (CommonDialogs.SaveBeforeCreateSlaveEntity(MyOrmDialog.EntityObject.GetType(), typeof(DeliveryPoint)))
                {
                    if (!MyTdiDialog.Save())
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            ITdiDialog dlg = new DeliveryPointDlg(DeliveryPointUoW.Root);

            MyTab.TabParent.AddSlaveTab(MyTab, dlg);
        }
        private void OnButtonAddClicked(object sender, EventArgs e)
        {
            if (MyOrmDialog.UoW.IsNew)
            {
                if (CommonDialogs.SaveBeforeCreateSlaveEntity(MyEntityDialog.EntityObject.GetType(), typeof(DeliveryPoint)))
                {
                    if (!MyTdiDialog.Save())
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            var dpViewModel = _deliveryPointViewModelFactory.GetForCreationDeliveryPointViewModel(_counterparty);

            MyTab.TabParent.AddSlaveTab(MyTab, dpViewModel);
            dpViewModel.EntitySaved += (o, args) => UpdateNodes();
        }