Example #1
0
        private void FrmScan_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (hasEdit)
            {
                DialogResult dialog = MessageBox.Show("是否保存已作的修改?", "扫描", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                if (dialog == DialogResult.Yes)
                {
                    saveExit();
                    this.DialogResult = DialogResult.OK;
                }
                if (dialog == DialogResult.No)
                {
                    this.DialogResult = DialogResult.OK;
                    hasEdit           = false;
                }
            }
            else
            {
                this.DialogResult = DialogResult.OK;
            }
            TreeFactory treeFactory = new TreeFactory();

            NewNode.Nodes.Clear();
            if (NewNode.Nodes.Count <= 0)
            {
                treeFactory.AddFileNode(NewNode, Globals.ProjectNO);
            }
            frmFileAdd frm = new frmFileAdd(_parentForm);

            frm.treeRight.SelectedNode = NewNode.LastNode;
        }
Example #2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsSave_Click(object sender, EventArgs e)
        {
            string[] DwgFileNames = new string[dt.Rows.Count];
            string[] PdfFileNames = new string[dt.Rows.Count];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if ((!String.IsNullOrEmpty(dt.Rows[i]["DwgPath"].ToString())) && (!String.IsNullOrEmpty(dt.Rows[i]["PdfPath"].ToString())))
                {
                    DwgFileNames[i] = dt.Rows[i]["DwgPath"].ToString();
                    PdfFileNames[i] = dt.Rows[i]["PdfPath"].ToString();
                }
                else
                {
                    MessageBox.Show("数据不完整,请检查DWG与PDF的匹配情况!");
                    return;
                }
            }
            frmFileAdd frm = new frmFileAdd(_parentForm);

            for (int i = 0; i < DwgFileNames.Length; i++)
            {
                frm.AddExternalFile(DwgFileNames[i], NewNode, null, "DWG", PdfFileNames[i]);
            }
            if (System.IO.File.Exists(DWGXML + "dwg.xml"))
            {
                System.IO.File.Delete(DWGXML + "dwg.xml");
            }
            this.Close();
        }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="frm"></param>
 /// <param name="dt"></param>
 /// <param name="_inOunt">导入为0导出为1</param>
 public frmOutInError(Form frm, DataTable dt, int _inOunt)
 {
     InitializeComponent();
     this._parentFormAdd                = (frmFileAdd)frm;
     dt.Columns["title"].ColumnName     = "表格名称";
     dt.Columns["errorinfo"].ColumnName = "错误描述";
     dt.AcceptChanges();
     dataGridView1.DataSource = dt;
     RegistInOut = _inOunt;
 }
Example #4
0
        /// <summary>
        /// 文件登记
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmiProjectMaint_Click(object sender, EventArgs e)
        {
            if (1 == 2)
            {
                MessageBox.Show("未找到加密锁,请插入加密锁后,再进行操作!");
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            frmFileAdd mainForm = new frmFileAdd(this);

            mainForm.Show();
            this.Cursor = Cursors.Default;
            this.Hide();
        }
Example #5
0
 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("替换扫描成功!");
         }
     }
     ////取待删除的文件名
     ////扫描
 }
Example #6
0
 /// <summary>
 /// 扫描
 /// </summary>
 public void Scan()
 {
     if (!imageScan.ScannerAvailable())
     {
         MessageBox.Show("没有扫描仪,无法扫描!");
         return;
     }
     try
     {
         if (NewNode.ImageIndex == 2)
         {
             frmFileAdd fileAdd = new frmFileAdd(_parentForm);
             fileAdd.Regist(NewNode);
         }
         FileID = Guid.NewGuid().ToString();
         imageScan.OpenScanner();
         imageScan.ScanTo    = ScanLibCtl.ScanToConstants.FileOnly;
         imageScan.MultiPage = true;
         imageScan.FileType  = ScanLibCtl.FileTypeConstants.TIFF;
         imageScan.Image     = MovedCellPath + FileID + ".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 != "")
         {
             ERM.UI.File.frmTitle formTitle = new ERM.UI.File.frmTitle(this);
             if (formTitle.ShowDialog() == DialogResult.OK)
             {
                 frmFileAdd add = new frmFileAdd(_parentForm);
                 TreeNode   tn  = add.AddExternalFile(MovedCellPath + FileID + ".tif", NewNode, null, "OTHER", "");
                 strCurrentPicPath = MovedCellPath + FileID + ".tif";
                 ////修改数据库中title
                 ERM.CBLL.FileRegist fileRegist = new FileRegist();
                 fileRegist.UpdateAttachmentTitle(OpeartPath((TreeNodeEx)(NewNode)), Globals.ProjectNO, FileID, strTitle);
                 tn.Text = strTitle;
                 axImgEdit1.ImagePalette = ImgeditLibCtl.ImagePaletteConstants.wiPaletteRGB24;
                 this.axImgEdit1.Image   = MovedCellPath + tn.Name + ".tif";
                 this.axImgEdit1.Zoom    = 100;
                 this.axImgEdit1.Display();
                 arrPic.Add(this.axImgEdit1.Image);
                 axImgAdmin1.Insert(this.axImgEdit1.Image, 1, axImgThumbnail1.ThumbCount + 1, 1);
                 axImgAdmin1.Refresh();
                 axImgThumbnail1.Image = reportsPath + "temp.tif";
                 axImgThumbnail1.Refresh();
                 if (System.IO.File.Exists(MovedCellPath + FileID + ".tif"))
                 {
                     System.IO.File.Delete(MovedCellPath + FileID + ".tif");
                 }
                 hasEdit         = false;
                 curSelNoFrmThum = 1;
             }
         }
         else
         {
         }
     }
     catch (Exception)
     {
     }
 }