public void OnLoadAsyncCallback(Exception ex) { if (ex != null) { //An error has occurred Busy.IsBusy = false; System.Diagnostics.Debug.WriteLine(ex.StackTrace); NotifyWindow lNotifyWIndow = new NotifyWindow("无法预览文件", "等待后台处理,请联系管理员!"); lNotifyWIndow.Show(); //Busy.IsBusy = false; //this.DialogResult = false; } MyDocumentViewer.SetFitMode(DocumentViewer.FitModes.Panel, DocumentViewer.FitModes.None); Busy.IsBusy = false; }
void ModifyPassword_Completed(object sender, EventArgs e) { IsBusy = false; var lValue = (System.ServiceModel.DomainServices.Client.InvokeOperation<bool>)sender; if (lValue.Value) { App app = Application.Current as App; app.MainPageViewModel.User.Password = Cryptography.MD5.GetMd5String(ModifyPasswordEntity.NewPassword); ChildWindow.DialogResult = true; NotifyWindow notifyWindow = new NotifyWindow("修改成功", "密码修改成功"); notifyWindow.Show(); } else { NotifyWindow notifyWindow = new NotifyWindow("修改失败", "密码修改失败"); notifyWindow.Show(); } }
private void MultiFileDrop(object sender, DragEventArgs e) { if (e.Data != null) { AddMultiDocumentViewModel lAddMultiDocumentViewModel = this.DataContext as AddMultiDocumentViewModel; if (!lAddMultiDocumentViewModel.canUpdateFile()) { NotifyWindow notificationWindow = new NotifyWindow("错误", "请选择文件类型!"); notificationWindow.Show(); return; } var files = e.Data.GetData(DataFormats.FileDrop) as FileInfo[]; foreach (var file in files) { string fileName = 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(); continue; } lAddMultiDocumentViewModel.AddFile(file); } } }
void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error == null) { using (Stream sf = (Stream)m_SaveFileDialog.OpenFile()) { e.Result.CopyTo(sf); sf.Flush(); NotifyWindow notificationWindow = new NotifyWindow("下载完成", "下载模板文件 " + SelectedTempFileEntity.DefaultFileName + " 完成"); notificationWindow.Show(); } } else { NotifyWindow notificationWindow = new NotifyWindow("下载失败", "下载模板文件 " + SelectedTempFileEntity.DefaultFileName + " 失败"); notificationWindow.Show(); } //throw new NotImplementedException(); }
private bool ReadSheet(Worksheet aSheet) { foreach (KeyValuePair<int, Row> rowPair in aSheet.Cells.Rows) { if (rowPair.Key == 0) // 第一行 流水号检查 受理流水号 { Cell lCell = rowPair.Value.GetCell(0); string lValue = lCell.Value.ToString().Trim(); if (lValue != "税务机关代开普通发票申请表") { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "打开的不是 '税务机关代开普通发票申请表' 或者 数据不在第一个工作表里。"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 1) // 第二行 流水号检查 受理流水号 { try { Cell lCell = rowPair.Value.GetCell(0); string lValue = lCell.Value.ToString(); StandBookEntity.StandBookID = lValue.Substring(lValue.IndexOf(':') + 1).Trim(); } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误","读取第二行 '受理流水号' 出错!请检查输入文件。"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 2) // 第三行 合同项目名称 合同总金额 本次拨款金额 { try { Cell lCellName = rowPair.Value.GetCell(0); Cell lCellTotolMoney = rowPair.Value.GetCell(2); Cell lCellThisMoney = rowPair.Value.GetCell(4); string lValueName = lCellName.Value.ToString(); StandBookEntity.ProjectName = lValueName.Substring(lValueName.IndexOf(':') + 1).Trim(); string lValueTotolMoney = lCellTotolMoney.Value.ToString(); lValueTotolMoney = lValueTotolMoney.Substring(lValueTotolMoney.IndexOf(':') + 1).Trim(); StandBookEntity.TotalMoney = Convert.ToDecimal(lValueTotolMoney); string lValueThisMoney = lCellThisMoney.Value.ToString(); lValueThisMoney = lValueThisMoney.Substring(lValueThisMoney.IndexOf(':') + 1).Trim(); StandBookEntity.ThisPartMoney = Convert.ToDecimal(lValueThisMoney); } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误","读取第三行 '合同项目名称 合同总金额 本次拨款金额' 出错!请检查输入文件。"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 3) // 第四行 综合税率 合同总应缴税额 { try { Cell lCellTotalRate = rowPair.Value.GetCell(1); string lValueTotalRate = lCellTotalRate.Value.ToString(); StandBookEntity.TotalTaxRate = Convert.ToDecimal(lValueTotalRate); } catch (Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第四行 '综合税率 合同总应缴税额' 出错!请检查输入文件。"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 4) // 第五行 申请单位 { try { Cell lCellCpName = rowPair.Value.GetCell(1); string lValueCpName = lCellCpName.Value.ToString().Trim(); StandBookEntity.TaxPayerName = lValueCpName; } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第五行 '申请单位' 出错!请检查输入文件。"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 7) // 第八行 经济性质 { try { Cell lCellEconomicNature = rowPair.Value.GetCell(1); string lValueEconomicNature = lCellEconomicNature.Value.ToString().Trim(); StandBookEntity.EconomicNature = lValueEconomicNature; Cell lCellPhoneNumber = rowPair.Value.GetCell(3); string lValuePhoneNumber = lCellPhoneNumber.Value.ToString().Trim(); StandBookEntity.PhoneNumber = lValuePhoneNumber; } catch (Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第八行 '经济性质' '联系电话' 出错!请检查输入文件。"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 8) // 第九行 付款单位 { try { Cell lCellPlayCpName = rowPair.Value.GetCell(1); string lValueCpName = lCellPlayCpName.Value.ToString().Trim(); StandBookEntity.CapitalConstruction = lValueCpName; } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第九行 '付款单位' 出错!请检查输入文件。"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 13) // 第十四行 有无外管证 { try { Cell lCellHasVerify = rowPair.Value.GetCell(0); string lValueHasVerify = lCellHasVerify.Value.ToString().Trim(); lValueHasVerify = lValueHasVerify.Substring(lValueHasVerify.IndexOf(':') + 1).Trim(); if (lValueHasVerify == "有") { StandBookEntity.HasOutVerify = true; } else if (lValueHasVerify == "无") { StandBookEntity.HasOutVerify = false; } else { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第十四行 '有无外管证' 出错!请在':'后输入'有'或'无'。"); lNotifyWindow.Show(); return false; } } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误","读取第十三行 '有无外管证' 出错!请检查输入文件。"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 20) // 第二十一行 法人代表 { try { Cell lCellJridicalPerson = rowPair.Value.GetCell(3); string lValueJridicalPerson = lCellJridicalPerson.Value.ToString().Trim(); lValueJridicalPerson = lValueJridicalPerson.Substring(lValueJridicalPerson.IndexOf(':') + 1).Trim(); StandBookEntity.TaxPayerPersonName = lValueJridicalPerson; if(lValueJridicalPerson == string.Empty) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第二十一行 '法人代表' 出错!请在D列输入'法人姓名:XXX'。"); lNotifyWindow.Show(); return false; } } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第二十行 '法人代表' 出错!请在D列输入'法人姓名:XXX'。"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 21) // 第二十二行 日期 { try { Cell lCellDataTime = rowPair.Value.GetCell(0); string lValueDataTime = lCellDataTime.Value.ToString().Trim(); lValueDataTime = lValueDataTime.Substring(lValueDataTime.IndexOf(':') + 1).Trim(); StandBookEntity.PayTime = Convert.ToDateTime(lValueDataTime); } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误","读取第二十二行 '日期' 出错!请在A列输入'日期:yyyy年mm月dd日'。"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 25 // 第二十六行 税 || rowPair.Key == 26 // 第二十七行 税 || rowPair.Key == 27 // 第二十八行 税 || rowPair.Key == 28 // 第二十九行 税 || rowPair.Key == 29 // 第三十行 税 || rowPair.Key == 30 // 第三十一行 税 ) { string lValueTaxType; string lValueTax; string lValueTaxItem = ""; string lValueTaxRate; int lKeyRow = rowPair.Key + 1; try { Cell lCellTaxType = rowPair.Value.GetCell(0); lValueTaxType = lCellTaxType.Value.ToString().Trim(); Cell lCellTaxItem = rowPair.Value.GetCell(1); if (lCellTaxItem.Value != null) { lValueTaxItem = lCellTaxItem.Value.ToString().Trim(); } Cell lCellTaxRate = rowPair.Value.GetCell(4); lValueTaxRate = lCellTaxRate.Value.ToString().Trim(); Cell lCellTax = rowPair.Value.GetCell(5); lValueTax = lCellTax.Value.ToString().Trim(); } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第" + lKeyRow + "行 出错!"); lNotifyWindow.Show(); return false; } bool lHasCorrectTaxType = false; if (lValueTaxType != string.Empty) { if (lValueTaxType == "增值税") { lHasCorrectTaxType = true; try { decimal lTax = Convert.ToDecimal(lValueTax); decimal lTaxRate = Convert.ToDecimal(lValueTaxRate); StandBookEntity.HasAddValueTax = true; StandBookEntity.AddValueTax = lTax; StandBookEntity.AddValueTaxRate = lTaxRate; StandBookEntity.AddValueTaxItem = lValueTaxItem; } catch (Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第" + lKeyRow + "行 '营业税' 出错!"); lNotifyWindow.Show(); return false; } } if (lValueTaxType == "营业税") { lHasCorrectTaxType = true; try { decimal lTax = Convert.ToDecimal(lValueTax); decimal lTaxRate = Convert.ToDecimal(lValueTaxRate); StandBookEntity.HasBusinessTax = true; StandBookEntity.BusinessTax = lTax; StandBookEntity.BusinessTaxRate = lTaxRate; StandBookEntity.BusinessTaxItem = lValueTaxItem; } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第" + lKeyRow + "行 '营业税' 出错!"); lNotifyWindow.Show(); return false; } } if (lValueTaxType == "教育费附加") { lHasCorrectTaxType = true; try { decimal lTax = Convert.ToDecimal(lValueTax); decimal lTaxRate = Convert.ToDecimal(lValueTaxRate); StandBookEntity.HasEducationalSurtax = true; StandBookEntity.EducationalSurtaxTax = lTax; StandBookEntity.EducationalSurtaxTaxRate = lTaxRate; StandBookEntity.EducationalSurtaxTaxItem = lValueTaxItem; } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第" + lKeyRow + "行 '教育费附加' 出错!"); lNotifyWindow.Show(); return false; } } if (lValueTaxType == "城建税") { lHasCorrectTaxType = true; try { decimal lTax = Convert.ToDecimal(lValueTax); decimal lTaxRate = Convert.ToDecimal(lValueTaxRate); StandBookEntity.HasUrbanTax = true; StandBookEntity.UrbanTax = lTax; StandBookEntity.UrbanTaxRate = lTaxRate; StandBookEntity.UrbanTaxItem = lValueTaxItem; } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第" + lKeyRow + "行 '城建税' 出错!"); lNotifyWindow.Show(); return false; } } if (lValueTaxType == "地方教育附加") { lHasCorrectTaxType = true; try { decimal lTax = Convert.ToDecimal(lValueTax); decimal lTaxRate = Convert.ToDecimal(lValueTaxRate); StandBookEntity.HasLocalEducationalSurtax = true; StandBookEntity.LocalEducationalSurtaxTax = lTax; StandBookEntity.LocalEducationalSurtaxTaxRate = lTaxRate; StandBookEntity.LocalEducationalSurtaxTaxItem = lValueTaxItem; } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第" + lKeyRow + "行 '城建税' 出错!"); lNotifyWindow.Show(); return false; } } if (lValueTaxType == "印花税") { lHasCorrectTaxType = true; try { decimal lTax = Convert.ToDecimal(lValueTax); decimal lTaxRate = Convert.ToDecimal(lValueTaxRate); StandBookEntity.HasStampTax = true; StandBookEntity.StampTax = lTax; StandBookEntity.StampTaxRate = lTaxRate; StandBookEntity.StampTaxItem = lValueTaxItem; } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第" + lKeyRow + "行 '印花税' 出错!"); lNotifyWindow.Show(); return false; } } if (lValueTaxType == "企业所得税" || lValueTaxType == "个人所得税") { lHasCorrectTaxType = true; try { decimal lTax = Convert.ToDecimal(lValueTax); decimal lTaxRate = Convert.ToDecimal(lValueTaxRate); StandBookEntity.HasIncomeTax = true; StandBookEntity.IncomeTax = lTax; StandBookEntity.IncomeTaxRate = lTaxRate; StandBookEntity.IncomeTaxItem = lValueTaxItem; } catch(Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第" + lKeyRow + "行 '企业所得税(个人所得税)' 出错!"); lNotifyWindow.Show(); return false; } } if (!lHasCorrectTaxType) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第" + lKeyRow + "行 应納税种 不符合规范!"); lNotifyWindow.Show(); return false; } } } if (rowPair.Key == 32) // 第三十三行 备注 { try { Cell lCellNote = rowPair.Value.GetCell(1); if (lCellNote.Value != null) { string lValueCellNote = lCellNote.Value.ToString().Trim(); StandBookEntity.Note = lValueCellNote; } } catch (Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第三十三行 '备注' 出错!"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 33) // 第三十四行 完税凭证字别 完税证号码 { try { //Cell lCellFinishID = rowPair.Value.GetCell(1); //string lValueFinishID = lCellFinishID.Value.ToString().Trim(); Cell lCellFinishNumber = rowPair.Value.GetCell(4); if (lCellFinishNumber.Value != null) { string lValueFinishNumber = lCellFinishNumber.Value.ToString().Trim(); StandBookEntity.TaxReceiptNumber = lValueFinishNumber; } } catch (Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第三十四行 '完税凭证字别 完税证号码' 出错!"); lNotifyWindow.Show(); return false; } } if (rowPair.Key == 34) // 第三十五行 完税凭证字别 发票号码 { try { //Cell lCellFinishID = rowPair.Value.GetCell(1); //string lValueFinishID = lCellFinishID.Value.ToString().Trim(); Cell lCellInvoiceNumber = rowPair.Value.GetCell(4); if (lCellInvoiceNumber.Value != null) { string lValueInvoiceNumber = lCellInvoiceNumber.Value.ToString().Trim(); StandBookEntity.InvoiceNumber = lValueInvoiceNumber; } } catch (Exception e) { NotifyWindow lNotifyWindow = new NotifyWindow("读取错误", "读取第三十五行 '完税凭证字别 发票号码' 出错!"); lNotifyWindow.Show(); return false; } } } return true; }
private void onOpenStandBookFile() { OpenFileDialog oFile = new OpenFileDialog(); // .xls filter specified to select only .xls file. oFile.Filter = "Excel (*.xls)|*.xls"; if (oFile.ShowDialog() == true) { HasShowTemp = Visibility.Collapsed; try { FileStream fs = oFile.File.OpenRead(); Workbook book = Workbook.Open(fs); bool lIsSuccessRead = ReadSheet(book.Worksheets[0]); if (lIsSuccessRead) { fs.Close(); HasShowTemp = Visibility.Visible; CanInput = CheckVaild(); if (CanInput) { String fileName = oFile.File.Name; UserFile = new UserFile(); DateTime lDateTime = DateTime.Now; UserFile.FileName = lDateTime.ToString("yyyyMMdd_HHmmss_") + fileName; UserFile.FileFolder = currentTaxPayerEntity.TaxPayerId.ToString(); UserFile.FileStream = oFile.File.OpenRead(); taxPayerDocumentEntity = new TaxPayerDocumentEntity(); taxPayerDocumentEntity.TaxPayerDocumentBytes = UserFile.FileStream.Length; } UpdateChanged("StandBookEntity"); } } catch (Exception ex) { NotifyWindow lNotifyWindow = new NotifyWindow("打开文件出错", "请检查文件是否被其他程序打开或者文件中是否有自定义数据类型,请与模板比对!"); lNotifyWindow.Show(); } UpdateChanged("HasShowTemp"); } }
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 onCreatePDFFile() { if (string.IsNullOrWhiteSpace(fileName)) { NotifyWindow notifyWindow = new NotifyWindow("错误", "请先输入生成PDF文件名称!"); notifyWindow.Show(); return; } if (ImagesList.Count == 0) { NotifyWindow notifyWindow = new NotifyWindow("错误", "请先添加文件!"); notifyWindow.Show(); return; } pdfDocument doc = new pdfDocument(fileName, "", false); bool getIamge = false; foreach (AddImageEntity imageEntity in ImagesList) { try { WriteableBitmap bitmap; using (FileStream fs = new FileStream(imageEntity.FilePath, FileMode.Open)) { BitmapImage bi = new BitmapImage(); bi.SetSource(fs); bitmap = new WriteableBitmap(bi); } if (null != bitmap) { pdfPage page = doc.addPage((int)bitmap.PixelHeight, (int)bitmap.PixelWidth); page.addImage(bitmap, 0, 0); getIamge = true; createPDFFileSuccess = true; } else { createPDFFileSuccess = false; } } catch { createPDFFileSuccess = false; NotifyWindow notifyWindow = new NotifyWindow("错误", string.Format("打开图片文件{0}失败,请检查文件!!!", imageEntity.FilePath)); notifyWindow.Show(); } } if (getIamge) { tempPDFFile = System.IO.Path.GetTempFileName(); using (FileStream fs = new FileStream(tempPDFFile, FileMode.Create)) { doc.createPDF(fs); } UserFile = new UserFile(); UserFile.FileName = fileName; UserFile.FileFolder = taxPayerEntity.TaxPayerId.ToString(); UserFile.FileStream = (new FileInfo(tempPDFFile)).OpenRead(); taxPayerDocumentEntity = new TaxPayerDocumentEntity(); taxPayerDocumentEntity.TaxPayerDocumentBytes = UserFile.FileStream.Length; (OnUpdate as DelegateCommand).RaiseCanExecuteChanged(); UpdateChanged("UserFile"); } }
void SubOperationAddProject_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; if (submitOperation.HasError) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "保存失败"); notifyWindow.Show(); if (addTaxPayerEntity != null) { TaxPayerList.Remove(addTaxPayerEntity); addTaxPayerEntity = null; } IsBusy = false; } else { addTaxPayerEntity.Update(); AutoLinkDocumentFiles(addTaxPayerEntity, SelectTaxPayerEntity); } }
private void onOpenFile() { 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; } FileName = fileName; UserFile = new UserFile(); UserFile.FileName = fileName; UserFile.FileFolder = taxPayerEntity.TaxPayerId.ToString(); UserFile.FileStream = ofd.File.OpenRead(); taxPayerDocumentEntity = new TaxPayerDocumentEntity(); taxPayerDocumentEntity.TaxPayerDocumentBytes = UserFile.FileStream.Length; //ProjectFilesEntity.FileBytes = UserFile.FileStream.Length; (OnUpdate as DelegateCommand).RaiseCanExecuteChanged(); UpdateChanged("UserFile"); } }
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(); } } saveFileDialog = null; }
private void onOK() { if (SelectSearchCondition == null && IsFirst == false) { NotifyWindow notifyWindow = new NotifyWindow("错误", "请选择条件!"); notifyWindow.Show(); return; } if (SelectTaxPayerField == null) { NotifyWindow notifyWindow = new NotifyWindow("错误", "请选择字段!"); notifyWindow.Show(); return; } if (SelectSearchOperator == null) { NotifyWindow notifyWindow = new NotifyWindow("错误", "请选择操作!"); notifyWindow.Show(); return; } if (ValueStr == null && VisibilityStr == Visibility.Visible) { NotifyWindow notifyWindow = new NotifyWindow("错误", "请设置值!"); notifyWindow.Show(); return; } if (ValueInt == -1 && visibilityType == Visibility.Visible) { NotifyWindow notifyWindow = new NotifyWindow("错误", "请设置值!"); notifyWindow.Show(); return; } childWindow.DialogResult = true; }
private void LoginOperation_Completed(LoginOperation loginOperation) { IsBusy = false; App app = Application.Current as App; if (loginOperation.LoginSuccess) { DocumentManager.Web.User lUser = loginOperation.User.Identity as DocumentManager.Web.User; if (lUser.ExpireDay == -1100) { NotifyWindow notifyWindow = new NotifyWindow("注册错误", "注册信息丢失, 请与 管理员 联系"); notifyWindow.Show(); return; } else if (lUser.ExpireDay < 0) { NotifyWindow notifyWindow = new NotifyWindow("应用程序已经过期", "应用程序已经过期" + lUser.ExpireDay.ToString() + "天, 请与 管理员 联系"); notifyWindow.Show(); return; } else if (lUser.ExpireDay < 30) { NotifyWindow notifyWindow = new NotifyWindow("过期", "还有" + lUser.ExpireDay + "天, 应用程序即将过期,请与 管理员 联系"); notifyWindow.Show(); } app.MainPageViewModel.User = lUser; app.SuccessLogon(); } else { NotifyWindow notifyWindow = new NotifyWindow("用户名或密码错误", "用户名或密码错误"); notifyWindow.Show(); return; } }
private void SubOperation_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; if (submitOperation.HasError) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "上传失败 " + submitOperation.Error); notifyWindow.Show(); } else { NotifyWindow notifyWindow = new NotifyWindow("上传成功", "上传成功!"); notifyWindow.Show(); } }
private void OnModifyPasswordCommand() { if (ModifyPasswordEntity.Validate()) { IsBusy = true; DocumentManager.Web.OperationDomainContext operationDomainContext = new DocumentManager.Web.OperationDomainContext(); App app = Application.Current as App; if (app.MainPageViewModel.User.Password == Cryptography.MD5.GetMd5String(ModifyPasswordEntity.NewPassword)) { NotifyWindow notifyWindow = new NotifyWindow("密码验证", "请输入新密码"); notifyWindow.Show(); IsBusy = false; return; } InvokeOperation<bool> lModifyPassword = operationDomainContext.ModifyPassword(app.MainPageViewModel.User.UserID, Cryptography.MD5.GetMd5String(ModifyPasswordEntity.NewPassword)); lModifyPassword.Completed += ModifyPassword_Completed; } }
private void SubOperation_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; if (submitOperation.HasError) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "删除失败 " + submitOperation.Error); notifyWindow.Show(); } else { NotifyWindow notifyWindow = new NotifyWindow("删除成功", "删除成功!"); notifyWindow.Show(); } using (this.standBookView.DeferRefresh()) { this.standBookView.MoveToFirstPage(); } }
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(); using (taxPayerDocumentView.DeferRefresh()) { taxPayerDocumentView.MoveToFirstPage(); } } FinishLoadings(null, null); }
void SubOperation_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; if (submitOperation.HasError) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "保存失败"); notifyWindow.Show(); if (addTaxPayerEntity != null) { TaxPayerList.Remove(addTaxPayerEntity); addTaxPayerEntity = null; } } else { NotifyWindow notifyWindow = new NotifyWindow("保存成功", "保存成功!"); notifyWindow.Show(); addTaxPayerEntity = null; LoadData(); } IsBusy = false; }
public void AddFile(FileInfo aFileInfo) { AddImageEntity imageEntity = new AddImageEntity(); imageEntity.FilePath = aFileInfo.FullName; imageEntity.FileName = aFileInfo.Name; BitmapImage bi; try { using (FileStream fs = new FileStream(imageEntity.FilePath, FileMode.Open)) { bi = new BitmapImage(); bi.SetSource(fs); } } catch { NotifyWindow notifyWindow = new NotifyWindow("错误", string.Format("打开图片文件 {0} 失败,请检查文件!", imageEntity.FilePath)); notifyWindow.Show(); return; } imageEntity.ThumbImage = bi; imageEntity.UpCommand = new DelegateCommand(onUp); imageEntity.DownCommand = new DelegateCommand(onDown); imageEntity.DeleteCommand = new DelegateCommand(onDelete); ImagesList.Add(imageEntity); UpdateChanged("ImagesList"); }