Esempio n. 1
0
        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(CounterpartyContract)))
                {
                    parentDlg.UoW.Save();
                }
                else
                {
                    return;
                }
            }

            ITdiDialog dlg = new CounterpartyContractDlg(CounterpartyUoW.Root);

            mytab.TabParent.AddTab(dlg, mytab);
        }
Esempio n. 2
0
        protected void OnButtonEditClicked(object sender, EventArgs e)
        {
            ITdiTab mytab = DialogHelper.FindParentTab(this);

            if (mytab == null)
            {
                return;
            }

            ITdiDialog dlg = new CounterpartyContractDlg(treeCounterpartyContracts.GetSelectedId());

            mytab.TabParent.AddTab(dlg, mytab);
        }
Esempio n. 3
0
        void RunContractCreateDialog()
        {
            ITdiTab dlg;
            string  paymentTypeString = "";

            switch (UoWGeneric.Root.Payment)
            {
            case PaymentType.cash:
                paymentTypeString = "наличной";
                break;

            case PaymentType.cashless:
                paymentTypeString = "безналичной";
                break;

            case PaymentType.barter:
                paymentTypeString = "бартерной";
                break;
            }
            string question = "Отсутствует договор с клиентом для " +
                              paymentTypeString +
                              " формы оплаты. Создать?";

            if (MessageDialogWorks.RunQuestionDialog(question))
            {
                Organization organization = null;
                throw  new NotImplementedException();

                dlg = new CounterpartyContractDlg(UoWGeneric.Root.Counterparty, organization);
                (dlg as IContractSaved).ContractSaved += (sender, e) => {
                    if (UoWGeneric.Root.InitialOrder != null)
                    {
                        UoWGeneric.Root.InitialOrder.ObservableOrderDocuments.Add(new OrderContract {
                            Order           = UoWGeneric.Root.InitialOrder,
                            AttachedToOrder = UoWGeneric.Root.InitialOrder,
                            Contract        = e.Contract
                        });
                    }
                };
                TabParent.AddSlaveTab(this, dlg);
            }
        }