示例#1
0
        public override async Task OnAddButtonClick(CancellationToken token)
        {
            var issueDate   = AddGoodsReceivedNoteIssueDate.Tag as JavaObjectWrapper <DateTime>;
            var receiveDate = AddGoodsReceivedNoteReceiveDate.Tag as JavaObjectWrapper <DateTime>;

            Entity.DocumentId  = AddGoodsReceivedNoteDocumentId.Text;
            Entity.IssueDate   = issueDate.Data;
            Entity.ReceiveDate = receiveDate.Data;
            Entity.Invoice     = (Models.Invoice)AddGoodsReceivedNoteInvoiceId.Tag;
            Entity.InvoiceId   = Entity.Invoice.Id;
            Entity.NoteEntry   = _addGoodsReceivedNoteAdapter.Items;

            if (Entity.NoteEntry.Any(ne => ne.Location == null))
            {
                ShowToastMessage(Resource.String.GoodReceivedNoteInvalidLocations);

                return;
            }

            var result = await NoteService.AddGoodsReceivedNote(Entity, token);

            if (result.Error.Any())
            {
                RunOnUiThread(() =>
                {
                    ShowToastMessage(Resource.String.ErrorOccurred);
                });

                return;
            }

            RunOnUiThread(() =>
            {
                NavigationManager.GoToGoodsReceivedNotes();
            });
        }