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; } }