private LoadOperation<ProductManager.Web.Model.project> LoadProjectEntities() { if (!isFilter) { this.IsBusy = true; EntityQuery<ProductManager.Web.Model.project> lQuery = this.ProductDomainContext.GetProjectQuery(); return this.ProductDomainContext.Load(lQuery.SortAndPageBy(this.projectView)); } else { this.IsBusy = true; EntityQuery<ProductManager.Web.Model.project> lQuery = this.ProductDomainContext.GetProjectQuery(); if (selectFilerList == "生产令号") { if (!String.IsNullOrEmpty(filterContent)) { lQuery = lQuery.Where(e => e.manufacture_number.Contains(filterContent)); } } if (selectFilerList == "项目名称") { if (!String.IsNullOrEmpty(filterContent)) { lQuery = lQuery.Where(e => e.project_name.Contains(filterContent)); } } if (selectFilerList == "备注") { if (!String.IsNullOrEmpty(filterContent)) { lQuery = lQuery.Where(e => e.remark.Contains(filterContent)); } } if (selectFilerList == "年份") { if (!String.IsNullOrEmpty(filterContent)) { try { int year = Convert.ToInt32(filterContent); lQuery = lQuery.Where(e => e.year_number == year); } catch (System.Exception ex) { NotifyWindow notifyWindow = new NotifyWindow("错误", "输入年份不合法"); notifyWindow.Show(); } } } if (selectFilerList == "记录时间") { if (!String.IsNullOrEmpty(filterContent)) { try { DateTime remarkDate = Convert.ToDateTime(filterContent); lQuery = lQuery.Where(e => e.record_date.Value.Year == remarkDate.Year && e.record_date.Value.Month == remarkDate.Month && e.record_date.Value.Day == remarkDate.Day); } catch (System.Exception ex) { NotifyWindow notifyWindow = new NotifyWindow("错误", "记录时间不合法 (YYYY-MM-DD)"); notifyWindow.Show(); } } } return this.ProductDomainContext.Load(lQuery.SortAndPageBy(this.projectView)); } }
private void OnImportCommand() { OpenFileDialog lOpenFile = new OpenFileDialog(); lOpenFile.Filter = "Excel (*.xls)|*.xls"; Dictionary<String, int> lHeaderDictionary = new Dictionary<String, int>(); if (lOpenFile.ShowDialog() == true) { ImportantPartRejesterEntityList.Clear(); try { FileStream fs = lOpenFile.File.OpenRead(); Workbook book = Workbook.Open(fs); foreach (KeyValuePair<int, Row> rowPair in book.Worksheets[0].Cells.Rows) { if (rowPair.Key == 0) { try { foreach (KeyValuePair<int, Cell> cellPair in rowPair.Value) { lHeaderDictionary.Add(cellPair.Value.StringValue, cellPair.Key); } } catch (System.Exception ex) { Message.ErrorMessage("表头重复或超出范围!"); break; } continue; } ImportantPartRejesterEntity lImportantPartRejesterEntity = new ImportantPartRejesterEntity(); lImportantPartRejesterEntity.ImportantPartRejester = new ProductManager.Web.Model.important_part_rejester(); lImportantPartRejesterEntity.ManufactureNumber = ProjectEntity.ManufactureNumber; int lManufactureNumberColumn = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("生产令号", out lManufactureNumberColumn) && -1 != lManufactureNumberColumn && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lManufactureNumberColumn))) { lImportantPartRejesterEntity.ManufactureNumber = cell.StringValue; ProjectEntity projectEntityTemp; if (!ProjectEntityDictionary.TryGetValue(lImportantPartRejesterEntity.ManufactureNumber, out projectEntityTemp)) { NotifyWindow lNotifyWindow = new NotifyWindow("错误", "第 " + rowPair.Key.ToString() + "行 系统中没有生产令号:" + lImportantPartRejesterEntity.ManufactureNumber); lNotifyWindow.Show(); return; } } else { NotifyWindow lNotifyWindow = new NotifyWindow("错误", "第 " + rowPair.Key.ToString() + "行 系统中没有生产令号:" + lImportantPartRejesterEntity.ManufactureNumber); lNotifyWindow.Show(); return; } } int lImportPartNameColumn = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("主要部件名称", out lImportPartNameColumn) && -1 != lManufactureNumberColumn && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lImportPartNameColumn))) { lImportantPartRejesterEntity.ImportantPartName = cell.StringValue; } } int lProjectNameColumn = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("厂家", out lProjectNameColumn) && -1 != lProjectNameColumn && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lProjectNameColumn))) { lImportantPartRejesterEntity.ImportantPartManufacturers = cell.StringValue; } } int lImportantPartType = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("型号", out lImportantPartType) && -1 != lImportantPartType && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lImportantPartType))) { lImportantPartRejesterEntity.ImportantPartType = cell.StringValue; } } int lModelNumberColumn = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("出厂时间", out lModelNumberColumn) && -1 != lModelNumberColumn && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lModelNumberColumn))) { lImportantPartRejesterEntity.OutputTime = cell.DateTimeValue; } } //出厂编号 int lRemarkColumn = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("出厂编号", out lRemarkColumn) && -1 != lRemarkColumn && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lRemarkColumn))) { lImportantPartRejesterEntity.OutputNumber = cell.StringValue; } } //序列号 int lImportantPartManu = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("序列号", out lImportantPartManu) && -1 != lImportantPartManu && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lImportantPartManu))) { lImportantPartRejesterEntity.ImportantPartManu = cell.StringValue; } } //备注 int lNote = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("备注", out lNote) && -1 != lNote && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lNote))) { lImportantPartRejesterEntity.Note = cell.StringValue; } } App app = Application.Current as App; lImportantPartRejesterEntity.InputUserID = app.UserInfo.UserID; lImportantPartRejesterEntity.InputDateTime = DateTime.Now; lImportantPartRejesterEntity.UserEntityDictionary = DictionaryUser; lImportantPartRejesterEntity.DUpdate(); ImportantPartRejesterEntityList.Add(lImportantPartRejesterEntity); //ProductContext.projects.Add(lProjectEntity.Project); } } catch (System.Exception ex) { Message.ErrorMessage(ex.Message); } } }
void subOperation_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; if (submitOperation.HasError) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "保存失败"); notifyWindow.Show(); } else { NotifyWindow notifyWindow = new NotifyWindow("保存成功", "保存成功!"); notifyWindow.Show(); } (OnSave as DelegateCommand).RaiseCanExecuteChanged(); IsBusy = false; }
private void OnUpdateFileCommand() { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == true) { String fileName = ofd.File.Name; foreach (PlanOutlineFileEntity entity in planOutLineFileList) { if (entity.fileName == fileName) { NotifyWindow notificationWindow = new NotifyWindow("错误", "已上传相同的文件!"); notificationWindow.Show(); return; } } App app = Application.Current as App; newEntity = new PlanOutlineFileEntity(); newEntity.UserID = app.UserInfo.UserID; newEntity.UserName = app.UserInfo.UserName; newEntity.FileName = fileName; UserFile = new FileUploader.UserFile(); UserFile.FileName = fileName; UserFile.FolderName = "PlanOutline"; UserFile.FileStream = ofd.File.OpenRead(); newEntity.FileBytes = UserFile.FileStream.Length; IsBusy = true; UserFile.FinishUpdate += UserFile_FinishUpdate; UserFile.Upload("", dependencyObject.Dispatcher); } }
void submitQuestionOperation_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; if (submitOperation.HasError) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "保存失败"); notifyWindow.Show(); } else { NotifyWindow notifyWindow = new NotifyWindow("保存成功", "保存成功!"); notifyWindow.Show(); } (OnViewQuestion as DelegateCommand).RaiseCanExecuteChanged(); (OnAnswerQuestion as DelegateCommand).RaiseCanExecuteChanged(); (OnViewTraceQuestion as DelegateCommand).RaiseCanExecuteChanged(); (OnCloseTraceQuestion as DelegateCommand).RaiseCanExecuteChanged(); using (questionTraceView.DeferRefresh()) { questionTraceView.MoveToFirstPage(); } using (questionTraceTraceView.DeferRefresh()) { questionTraceTraceView.MoveToFirstPage(); } IsBusy = false; }
void OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error == null) { using (Stream sf = (Stream)saveFileDialog.OpenFile()) { e.Result.CopyTo(sf); sf.Flush(); sf.Close(); NotifyWindow notifyWindow = new NotifyWindow("下载完成", "下载完成!"); notifyWindow.Show(); } } else { NotifyWindow notifyWindow = new NotifyWindow("下载错误", e.Error.Message); notifyWindow.Show(); } }
public void CheckUserPassword() { App app = Application.Current as App; if (app.UserInfo.UserPassword == Cryptography.MD5.GetMd5String("123456")) { NotifyWindow notifyWindow = new NotifyWindow("修改密码", "用户密码与初始密码一致,请修改密码!"); notifyWindow.Show(); } }
private void UserFile_FinishUpdate(object sender, EventArgs e) { ProjectFilesEntity.FileUpdateTime = DateTime.Now; if (SelectFileTypeEntity != null) { ProjectFilesEntity.FileTypeName = SelectFileTypeEntity.FileTypeName; } else { foreach(FileTypeEntity fileTypeEntity in FileTypeEntityList) { if (ProjectFilesEntity.FileTypeID == fileTypeEntity.FileTypeID) { ProjectFilesEntity.FileTypeName = fileTypeEntity.FileTypeName; } } } NotifyWindow notificationWindow = new NotifyWindow("上传文件", "上传文件完成!"); notificationWindow.Show(); IsBusy = false; this.childWindow.DialogResult = true; }
void submitOperation_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; if (submitOperation.HasError) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "删除失败"); notifyWindow.Show(); } else { NotifyWindow notifyWindow = new NotifyWindow("删除成功", "删除成功!"); notifyWindow.Show(); LoadData(); } }
private void LoginOperation_Completed(LoginOperation loginOperation) { IsBusy = false; if (loginOperation.LoginSuccess) { ProductManager.Web.User lUser = loginOperation.User.Identity as ProductManager.Web.User; if (lUser.IsFreeze) { NotifyWindow notifyWindow = new NotifyWindow("用户已冻结", "用户已冻结!"); notifyWindow.Show(); return; } App app = Application.Current as App; app.UserInfo = new UserInfo(); app.UserInfo.UserName = lUser.UserName; app.UserInfo.UserAction = lUser.RightDictionary; app.UserInfo.UserDepartment = lUser.Department; app.UserInfo.UserID = lUser.UserID; app.UserInfo.DepartmentID = lUser.DepartmentID; app.UserInfo.UserPassword = lUser.Password; app.UserInfo.IsManager = lUser.IsManager; if (app.UserInfo.UserPassword == Cryptography.MD5.GetMd5String("123456")) { ModifyPasswrodWindow modifyPasswordWindow = new ModifyPasswrodWindow(); modifyPasswordWindow.Closed += modifyWindowClosed; modifyPasswordWindow.Show(); } else { app.LogonUser(app.UserInfo.UserID, app.UserInfo.UserName); FinishLogon(null); } } else { NotifyWindow notifyWindow = new NotifyWindow("用户名或密码错误", "用户名或密码错误"); notifyWindow.Show(); } }
private void OnOpenFileCommand() { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == true) { String fileName = ofd.File.Name; if(fileName.Contains("\"") || fileName.Contains("#") || fileName.Contains("%") || fileName.Contains("&") || fileName.Contains("\'") || fileName.Contains("~") || fileName.Contains("|") || fileName.Contains(">") || fileName.Contains("<") || fileName.Contains("[") || fileName.Contains("]") || fileName.Contains("^") || fileName.Contains("{") || fileName.Contains("}")) { NotifyWindow notificationWindow = new NotifyWindow("错误", "文件名包含 \"#%&\'~|><[]^{} 等非法字符!"); notificationWindow.Show(); return; } foreach (ProjectFilesEntity projectFilesEntity in ProjectFilesEntityList) { if (projectFilesEntity.fileName == fileName && !projectFilesEntity.FileDelete) { NotifyWindow notificationWindow = new NotifyWindow("错误", "已上传相同的文件!"); notificationWindow.Show(); return; } } ProjectFilesEntity.FileName = fileName; UserFile = new FileUploader.UserFile(); UserFile.FileName = fileName; UserFile.FolderName = ProjectFilesEntity.ManufactureNumber; UserFile.FileStream = ofd.File.OpenRead(); ProjectFilesEntity.FileBytes = UserFile.FileStream.Length; (OnUpdate as DelegateCommand).RaiseCanExecuteChanged(); } }
void OnFinalDeleteImportantPartCommand_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; if (submitOperation.HasError) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "失败"); notifyWindow.Show(); } else { NotifyWindow notifyWindow = new NotifyWindow("成功", "成功!"); notifyWindow.Show(); using (importantPartView.DeferRefresh()) { importantPartView.MoveToFirstPage(); } //LoadData(); } }
void deleteProductOption_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; if (submitOperation.HasError) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "失败"); notifyWindow.Show(); } else { NotifyWindow notifyWindow = new NotifyWindow("成功", "成功!"); notifyWindow.Show(); //LoadData(); using (this.productView.DeferRefresh()) { this.productView.MoveToFirstPage(); } } }
void submitOperation_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; if (submitOperation.HasError) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "保存失败"); notifyWindow.Show(); } else { NotifyWindow notifyWindow = new NotifyWindow("保存成功", "保存成功!"); notifyWindow.Show(); } BusyIndicator.IsBusy = false; }
private void OnDownloadTempCommand() { String FileUrl = CustomUri.GetAbsoluteUrl("ProductmanagerFileTemp/产品导入模版.xls"); try { saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "All Files|*.*"; saveFileDialog.GetType().GetMethod("set_DefaultFileName").Invoke(saveFileDialog, new object[] { "产品导入模版.xls" }); bool? dialogResult = saveFileDialog.ShowDialog(); if (dialogResult != true) return; WebClient client = new WebClient(); Uri uri = new Uri(FileUrl, UriKind.RelativeOrAbsolute); client.OpenReadCompleted += new OpenReadCompletedEventHandler(OpenReadCompleted); client.OpenReadAsync(uri); } catch (System.Exception ex) { NotifyWindow notifyWindow = new NotifyWindow("下载错误", ex.Message); notifyWindow.Show(); } }
private void UserFile_FinishUpdate(object sender, EventArgs e) { newEntity.FileUploadTime = DateTime.Now; NotifyWindow notificationWindow = new NotifyWindow("上传文件", "上传文件完成!"); notificationWindow.Show(); newEntity.DUpdate(); planManagerDomainContext.plan_outline_files.Add(newEntity.PlanFiles); SubmitOperation submitOperation = planManagerDomainContext.SubmitChanges(); submitOperation.Completed += SubmitOperation_Completed; }
private void OnImportCommand() { OpenFileDialog lOpenFile = new OpenFileDialog(); lOpenFile.Filter = "Excel (*.xls)|*.xls"; Dictionary<String, int> lHeaderDictionary = new Dictionary<String, int>(); if (lOpenFile.ShowDialog() == true) { ProductEntityList.Clear(); try { FileStream fs = lOpenFile.File.OpenRead(); Workbook book = Workbook.Open(fs); foreach (KeyValuePair<int, Row> rowPair in book.Worksheets[0].Cells.Rows) { if (rowPair.Key == 0) { try { foreach (KeyValuePair<int, Cell> cellPair in rowPair.Value) { lHeaderDictionary.Add(cellPair.Value.StringValue, cellPair.Key); } } catch (System.Exception ex) { Message.ErrorMessage("表头重复或超出范围!"); break; } continue; } ProductEntity lProductEntity = new ProductEntity(); lProductEntity.Product = new ProductManager.Web.Model.product(); lProductEntity.ProductEntityDictionary = ProductEntityDictionary; lProductEntity.ProjectEntityDictionary = ProjectEntityDictionary; //lProductEntity.ProductPartTypeEntityDictionary = ProductTypeEntityDictionary; int lManufactureNumberColumn = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("生产令号", out lManufactureNumberColumn) && -1 != lManufactureNumberColumn && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lManufactureNumberColumn))) { lProductEntity.ManufactureNumber = cell.StringValue; ProjectEntity projectEntityTemp; if (!ProjectEntityDictionary.TryGetValue(lProductEntity.ManufactureNumber, out projectEntityTemp)) { NotifyWindow lNotifyWindow = new NotifyWindow("错误","第 " + rowPair.Key.ToString() + "行 系统中没有生产令号:" + lProductEntity.ManufactureNumber); lNotifyWindow.Show(); return; } } else { NotifyWindow lNotifyWindow = new NotifyWindow("错误", "第 " + rowPair.Key.ToString() + "行 系统中没有生产令号:" + lProductEntity.ManufactureNumber); lNotifyWindow.Show(); return; } } int lProjectNameColumn = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("序列号", out lProjectNameColumn) && -1 != lProjectNameColumn && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lProjectNameColumn))) { lProductEntity.ProductID = cell.StringValue; ProductEntity lProductEntityTemp; if (ProductEntityDictionary.TryGetValue(lProductEntity.ProductID, out lProductEntityTemp)) { NotifyWindow lNotifyWindow = new NotifyWindow("错误","第 " + rowPair.Key.ToString() + "行 序列号重复:" + lProductEntity.ProductID); lNotifyWindow.Show(); return; } if (CurrentProductEntityDicationary.TryGetValue(lProductEntity.ProductID, out lProductEntityTemp)) { NotifyWindow lNotifyWindow = new NotifyWindow("错误", "第 " + rowPair.Key.ToString() + "行 序列号重复:" + lProductEntity.ProductID); lNotifyWindow.Show(); return; } } } int lModelNumberColumn = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("产品类型", out lModelNumberColumn) && -1 != lModelNumberColumn && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lModelNumberColumn))) { lProductEntity.ProductTypeString = cell.StringValue; int lId; if (ProductTypeIDDictionary.TryGetValue(lProductEntity.ProductTypeString, out lId)) { lProductEntity.ProductTypeID = lId; } else { NotifyWindow lNotifyWindow = new NotifyWindow("错误", "第 " + rowPair.Key.ToString() + "行 系统中无该产品类型:" + lProductEntity.ProductTypeString); lNotifyWindow.Show(); return; } } } int lRemarkColumn = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("名称", out lRemarkColumn) && -1 != lRemarkColumn && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lRemarkColumn))) { lProductEntity.ProductName = cell.StringValue; } } int lInputTimeColume = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("编制日期", out lInputTimeColume) && -1 != lInputTimeColume && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lInputTimeColume))) { lProductEntity.ProductIDCreateData = cell.DateTimeValue; } } int lOutputNumberColume = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("出厂编号", out lOutputNumberColume) && -1 != lOutputNumberColume && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lOutputNumberColume))) { lProductEntity.ProductOutputNumber = cell.StringValue; } } int lNote1 = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("备注1", out lNote1) && -1 != lNote1 && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lNote1))) { lProductEntity.ProductDescript1 = cell.StringValue; } } int lNote2 = -1; { Cell cell = Cell.EmptyCell; if (lHeaderDictionary.TryGetValue("备注1", out lNote2) && -1 != lNote2 && Cell.EmptyCell != (cell = rowPair.Value.GetCell(lNote2))) { lProductEntity.ProductDescript2 = cell.StringValue; } } lProductEntity.DUpdate(); ProductEntityList.Add(lProductEntity); CurrentProductEntityDicationary.Add(lProductEntity.ProductID, lProductEntity); //ProductContext.projects.Add(lProjectEntity.Project); } } catch (System.Exception ex) { Message.ErrorMessage(ex.Message); } } }
void DeleteSubmitOperation_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; if (!submitOperation.HasError) { NotifyWindow notifyWindow = new NotifyWindow("删除", "删除成功"); notifyWindow.Show(); using (planOutlineFilesView.DeferRefresh()) { planOutlineFilesView.MoveToFirstPage(); } } else { NotifyWindow notifyWindow = new NotifyWindow("删除", "删除失败:" + submitOperation.Error.Message); notifyWindow.Show(); } }
void OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error == null) { using (Stream sf = (Stream)saveFileDialog.OpenFile()) { e.Result.CopyTo(sf); sf.Flush(); sf.Close(); DownLoading = Visibility.Collapsed; NotifyWindow notifyWindow = new NotifyWindow("下载完成", "下载完成!"); notifyWindow.Show(); } } }
void submitOperation_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; ProductManagersViewModel.IsBusy = false; if (submitOperation.HasError) { if (!isUserProject) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "取消自选失败!"); notifyWindow.Show(); } else { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "添加自选失败!"); notifyWindow.Show(); } } else { if (!isUserProject) { NotifyWindow notifyWindow = new NotifyWindow("成功", "取消自选成功!"); notifyWindow.Show(); //isUserProject = false; UserProjectEntityDictionary.Remove(manufactureNumber); } else { NotifyWindow notifyWindow = new NotifyWindow("成功", "添加自选成功!"); notifyWindow.Show(); //isUserProject = true; UserProjectEntityDictionary.Add(manufactureNumber, UserProjectEntity); } } }