private void LoadTaxPayerDocument_Complete(LoadOperation <Web.Model.taxpayerdocument> sender)
        {
            TaxPayerDocumentList.Clear();
            taxPayerDocumentSource.Source = sender.Entities;
            foreach (DocumentManager.Web.Model.taxpayerdocument taxpayerdocument in sender.Entities)
            {
                TaxPayerDocumentEntity taxPayerDocumentEntity = new TaxPayerDocumentEntity();
                taxPayerDocumentEntity.TaxPayerDocument = taxpayerdocument;
                taxPayerDocumentEntity.Update();

                taxPayerDocumentEntity.TaxPayerName = taxPayerEntity.TaxPayerName;
                FileTypeEntity lFileTypeEntity;
                if (FileTypeEntityDictionary != null &&
                    taxPayerDocumentEntity.TaxPayerDocumentTypeId.HasValue &&
                    FileTypeEntityDictionary.TryGetValue(taxPayerDocumentEntity.TaxPayerDocumentTypeId.Value, out lFileTypeEntity))
                {
                    taxPayerDocumentEntity.FileTypeName = lFileTypeEntity.FileTypeName;
                }

                UserEntity lUserEntity;
                if (UserEntityDictionary != null &&
                    taxPayerDocumentEntity.TaxPayerUpdateUserId.HasValue &&
                    UserEntityDictionary.TryGetValue(taxPayerDocumentEntity.TaxPayerUpdateUserId.Value, out lUserEntity))
                {
                    taxPayerDocumentEntity.UpdateUserName = lUserEntity.UserName;
                }

                TaxPayerDocumentList.Add(taxPayerDocumentEntity);
            }
            UpdateChanged("TaxPayerDocumentList");
            FinishLoadings(null, null);
        }
        private void LoadOperationTaxPayerDocumentCompleted(LoadOperation <DocumentManager.Web.Model.taxpayerdocument> aLoadOperation)
        {
            TaxPayerDocumentEntityList.Clear();
            foreach (DocumentManager.Web.Model.taxpayerdocument taxpayerdocument in aLoadOperation.Entities)
            {
                TaxPayerDocumentEntity taxPayerDocumentEntity = new TaxPayerDocumentEntity();
                taxPayerDocumentEntity.TaxPayerDocument = taxpayerdocument;
                taxPayerDocumentEntity.Update();

                FileTypeEntity lFileTypeEntity;
                if (FileTypeEntityDictionary != null &&
                    taxPayerDocumentEntity.TaxPayerDocumentTypeId.HasValue &&
                    FileTypeEntityDictionary.TryGetValue(taxPayerDocumentEntity.TaxPayerDocumentTypeId.Value, out lFileTypeEntity))
                {
                    taxPayerDocumentEntity.FileTypeName = lFileTypeEntity.FileTypeName;
                }

                TaxPayerDocumentEntityList.Add(taxPayerDocumentEntity);
            }
            UpdateChanged("TaxPayerDocumentEntityList");
            IsBusy = false;
        }
        private void LoadTaxPayerDocument_Complete(LoadOperation <Web.Model.taxpayerdocument> sender)
        {
            taxPayerDocumentSource.Source = sender.Entities;
            foreach (DocumentManager.Web.Model.taxpayerdocument taxpayerdocument in sender.Entities)
            {
                TaxPayerDocumentEntity taxPayerDocumentEntity = new TaxPayerDocumentEntity();
                taxPayerDocumentEntity.TaxPayerDocument = taxpayerdocument;
                taxPayerDocumentEntity.Update();

                if (taxPayerDocumentEntity.TaxPayerDocumentTypeId == 2) // 拨款报告
                {
                    continue;
                }

                if (taxPayerDocumentEntity.TaxPayerDocumentTypeId == 7) // 税票及发票
                {
                    continue;
                }

                if (taxPayerDocumentEntity.TaxPayerDocumentTypeId == 5) // 合同
                {
                    continue;
                }

                if (taxPayerDocumentEntity.TaxPayerDocumentTypeId == 6) // 代开申请
                {
                    continue;
                }

                if (taxPayerDocumentEntity.TaxPayerDocumentTypeId == 3) // 申报表
                {
                    continue;
                }

                App lApp = Application.Current as App;

                TaxPayerDocumentEntity lTaxPayerDocumentEntity = new TaxPayerDocumentEntity();
                lTaxPayerDocumentEntity.TaxPayerDocument = new Web.Model.taxpayerdocument();

                lTaxPayerDocumentEntity.TaxPayerId               = addTaxPayerEntity.TaxPayerId;
                lTaxPayerDocumentEntity.TaxPayerDocumentName     = taxPayerDocumentEntity.TaxPayerDocumentName;
                lTaxPayerDocumentEntity.TaxPayerDocumentTypeId   = taxPayerDocumentEntity.TaxPayerDocumentTypeId;
                lTaxPayerDocumentEntity.TaxPayerDocumentDescript = taxPayerDocumentEntity.TaxPayerDocumentDescript;
                lTaxPayerDocumentEntity.TaxPayerUpdateUserId     = lApp.MainPageViewModel.User.UserID;
                lTaxPayerDocumentEntity.TaxPayerUpdateTime       = taxPayerDocumentEntity.TaxPayerUpdateTime;
                lTaxPayerDocumentEntity.TaxPayerDocumentBytes    = taxPayerDocumentEntity.TaxPayerDocumentBytes;
                lTaxPayerDocumentEntity.TaxPayerIsLink           = true;
                if (taxPayerDocumentEntity.TaxPayerIsLink.HasValue && taxPayerDocumentEntity.TaxPayerIsLink.Value)
                {
                    lTaxPayerDocumentEntity.TaxPayerLinkId = taxPayerDocumentEntity.TaxPayerLinkId;
                }
                else
                {
                    lTaxPayerDocumentEntity.TaxPayerLinkId = SelectTaxPayerEntity.TaxPayerId;
                }

                lTaxPayerDocumentEntity.TaxPayerDocument = new Web.Model.taxpayerdocument();
                lTaxPayerDocumentEntity.DUpdate();
                documentManagerContext.taxpayerdocuments.Add(lTaxPayerDocumentEntity.TaxPayerDocument);
            }
            SubmitOperation lSubmitOperation = documentManagerContext.SubmitChanges();

            lSubmitOperation.Completed += SubOperation_Completed;
        }