/// <summary> /// 过滤文件登记数据 /// </summary> /// <param name="data"></param> /// <param name="treeEnum"></param> /// <returns></returns> private DataSet FilterData(DataSet data, RegistEnum treeEnum) { DigiPower.ERM.CBLL.TreesData tcbll = new DigiPower.ERM.CBLL.TreesData(); DigiPower.ERM.CBLL.FileRegist cbll = new DigiPower.ERM.CBLL.FileRegist(); DataSet NewData = new DataSet(); switch (treeEnum) { case RegistEnum.NOATTACHMENT: { NewData = tcbll.GetTreeNoAttachment(Globals.OpenedProjectNo); NewData = FilterDataWithNoNode(NewData); return(NewData); } case RegistEnum.NOREGIST: { NewData = tcbll.GetTreeNoRegist(Globals.OpenedProjectNo); NewData = FilterDataWithNoNode(NewData); return(NewData); } case RegistEnum.NOPAPER: { NewData = tcbll.GetTreeNoPaper(Globals.OpenedProjectNo); NewData = FilterDataWithNoNode(NewData); return(NewData); } case RegistEnum.NOCHECK: { NewData = tcbll.GetTreeNoCheck(Globals.OpenedProjectNo); NewData = FilterDataWithNoNode(NewData); return(NewData); } case RegistEnum.ISPAPER: { NewData = tcbll.GetTreeIsPaper(Globals.OpenedProjectNo); NewData = FilterDataWithNoNode(NewData); return(NewData); } default: return(data); } }
private void tsNewScan_Click(object sender, EventArgs e) { if (!imageScan.ScannerAvailable()) { MessageBox.Show("没有扫描仪,无法扫描!"); return; } if (MessageBox.Show("你确定要替换扫描吗?", "替换扫描", MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { if (curSelNoFrmThum == 0) { return; } int selNo = curSelNoFrmThum; if (selNo == 0) { return; } string pathSrc = arrPic[selNo - 1].ToString(); string nameDaf = pathSrc; nameDaf = nameDaf.Substring(nameDaf.LastIndexOf("\\") + 1); nameDaf = nameDaf.Substring(0, nameDaf.LastIndexOf(".") + 1) + "daf"; string pathDaf = Globals.SPDFPath + "\\" + nameDaf; System.IO.File.Delete(pathSrc); System.IO.File.Delete(pathDaf); if (NewNode.ImageIndex == 2) { frmFileAdd fileAdd = new frmFileAdd(_parentForm); fileAdd.Regist(NewNode); } imageScan.OpenScanner(); string newName = Guid.NewGuid().ToString(); axImgEdit1.ImagePalette = ImgeditLibCtl.ImagePaletteConstants.wiPaletteRGB24; imageScan.ScanTo = ScanLibCtl.ScanToConstants.FileOnly; imageScan.MultiPage = true; imageScan.FileType = ScanLibCtl.FileTypeConstants.TIFF; imageScan.Image = Globals.ODOCPath + "\\" + newName + ".tif"; if (tscmbDisp.SelectedItem.ToString() == "不显示扫描设置") { imageScan.ShowSetupBeforeScan = false; } else { imageScan.ShowSetupBeforeScan = true; } int iScan = imageScan.StartScan(); if (iScan > 0) { return; } string strScanFileName = string.Empty; System.IO.DirectoryInfo dcInfo = new System.IO.DirectoryInfo(imageScan.Image); strScanFileName = dcInfo.Name; imageScan.CloseScanner(); if (strScanFileName != "") { PrintToPDF(Globals.ODOCPath + "\\" + newName + ".tif", null, newName); axImgAdmin1.DeletePages(selNo, 1); axImgAdmin1.Insert(Globals.ODOCPath + "\\" + newName + ".tif", 1, selNo, 1); axImgAdmin1.Refresh(); axImgEdit1.ImagePalette = ImgeditLibCtl.ImagePaletteConstants.wiPaletteRGB24; arrPic[selNo - 1] = Globals.ODOCPath + "\\" + newName + ".tif"; this.axImgEdit1.Image = arrPic[selNo - 1].ToString(); this.axImgEdit1.Display(); axImgThumbnail1.Image = reportsPath + "temp.tif"; axImgThumbnail1.Refresh(); for (int i = 1; i < selNo; i++) { axImgThumbnail1.ScrollThumbs(0, 0); } hasEdit = false; string strSql = "update attachment set yswjpath='" + newName + ".tif',ext='tif',filepath='" + newName + ".daf'"; strSql += " where ProjectNO='" + Globals.ProjectNO + "' and yswjpath='" + pathSrc.Substring(pathSrc.LastIndexOf("\\") + 1) + "'"; Digi.DBUtility.DbHelperOleDb.ExecuteSql(strSql); RegistEnum treeEnum = RegistEnum.FULL; TreeFactory treeFactory = new TreeFactory(); treeFactory.RefreshFileNode(NewNode, true, Globals.ProjectNO, true, false, treeEnum, true); MessageBox.Show("替换扫描成功!"); } } ////取待删除的文件名 ////扫描 }