public InputStandBookZPViewModel(ChildWindow aChildWindow)
        {
            IsBusy = false;
            TaxPayerEntityDirectory = new Dictionary<int, TaxPayerEntity>();
            StandBookEntityDirectory = new Dictionary<string, StandBookEntity>();
            FileTypeEntityList = new ObservableCollection<FileTypeEntity>();

            childWindow = aChildWindow;

            OnOpenStandBookFile = new DelegateCommand(onOpenStandBookFile);
            OnOK = new DelegateCommand(onOK, canOK);
            OnCancel = new DelegateCommand(onCancel);

            StandBookEntity = new StandBookEntity();
            HasShowTemp = Visibility.Collapsed;
            ShowProgress = Visibility.Collapsed;
            ShowUpdate = Visibility.Visible;

            documentManagerContext = new Web.DocumentManagerDomainContext();
            CanInput = false;
            LoadData();
        }
        private void loadOperation_Completed(LoadOperation<DocumentManager.Web.Model.standbook> sender)
        {
            StandBookList.Clear();
            standBookSource.Source = sender.Entities;
            foreach (DocumentManager.Web.Model.standbook standBook in sender.Entities)
            {
                StandBookEntity standBookEntity = new StandBookEntity();
                standBookEntity.StandBook = standBook;
                standBookEntity.Update();
                /*
                string lProjectName = taxPayerEntity.TaxPayerProject;

                decimal lTotalMoney;
                if (ProjectTotalMonay.TryGetValue(lProjectName, out lTotalMoney))
                {
                    taxPayerEntity.TotalMoney = lTotalMoney;
                }

                decimal lPartMoney;
                if (ProjectPartMoney.TryGetValue(lProjectName, out lPartMoney))
                {
                    taxPayerEntity.PartMoney = lPartMoney;
                }
                */
                StandBookList.Add(standBookEntity);
            }
            UpdateChanged("StandBookList");
            IsBusy = false;
        }
        private void loadOperationStandBook_Completed(object sender, EventArgs e)
        {
            ProjectTotalMonay.Clear();
            ProjectPartMoney.Clear();

            LoadOperation loadOperation = sender as LoadOperation;
            foreach (Web.Model.standbook standbook in loadOperation.Entities)
            {
                StandBookEntity lStandBookEntity = new StandBookEntity();
                lStandBookEntity.StandBook = standbook;
                lStandBookEntity.Update();

                string lProjectName = lStandBookEntity.ProjectName;

                decimal lTotalMoney;
                if (!ProjectTotalMonay.TryGetValue(lProjectName, out lTotalMoney))
                {
                    ProjectTotalMonay.Add(lProjectName, lStandBookEntity.TotalMoney.GetValueOrDefault(0));
                }

                decimal lPartMoney;
                if (ProjectPartMoney.TryGetValue(lProjectName, out lPartMoney))
                {
                    ProjectPartMoney[lProjectName] += lStandBookEntity.ThisPartMoney.GetValueOrDefault(0);
                }
                else
                {
                    ProjectPartMoney.Add(lProjectName, lStandBookEntity.ThisPartMoney.GetValueOrDefault(0));
                }

                //TaxPayerTypeEntityDictionary.Add(lTaxPayerTypeEntity.TaxPayerTypeId, lTaxPayerTypeEntity);
            }

            standBookSource = new EntityList<Web.Model.standbook>(documentManagerContext.standbooks);
            standBookLoader = new DomainCollectionViewLoader<Web.Model.standbook>(
                LoadStandBookEntities,
                loadOperation_Completed);
            standBookView = new DomainCollectionView<Web.Model.standbook>(standBookLoader, standBookSource);

            using (this.standBookView.DeferRefresh())
            {
                this.standBookView.MoveToFirstPage();
            }
        }
        private void loadOperationStandBook_Completed(object sender, EventArgs e)
        {
            StandBookEntityDirectory.Clear();

            LoadOperation loadOperation = sender as LoadOperation;
            foreach (Web.Model.standbook standbook in loadOperation.Entities)
            {
                StandBookEntity lStandBookEntity = new StandBookEntity();
                lStandBookEntity.StandBook = standbook;
                lStandBookEntity.Update();
                StandBookEntityDirectory.Add(lStandBookEntity.StandBookID, lStandBookEntity);
            }

            IsBusy = false;
        }
        private void LoadStandBook_Complete(LoadOperation<Web.Model.standbook> sender)
        {
            StandBookEntityList.Clear();
            standbookSource.Source = sender.Entities;
            foreach (DocumentManager.Web.Model.standbook standbook in sender.Entities)
            {
                StandBookEntity standBookEntity = new StandBookEntity();
                standBookEntity.StandBook = standbook;
                standBookEntity.Update();
                StandBookEntityList.Add(standBookEntity);
            }

            if(StandBookEntityList.Count > 0)
            {
                FirstStandBookEntity = StandBookEntityList[0];
            }
            else
            {
                FirstStandBookEntity = null;
            }
            UpdateChanged("FirstStandBookEntity");
            UpdateChanged("StandBookEntityList");
            FinishLoadings(null, null);
        }