Example #1
0
        private void SetInvoiceContract()
        {
            InvoiceDetailView view = this._detailView as InvoiceDetailView;

            Katrin.Domain.Impl.Invoice invoice = this.ObjectEntity as Katrin.Domain.Impl.Invoice;
            if (view.SelectedContracts != null)
            {
                //Type contractType = DynamicTypeBuilder.Instance.GetDynamicType("InvoiceContract");
                var invoiceContracts = invoice.InvoiceContracts;

                while (invoiceContracts.Count > 0)
                {
                    invoiceContracts.RemoveAt(0);
                }
                foreach (var selectedContract in view.SelectedContracts)
                {
                    //var contract = Activator.CreateInstance(contractType);
                    var             scontract = ConvertData.Convert <InvoiceContract>(selectedContract);
                    InvoiceContract contract  = new InvoiceContract();
                    contract.InvoiceContractId = Guid.NewGuid();
                    contract.InvoiceId         = this.ObjectId;
                    contract.ContractId        = scontract.ContractId;
                    invoiceContracts.Add(contract);
                }
            }
        }
Example #2
0
        protected override void OnViewSet()
        {
            _invoiceDetailView = this._detailView as InvoiceDetailView;
            _invoiceDetailView.OnStatusCodeChanged += OnStatusCodeChanged;
            base.OnViewSet();
            Katrin.Domain.Impl.Invoice invoice = this.ObjectEntity as Katrin.Domain.Impl.Invoice;
            System.Data.Services.Client.DataServiceCollection <InvoiceContract> inviceContracts =
                invoice.InvoiceContracts;
            var selectedContracts = new List <Guid>();

            foreach (var inviceContract in inviceContracts)
            {
                Guid contractId = inviceContract.ContractId;
                selectedContracts.Add(contractId);
            }

            _invoiceDetailView.BindContract(selectedContracts);
        }