Esempio n. 1
0
        private void UserFile_FinishUpdates(object sender, EventArgs e)
        {
            ShowProgress = Visibility.Collapsed;
            taxPayerDocumentEntity.TaxPayerDocumentName     = UserFile.FileName;
            taxPayerDocumentEntity.TaxPayerDocumentTypeId   = SelectFileTypeEntity.FileTypeId;
            taxPayerDocumentEntity.TaxPayerId               = currentTaxPayerEntity.TaxPayerId;
            taxPayerDocumentEntity.TaxPayerDocumentDescript = "";
            taxPayerDocumentEntity.TaxPayerUpdateTime       = DateTime.Now;
            App app = Application.Current as App;

            taxPayerDocumentEntity.TaxPayerUpdateUserId = app.MainPageViewModel.User.UserID;
            taxPayerDocumentEntity.TaxPayerDocument     = new Web.Model.taxpayerdocument();
            taxPayerDocumentEntity.DUpdate();

            documentManagerContext.taxpayerdocuments.Add(taxPayerDocumentEntity.TaxPayerDocument);
            Log.AddLog(documentManagerContext, taxPayerDocumentEntity.ToString());

            StandBookEntity.GroupID = 1;

            StandBookEntity.StandBook = new Web.Model.standbook();
            StandBookEntity.DUpdate();
            documentManagerContext.standbooks.Add(StandBookEntity.StandBook);
            Log.AddLog(documentManagerContext, StandBookEntity.ToString());

            SubmitOperation lSubmitOperation = documentManagerContext.SubmitChanges();

            lSubmitOperation.Completed += SubOperation_Completed;
        }
        private void linkFileWindow_Closed(object sender, EventArgs e)
        {
            LinkFileWindow linkFileWindow = sender as LinkFileWindow;

            if (linkFileWindow.DialogResult == true)
            {
                LinkFileViewModel lLinkFileViewModel = linkFileWindow.DataContext as LinkFileViewModel;
                int rTaxPayerId = lLinkFileViewModel.SelectTaxPayerEntity.TaxPayerId;
                foreach (TaxPayerEntity taxPayerEntity in lLinkFileViewModel.TaxPayerEntityLinkList)
                {
                    if (rTaxPayerId == taxPayerEntity.TaxPayerId)
                    {
                        continue;
                    }

                    foreach (TaxPayerDocumentEntity taxPayerDocumentEntity in linkFileWindow.FileListDataGrid.SelectedItems)
                    {
                        TaxPayerDocumentEntity lTaxPayerDocumentEntity = new TaxPayerDocumentEntity();

                        App lApp = Application.Current as App;

                        lTaxPayerDocumentEntity.TaxPayerId               = taxPayerEntity.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;
                        lTaxPayerDocumentEntity.TaxPayerLinkId           = rTaxPayerId;
                        lTaxPayerDocumentEntity.TaxPayerDocument         = new Web.Model.taxpayerdocument();
                        lTaxPayerDocumentEntity.DUpdate();
                        documentManagerContext.taxpayerdocuments.Add(lTaxPayerDocumentEntity.TaxPayerDocument);
                        Log.AddLog(documentManagerContext, lTaxPayerDocumentEntity.ToString());
                    }
                }

                SubmitOperation lSubmitOperation = documentManagerContext.SubmitChanges();
                lSubmitOperation.Completed += SubOperation_Completed;
            }
        }
        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;
        }