Esempio n. 1
0
        /// <summary>
        /// Открывает диалог выбора объекта
        /// </summary>
        public void OpenSelectDialog(string newTabTitle = null)
        {
            var modelWithParent = RepresentationModel as IRepresentationModelWithParent;

            if (modelWithParent != null && MyEntityDialogExist)
            {
                if (MyEntityDialog.UoW.IsNew && MyEntityDialog.EntityObject == modelWithParent.GetParent)
                {
                    if (DialogHelper.SaveBeforeSelectFromChildReference(modelWithParent.GetParent.GetType(), SubjectType))
                    {
                        if (!MyTdiDialog.Save())
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }

            var selectDialog = new PermissionControlledRepresentationJournal(RepresentationModel, JournalButtons);

            if (newTabTitle != null)
            {
                selectDialog.CustomTabName(newTabTitle);
            }
            selectDialog.Mode            = JournalSelectMode.Single;
            selectDialog.ObjectSelected += SelectDialog_ObjectSelected;
            MyTab.TabParent.AddSlaveTab(MyTab, selectDialog);
        }
        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();
        }
Esempio n. 4
0
        /// <summary>
        /// Открывает диалог выбора объекта
        /// </summary>
        public void OpenSelectDialog(string newTabTitle = null)
        {
            var modelWithParent = RepresentationModel as IRepresentationModelWithParent;

            if (modelWithParent != null && MyEntityDialogExist)
            {
                if (MyEntityDialog.UoW.IsNew && MyEntityDialog.EntityObject == modelWithParent.GetParent)
                {
                    if (CommonDialogs.SaveBeforeSelectFromChildReference(modelWithParent.GetParent.GetType(), SubjectType))
                    {
                        if (!MyTdiDialog.Save())
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }

            ReferenceRepresentation SelectDialog;

            SelectDialog = new ReferenceRepresentation(RepresentationModel);
            if (newTabTitle != null)
            {
                SelectDialog.TabName = newTabTitle;
            }
            SelectDialog.Mode = OrmReferenceMode.Select;
            if (!CanEditReference)
            {
                SelectDialog.ButtonMode &= ~(ReferenceButtonMode.CanAdd | ReferenceButtonMode.CanDelete);
            }
            SelectDialog.ObjectSelected += SelectDialog_ObjectSelected;
            MyTab.TabParent.AddSlaveTab(MyTab, SelectDialog);
        }