Example #1
0
        /// <summary>
        /// 删除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsDelete_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = this.dgUsers.SelectedRows;

            if (rows.Count == 0)
            {
                TXMessageBoxExtensions.Info(SystemTips.MSG_ATLAST_SELECTROW_OP, SystemTips.MSG_TITLE);    //至少要选择一行记录才能够操作
                return;
            }
            else
            {       //询问是否删除
                if (TXMessageBoxExtensions.Question("确定要删除吗?") == DialogResult.Cancel)
                {
                    return;
                }
                else    //确定删除
                {
                    int id = Convert.ToInt16(rows[0].Cells["userid"].Value.ToString());
                    if (id == Globals.UserID)
                    {
                        TXMessageBoxExtensions.Info("不能删除已登陆的用户!");
                        return;
                    }
                    usersDB.Delete(id);    //删除
                    BindGridViewData();    //重新绑定数据
                }
            }
        }
Example #2
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            TreeNode CureNode = treeView1.SelectedNode;

            if (CureNode == null)
            {
                TXMessageBoxExtensions.Info("提示:选择需要导入的节点!");
                return;
            }

            if (CureNode.ImageIndex != 1)
            {
                if (CureNode.ImageIndex == 0 && CureNode.Text.Trim() == "最近著录过的文件")
                {
                    TXMessageBoxExtensions.Info("提示:只能选择文件夹目录或文件目录导入!");
                    return;
                }
                else if (CureNode.ImageIndex == 4)
                {
                    TXMessageBoxExtensions.Info("提示:已组卷的目录不允许编辑! \n 【温馨提示:如想编辑请在文件登记中撤销登记或在组卷目录移除此文件】");
                    return;
                }
                else if (CureNode.ImageIndex == 3)
                {
                    TXMessageBoxExtensions.Info("提示:只能选择文件夹目录或文件目录导入!");
                    return;
                }
            }

            int  DelCount  = 0;
            bool check_flg = false;

            CheckFileNodeIsArch(CureNode, ref check_flg, ref DelCount);
            if (check_flg)
            {
                TXMessageBoxExtensions.Info("提示:已组卷 或 保存的目录不允许编辑! \n 【温馨提示:如想编辑请在文件登记中撤销登记或在组卷目录移除此文件】");
                return;
            }

            if (TXMessageBoxExtensions.Question("提示:确定给节点:[ " + CureNode.Text + " ] 导入信息吗?") != DialogResult.OK)
            {
                return;
            }

            frmImpData   Frm = new frmImpData(CureNode, TreeNodeState_flg, 1);
            DialogResult drt = Frm.ShowDialog();

            if (drt == DialogResult.OK)
            {
                treeFactory.ResetDS();
                TXMessageBoxExtensions.Info("导入数据成功!");
            }
        }
Example #3
0
 /// <summary>
 ///  关闭窗体引发的事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmWelcome_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (TXMessageBoxExtensions.Question("您确定要退出系统吗?") == DialogResult.Cancel)
     {
         e.Cancel = true;
     }
     else
     {
         //ShengJi();//判断是否升级
         System.Diagnostics.Process.GetCurrentProcess().Kill();//杀死应用程序进程
     }
 }
Example #4
0
 private void DeleteSelectedItems()
 {
     if (TXMessageBoxExtensions.Question("确认删除", "确定删除所选择的图片吗?") == DialogResult.OK)
     {
         foreach (ListViewItem item in this.SelectedItems)
         {
             this.LargeImageList.Images.RemoveByKey(item.ImageKey);
             this.Items.Remove(item);
             if (ItemDeleted != null)
             {
                 ItemDeleted(this, new ItemDeletedEventArgs(item));
             }
         }
     }
 }
Example #5
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.dgvPoint.Rows.Count == 0)
            {
                TXMessageBoxExtensions.Info("请选择要删除的数据行!");
                return;
            }

            if (TXMessageBoxExtensions.Question("确认删除选中行吗?") == DialogResult.OK)
            {
                point.ID = this.dgvPoint.SelectedRows[0].Cells[0].Value.ToString();
                bll.Delete(point);
                TXMessageBoxExtensions.Info("删除成功!");
                DataBind();
            }
        }
Example #6
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnProjectDelete_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = this.dgProject.SelectedRows;

            if (rows.Count == 0)
            {
                return;
            }
            else
            {   //询问是否删除
                if (TXMessageBoxExtensions.Question("确定要删除工程:" + rows[0].Cells["ProjectName"].Value.ToString() + "吗?  \n 【温馨提示:删除工程后信息将无法恢复!请慎重!!!】") == DialogResult.Cancel)
                {
                    return;
                }
                else//确定删除
                {
                    string ProjectNO = rows[0].Cells["ProjectNO"].Value.ToString();
                    ERM.BLL.T_Projects_BLL ProjectsDB = new ERM.BLL.T_Projects_BLL();
                    T_Item_BLL             item       = new T_Item_BLL();
                    item.Delete(ProjectsDB.Find(ProjectNO).ItemID);

                    ProjectsDB.Delete(ProjectNO);
                    BLL.BLLMore bllMore = new BLLMore();

                    bllMore.DeleteUnitByProjectNO(ProjectNO);
                    bllMore.DeleteFileListByProjectNO(ProjectNO);
                    bllMore.DeleteCellFileByProjectNO(ProjectNO);
                    bllMore.DeleteArchiveByProjectNO(ProjectNO);
                    bllMore.DeleteGdListByProjectNO(ProjectNO);

                    bllMore.DeleteBrigeByProjectNO(ProjectNO);
                    bllMore.DeleteRoadLampByProjectNO(ProjectNO);
                    bllMore.DeleteTrafficByProjectNO(ProjectNO);

                    bllMore.DeletePointByPorjectNo(ProjectNO);
                    bllMore.DeleteYW_CellAndEFileByPorjectNo(ProjectNO);
                    MyCommon.DeleteAndCreateEmptyDirectory(Globals.ProjectPathParent + ProjectNO, false);
                    BindGridViewData(false);//重新绑定数据
                }
            }
        }
Example #7
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            if (Dgv1.Rows.Count == 0)
            {
                TXMessageBoxExtensions.Info("没有可删除的数据!");
                return;
            }
            if (Dgv1.CurrentRow.Index < 0)
            {
                TXMessageBoxExtensions.Info("请选择一行数据进行删除!");
                return;
            }
            if (TXMessageBoxExtensions.Question("提示:确定删除吗?") != DialogResult.OK)
            {
                return;
            }
            string unitid = Dgv1.Rows[Dgv1.CurrentRow.Index].Cells[0].Value.ToString(); //当前unitid

            (new BLL.T_Units_BLL()).Delete(unitid);
            this.LoadDataFromView(txtUnittype.Text);
        }
Example #8
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsDelete_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = this.dgDistrict.SelectedRows;

            if (rows.Count == 0)
            {
                return;
            }
            else
            {   //询问是否删除
                if (TXMessageBoxExtensions.Question("确实要删除该条记录吗?") == DialogResult.Cancel)
                {
                    return;
                }
                else//确定删除
                {
                    int id = Convert.ToInt16(rows[0].Cells["DistrictID"].Value.ToString());
                    DistrictDB.Delete(id); //删除
                    BindGridViewData();    //重新绑定数据
                }
            }
        }
Example #9
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsDelete_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = this.dgPageSize.SelectedRows;

            if (rows.Count == 0)
            {
                TXMessageBoxExtensions.Info("至少要选择一行记录才能够操作!");
                return;
            }
            else
            {   //询问是否删除
                if (TXMessageBoxExtensions.Question("确定要删除记录吗 ?") == DialogResult.Cancel)
                {
                    return;
                }
                else//确定删除
                {
                    //if (rows[0].Cells["isdefault"].Value.ToString() == "1")
                    //{
                    //    TXMessageBoxExtensions.Info("必须先设置一个默认!");
                    //    return;
                    //}
                    ERM.BLL.PageSize bll_pagesiz = new ERM.BLL.PageSize();
                    DataSet          ds          = bll_pagesiz.GetAllList();
                    if (ds != null && ds.Tables.Count > 0 &&
                        ds.Tables[0] != null && ds.Tables[0].Rows.Count > 1)
                    {
                        int id = Convert.ToInt16(rows[0].Cells["PID"].Value.ToString());
                        bll_pagesiz.Delete(id);  //删除
                        BindGridViewData(false); //重新绑定数据
                    }
                    else
                    {
                        TXMessageBoxExtensions.Info("提示:至少需要保留一条记录信息!");
                    }
                }
            }
        }
Example #10
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripButton1_Click_1(object sender, EventArgs e)
        {
            try
            {
                string id = getSelectID();
                if (string.IsNullOrEmpty(id))
                {
                    TXMessageBoxExtensions.Info("没有数据,不能删除!");
                    return;
                }

                if (TXMessageBoxExtensions.Question("确定要删除吗?") == DialogResult.OK)
                {
                    templateBLL.Delete(id);
                    TXMessageBoxExtensions.Info("删除成功!");
                    Search();
                }
            }
            catch (Exception)
            {
                TXMessageBoxExtensions.Info("删除失败!");
            }
        }
Example #11
0
        private bool CheckFileExist(DataTable _dt)
        {
            List <int> delrow = new List <int>();

            for (int i = 0; i < _dt.Rows.Count; i++)
            {
                if (!System.IO.File.Exists(_dt.Rows[i]["filed"].ToString()))
                {
                    if (TXMessageBoxExtensions.Question("第:" + (i + 1) + "行 \n " + _dt.Rows[i]["title"].ToString() + " \n 的PDF电子件不存在,要忽略并继续吗?") != DialogResult.OK)
                    {
                        return(false);
                    }
                    else
                    {
                        delrow.Add(i);
                    }
                }
            }
            for (int j = delrow.Count - 1; j >= 0; j--)
            {
                _dt.Rows[delrow[j]].Delete();
            }
            return(true);
        }
Example #12
0
 /// <summary>
 /// 执行打印
 /// </summary>
 /// <param name="dt"></param>
 /// <param name="printername"></param>
 /// <param name="hMenu"></param>
 /// <param name="strDefault"></param>
 /// <returns></returns>
 private IntPtr PrintFile(DataTable dt, string printername, IntPtr hMenu, string strDefault)
 {
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         if (!del(dt.Rows[i]["filed"].ToString(), printername))
         {
             if (TXMessageBoxExtensions.Question(dt.Rows[i]["title"].ToString() + "打印失败,要继续吗?") != DialogResult.OK)
             {
                 btnCancel.Enabled = true;
                 hMenu             = GetSystemMenu(this.Handle, 0);
                 EnableMenuItem(hMenu, SC_CLOSE, MF_ENABLED);
                 if (setDefaultPrinter)//设回来
                 {
                     if (string.Compare(strDefault, printername, true) != 0)
                     {
                         PrinterOperate.SetPrinter(strDefault);
                     }
                 }
                 break;
             }
         }
     }
     return(hMenu);
 }
Example #13
0
        /// <summary>
        /// 按案卷上报
        /// </summary>
        /// <returns></returns>
        private bool?ConfirmSplitForfrmArchive()
        {
            if (txtLoc.Text == "")
            {
                TXMessageBoxExtensions.Info("请选择导出文件的存储路径!");
                txtLoc.Focus();
                return(null);
            }
            string destFilename = Globals.Projectname;

            destFolder = txtLoc.Text;

            string dest_temp = Path.GetDirectoryName(txtLoc.Text);

            if (!Directory.Exists(dest_temp))
            {
                TXMessageBoxExtensions.Info("存储的路径不存在!");
                return(null);
            }

            double             projectSize = Convert.ToDouble(DirectoryInfoCommon.GetDirectorySpace(Application.StartupPath + "\\Project\\" + Globals.ProjectNO) / Convert.ToDouble(1024 * 1024 * 1024));
            ReadWriteAppConfig config      = new ReadWriteAppConfig();

            if (config.Read("Upload_ProjectSize") == "")
            {
                config.Write("Upload_ProjectSize", "4");
            }
            string upload_size = config.Read("Upload_ProjectSize");

            if (projectSize > Convert.ToDouble(upload_size))
            {
                DialogResult dresult = TXMessageBoxExtensions.Question("上报工程大于" + upload_size + "G,当前工程大小为:" + System.Math.Round(projectSize, 2) + "G \r\n\n 【温馨提示:工程太大,生成移交文件需要比较长得时间】  \r\n\n 是否继续生成移交?");
                if (dresult != DialogResult.OK)
                {
                    return(null);
                }
            }
            else if (MyCommon.CheckDisk(destFolder) < projectSize)
            {
                //硬盘空间不足
                TXMessageBoxExtensions.Info("上报工程大小为:" + System.Math.Round(projectSize, 2) + "G 保存目录硬盘空间不足,无法生成! \r\n 【温馨提示:请选择比较空闲的盘符】");
                txtLoc.Focus();
                return(null);
            }

            tempFullName = dest_temp + "\\" + Guid.NewGuid().ToString();
            if (System.IO.Directory.Exists(tempFullName))
            {
                MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, false);
            }
            MyCommon.DeleteAndCreateEmptyDirectory(tempFullName);

            MyCommon.DeleteAndCreateEmptyDirectory(destFolder, false);
            MyCommon.DeleteAndCreateEmptyDirectory(destFolder, true);

            panelBottom.Visible = true;
            panelTop.Visible    = false;
            Application.DoEvents();
            butClose.Enabled = false;
            ERM.CBLL.CreateSip projectFactory = new ERM.CBLL.CreateSip(Globals.ProjectNO);
            //DataSet dsFinalArchive = projectFactory.GetListArchive(Globals.ProjectNO, "");
            DataSet dsFinalArchive = new Archive().pb_setXmlInfo();

            if (dsFinalArchive.Tables.Count < 1 || dsFinalArchive.Tables[0].Rows.Count < 1)
            {
                TXMessageBoxExtensions.Info("没有任何案卷可以移交!");
                return(false);
            }
            int  count_FinalArchive = dsFinalArchive.Tables[0].Rows.Count;
            bool checkfile_flag     = true;

            for (int i = 0; i < count_FinalArchive; i++)
            {
                BLL.T_FileList_BLL     fileBLL  = new ERM.BLL.T_FileList_BLL();
                IList <MDL.T_FileList> fileList = fileBLL.FindByArchiveID2(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), Globals.ProjectNO);
                foreach (MDL.T_FileList obj in fileList)
                {
                    if (obj.selected == 1 || obj.filepath == null || obj.filepath == "")
                    {
                        ConvertAllEFileToPDF(obj.FileID);
                    }
                    else
                    {
                        string tFilePath = obj.filepath.Replace("MPDF\\", "");
                        string sourMfile = Globals.ProjectPath + obj.filepath;
                        if (!System.IO.File.Exists(sourMfile))
                        {
                            ConvertAllEFileToPDF(obj.FileID);
                        }
                    }
                    IList <MDL.T_CellAndEFile> cellList   = (new ERM.BLL.T_CellAndEFile_BLL()).FindByGdFileID(obj.FileID, Globals.ProjectNO);
                    ERM.MDL.T_FileList         file_model = (new ERM.BLL.T_FileList_BLL()).Find(obj.FileID, Globals.ProjectNO);
                    if ((file_model.filepath == null || file_model.filepath == "") &&
                        cellList.Count > 0)
                    {
                        TXMessageBoxExtensions.Info("提示:文件【" + obj.gdwj + "】电子文件信息有误!无法移交,请审查");
                        checkfile_flag = false;
                        break;
                    }
                }
                if (!checkfile_flag)
                {
                    break;
                }
            }
            if (!checkfile_flag)
            {
                return(false);
            }

            progressBar2.Maximum = count_FinalArchive;
            progressBar2.Minimum = 0;
            progressBar2.MarqueeAnimationSpeed = 1000;
            progressBar2.Step = 1;
            lblMsg.Text       = "正在输出元数据信息...";
            Application.DoEvents();

            GetListArchiveXML(projectFactory, tempFullName);
            try
            {
                for (int i = 0; i < count_FinalArchive; i++)
                {
                    if (!Directory.Exists(tempFullName))
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, true);
                    }
                    //20120530 屏蔽XML文件
                    GetProjectXML(projectFactory, tempFullName);

                    if (Convert.ToBoolean(Properties.Settings.Default.SipIncludeDoc))
                    {
                        //20120530 屏蔽XML文件
                        GetListArchiveXMLEx(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), tempFullName);
                        GetDocumentXMLEx(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), tempFullName);

                        BLL.T_FileList_BLL     fileBLL  = new ERM.BLL.T_FileList_BLL();
                        IList <MDL.T_FileList> fileList = fileBLL.FindByArchiveID2(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), Globals.ProjectNO);
                        foreach (MDL.T_FileList obj in fileList)
                        {
                            //20120530 屏蔽XML文件
                            //getDocModel(obj);
                            getDocModel_NEW(obj, tempFullName);
                        }
                    }
                    lblMsg.Text = "正在对数据包进行封装...";
                    Application.DoEvents();

                    if (System.IO.File.Exists(tempFullName + "\\index.dat"))//Application.StartupPath + "\\temp\\index.dat"
                    {
                        System.IO.File.Move(tempFullName + "\\index.dat", destFolder + "\\index.dat");

                        string gcInfo  = System.IO.File.ReadAllText(tempFullName + "\\a#sgwj_gc.xml", Encoding.GetEncoding("gb2312"));
                        string docList = System.IO.File.ReadAllText(destFolder + "\\index.dat");
                        gcInfo = gcInfo.Replace("</项目工程信息>", "<ArchiveFileList>" + docList + "</ArchiveFileList></项目工程信息>");
                        System.IO.File.WriteAllText(destFolder + "\\index.dat", gcInfo, Encoding.GetEncoding("gb2312"));
                    }

                    SevenZip.SevenZipCompressor.SetLibraryPath(Application.StartupPath + "\\7z.dll");
                    SevenZip.SevenZipCompressor tmp = new SevenZip.SevenZipCompressor();
                    {
                        tmp.ArchiveFormat = SevenZip.OutArchiveFormat.Zip;
                        tmp.CompressDirectory(tempFullName, destFolder + "\\" + dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString() + ".sip");
                    }
                    MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, false);
                    progressBar2.Value = progressBar2.Value + 1;
                }
            }
            catch (Exception ex)
            {
                MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, false);
                TXMessageBoxExtensions.Info("封装数据时发生意外错误!错误002");
                MyCommon.WriteLog("生成移交文件时失败!错误信息:" + ex.Message);
                return(false);
            }
            butClose.Text    = "关闭";
            butClose.Enabled = true;
            TXMessageBoxExtensions.Info("已经成功生成上报文件!");
            return(true);
        }
Example #14
0
        /// <summary>
        /// 复制
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Click(object sender, EventArgs e)
        {
            frm2PDFProgressMsg fmessage = new frm2PDFProgressMsg();

            fmessage.Text = "工程复制中...";
            try
            {
                string     sourceNO   = string.Empty;
                string     sourceName = string.Empty;
                string     targeNO    = string.Empty;
                string     targeName  = string.Empty;
                T_Projects sourcePorj;
                T_Projects targePorj;

                (cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString();

                if (cbx_Source.Items.Count == 1 || cbx_Trage.Items.Count == 1)
                {
                    TXMessageBoxExtensions.Info("提示:请选择需要复制的工程!");
                    cbx_Source.Focus();
                    return;
                }
                else if ((cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString() == "--请选择")
                {
                    TXMessageBoxExtensions.Info("提示:请选择复制的工程!");
                    cbx_Source.Focus();
                    return;
                }
                else if ((cbx_Trage.SelectedItem as System.Data.DataRowView)[0].ToString() == "--请选择")
                {
                    TXMessageBoxExtensions.Info("提示:请选择复制的目的工程!");
                    cbx_Trage.Focus();
                    return;
                }
                else
                {
                    sourceNO   = (cbx_Source.SelectedItem as System.Data.DataRowView)[1].ToString(); //要编辑的主键
                    sourceName = (cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString(); //要编辑的主键
                    targeNO    = (cbx_Trage.SelectedItem as System.Data.DataRowView)[1].ToString();  //要编辑的主键
                    targeName  = (cbx_Trage.SelectedItem as System.Data.DataRowView)[0].ToString();  //要编辑的主键

                    //根据工程编号查询工程类别
                    sourcePorj = projectBLL.Find(sourceNO);
                    targePorj  = projectBLL.Find(targeNO);
                    if (sourcePorj.ProjectCategory != targePorj.ProjectCategory)
                    {
                        TXMessageBoxExtensions.Info("复制的工程类别必须一致!");
                        return;
                    }
                    if (sourceNO == targeNO)
                    {
                        TXMessageBoxExtensions.Info("提示:同一工程不能复制!");
                        return;
                    }
                }
                if (TXMessageBoxExtensions.Question("提示:确定将工程\n编号:" + sourceNO + " 名称:" +
                                                    sourceName + "\n复制到工程\n编号:" + targeNO + " 名称:" + targeName
                                                    + "\n【温馨提示:复制之后工程信息将无法恢复!请慎重!!!】") == DialogResult.OK)
                {
                    status_flg        = true;
                    btn_Copy.Enabled  = false;
                    btn_Colse.Enabled = false;

                    fmessage      = new frm2PDFProgressMsg();
                    fmessage.Text = "工程复制中...";
                    fmessage.progressBar1.Maximum = 4;

                    fmessage.label2.Text        = "正在删除工程编号:" + targeNO + "信息...";
                    fmessage.progressBar1.Value = 1;
                    fmessage.Show();
                    Application.DoEvents();

                    //删除目的工程下信息
                    BLL.BLLMore bllMore = new BLL.BLLMore();
                    bllMore.DeleteUnitByProjectNO(targeNO);
                    bllMore.DeleteFileListByProjectNO(targeNO);
                    bllMore.DeleteCellFileByProjectNO(targeNO);
                    bllMore.DeleteArchiveByProjectNO(targeNO);
                    bllMore.DeleteGdFileByProjectNO(targeNO);//删除归档类别

                    #region add deleteProject
                    bllMore.DeleteTrafficByProjectNO(targeNO);
                    bllMore.DeleteRoadLampByProjectNO(targeNO);
                    bllMore.DeleteBrigeByProjectNO(targeNO);
                    bllMore.DeletePointByPorjectNo(targeNO);
                    #endregion

                    MyCommon.DeleteAndCreateEmptyDirectory(Globals.ProjectPathParent + targeNO);

                    //将源工程信息Copy到目的工程
                    fmessage.label2.Text        = "正在更新工程编号:" + targeNO + "信息...";
                    fmessage.progressBar1.Value = 2;
                    Application.DoEvents();

                    BLL.T_Projects_BLL Proj_bll        = new ERM.BLL.T_Projects_BLL();
                    ERM.MDL.T_Projects targe_proj_MDL  = Proj_bll.Find(targeNO);
                    ERM.MDL.T_Projects source_proj_MDL = Proj_bll.Find(sourceNO);
                    targe_proj_MDL.address     = source_proj_MDL.address;
                    targe_proj_MDL.area1       = source_proj_MDL.area1;
                    targe_proj_MDL.area2       = source_proj_MDL.area2;
                    targe_proj_MDL.begindate   = source_proj_MDL.begindate;
                    targe_proj_MDL.bgyfmj      = source_proj_MDL.bgyfmj;
                    targe_proj_MDL.bjdate      = source_proj_MDL.bjdate;
                    targe_proj_MDL.category    = source_proj_MDL.category;
                    targe_proj_MDL.cfmj        = source_proj_MDL.cfmj;
                    targe_proj_MDL.createdate  = source_proj_MDL.createdate;
                    targe_proj_MDL.district    = source_proj_MDL.district;
                    targe_proj_MDL.dxsmj       = source_proj_MDL.dxsmj;
                    targe_proj_MDL.enddate     = source_proj_MDL.enddate;
                    targe_proj_MDL.floors1     = source_proj_MDL.floors1;
                    targe_proj_MDL.floors2     = source_proj_MDL.floors2;
                    targe_proj_MDL.ghcode      = source_proj_MDL.ghcode;
                    targe_proj_MDL.high        = source_proj_MDL.high;
                    targe_proj_MDL.hjqk        = source_proj_MDL.hjqk;
                    targe_proj_MDL.jldwshr     = source_proj_MDL.jldwshr;
                    targe_proj_MDL.jsdwshr     = source_proj_MDL.jsdwshr;
                    targe_proj_MDL.passwd      = source_proj_MDL.passwd;
                    targe_proj_MDL.price1      = source_proj_MDL.price1;
                    targe_proj_MDL.price2      = source_proj_MDL.price2;
                    targe_proj_MDL.projecttype = source_proj_MDL.projecttype;
                    targe_proj_MDL.qtyfmj      = source_proj_MDL.qtyfmj;
                    targe_proj_MDL.sgbzz       = source_proj_MDL.sgbzz;
                    targe_proj_MDL.sgcode      = source_proj_MDL.sgcode;
                    targe_proj_MDL.stru        = source_proj_MDL.stru;
                    targe_proj_MDL.syyfmj      = source_proj_MDL.syyfmj;
                    targe_proj_MDL.tbr         = source_proj_MDL.tbr;
                    targe_proj_MDL.tempid      = source_proj_MDL.tempid;
                    targe_proj_MDL.ts1         = source_proj_MDL.ts1;
                    targe_proj_MDL.ts2         = source_proj_MDL.ts2;
                    targe_proj_MDL.ts3         = source_proj_MDL.ts3;
                    targe_proj_MDL.ts4         = source_proj_MDL.ts4;
                    targe_proj_MDL.tstotal     = source_proj_MDL.tstotal;
                    targe_proj_MDL.ydpzcode    = source_proj_MDL.ydpzcode;
                    targe_proj_MDL.ydxkcode    = source_proj_MDL.ydxkcode;
                    targe_proj_MDL.zjy         = source_proj_MDL.zjy;
                    targe_proj_MDL.zygz        = source_proj_MDL.zygz;
                    targe_proj_MDL.zzmj        = source_proj_MDL.zzmj;

                    targe_proj_MDL.ztcw   = source_proj_MDL.ztcw;
                    targe_proj_MDL.dstcw  = source_proj_MDL.dstcw;
                    targe_proj_MDL.dxtcw  = source_proj_MDL.dxtcw;
                    targe_proj_MDL.kzsfcd = source_proj_MDL.kzsfcd;
                    targe_proj_MDL.ts5    = source_proj_MDL.ts5;
                    targe_proj_MDL.XMJL   = source_proj_MDL.XMJL;
                    targe_proj_MDL.yjdw   = source_proj_MDL.yjdw;
                    targe_proj_MDL.XCJL   = source_proj_MDL.XCJL;

                    Proj_bll.Update(targe_proj_MDL);

                    //坐标信息
                    IList <T_Point> t_point_source = new T_Point_BLL().GetList(sourceNO);
                    foreach (var item in t_point_source)
                    {
                        item.ID        = Guid.NewGuid().ToString();
                        item.ProjectNo = targeNO;
                        new T_Point_BLL().Insert(item);
                    }

                    //电子文件
                    bllMore.CopyFileAndEFileList(sourceNO, targeNO);

                    BLL.T_Archive_BLL      archive_bll  = new ERM.BLL.T_Archive_BLL();      //案卷信息
                    BLL.T_FileList_BLL     filelist_bll = new ERM.BLL.T_FileList_BLL();     //文件表
                    BLL.T_CellAndEFile_BLL cellAndEfile = new ERM.BLL.T_CellAndEFile_BLL(); //电子文件
                    //单位
                    BLL.T_Units_BLL     units_bll = new ERM.BLL.T_Units_BLL();              //施工单位
                    IList <MDL.T_Units> IUnits    = units_bll.FindByProjectNO(sourceNO);
                    if (IUnits != null && IUnits.Count > 0)
                    {
                        foreach (MDL.T_Units units in IUnits)
                        {
                            units.UnitID    = Guid.NewGuid().ToString();
                            units.ProjectNO = targeNO;
                            units_bll.Add(units);//保存
                        }
                    }

                    //扩展信息
                    switch (sourcePorj.ProjectCategory)
                    {
                    case "Traffic":
                        T_Traffic_BLL trafficBll = new T_Traffic_BLL();
                        T_Traffic     traffic    = trafficBll.QueryTraffic_ByProjID(sourceNO);
                        if (traffic != null)
                        {
                            traffic.ID        = Guid.NewGuid().ToString();
                            traffic.ProjectID = targeNO;
                            trafficBll.Insert(traffic);
                        }
                        break;

                    case "RoadLamp":
                        T_Project_RoadLamp_BLL roadLampBll = new T_Project_RoadLamp_BLL();
                        T_Project_RoadLamp     roadLamp    = roadLampBll.QueryRoadLamp_ByProjID(sourceNO);
                        if (roadLamp != null)
                        {
                            roadLamp.ProjectID = targeNO;
                            roadLamp.ID        = Guid.NewGuid().ToString();
                            roadLampBll.Insert(roadLamp);
                        }
                        break;

                    case "Brige":
                        T_Project_Brige_BLL brigeBll = new T_Project_Brige_BLL();
                        T_Project_Brige     brige    = brigeBll.QueryBrige_ByProjID(sourceNO);
                        if (brige != null)
                        {
                            brige.ID        = Guid.NewGuid().ToString();
                            brige.ProjectID = targeNO;
                            brigeBll.Insert(brige);
                        }
                        break;
                    }

                    fmessage.progressBar1.Value = 3;
                    Application.DoEvents();

                    //迁移文件夹
                    string   mprojectPath  = Application.StartupPath + "\\Project\\" + sourceNO;
                    string   tprojectPath  = Application.StartupPath + "\\Project\\" + targeNO;
                    string[] DirectoryList = new string[] { "MPDF", "ODOC", "PDF" };

                    if (System.IO.Directory.Exists(tprojectPath))
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, false);
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, true);
                    }
                    else
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, true);
                    }
                    string tempText  = fmessage.label2.Text;
                    char[] tempChar  = tempText.ToCharArray();
                    int    tempIndex = 0;
                    foreach (string dic in DirectoryList)
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath + "\\" + dic, true);
                        fmessage.label2.Text = "";
                        if (System.IO.Directory.Exists(mprojectPath))
                        {
                            if (System.IO.Directory.Exists(mprojectPath + "\\" + dic))
                            {
                                string[] files = System.IO.Directory.GetFiles(mprojectPath + "\\" + dic);
                                foreach (string filename in files)
                                {
                                    fmessage.label2.Text += tempChar[tempIndex];
                                    Application.DoEvents();
                                    tempIndex++;
                                    if (tempIndex >= tempChar.Length)
                                    {
                                        tempIndex            = 0;
                                        fmessage.label2.Text = "";
                                    }
                                    System.IO.FileInfo fileinfo = new System.IO.FileInfo(filename);
                                    if (System.IO.File.Exists(filename))
                                    {
                                        System.IO.File.Copy(filename, tprojectPath + "\\" + dic + "\\" + fileinfo.Name, true);
                                    }
                                }
                            }
                        }
                    }

                    fmessage.progressBar1.Value = 4;
                    Application.DoEvents();
                    fmessage.Close();

                    btn_Copy.Enabled  = true;
                    btn_Colse.Enabled = true;

                    TXMessageBoxExtensions.Info("提示:复制成功!");
                    BindGridViewData();
                }
            }
            catch (Exception ex)
            {
                if (fmessage != null)
                {
                    fmessage.Close();
                }
                TXMessageBoxExtensions.Info("提示:复制失败!");
                MyCommon.WriteLog("复制工程错误:" + ex.Message);
                btn_Copy.Enabled  = true;
                btn_Colse.Enabled = true;
            }
        }
Example #15
0
        private void tmrStart_Tick(object sender, EventArgs e)
        {
            tmrStart.Enabled = false;
            string versionFile = Application.StartupPath + "\\ERM_LangFang_Version.txt";

            try
            {
                foreach (System.Diagnostics.Process ERMpro in
                         System.Diagnostics.Process.GetProcessesByName("ERM2.0"))
                {
                    ERMpro.Kill();
                }

                using (System.Net.WebClient w1 = new System.Net.WebClient())
                {
                    w1.DownloadFile("http://www.digipower.cn/ERMUpdate/ERM_LangFang_Version.txt", versionFile);
                    //前面下载过了w1.DownloadFile("http://gti2000.vicp.net:8003/ERM_LangFang_Version.txt", versionFile);
                    System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                    string oldVersino = assembly.GetName().Version.ToString();
                    if (System.IO.File.Exists(versionFile))
                    {
                        string   strL1 = System.IO.File.ReadAllText(versionFile, Encoding.GetEncoding("gb2312"));
                        string[] strL2 = strL1.Split(';');
                        if (strL2.Length > 1)
                        {
                            string newVersion = strL2[0];
                            lblTitle.Text        = "正在升到到" + newVersion + "版本";
                            progressBar2.Maximum = (strL2.Length - 1) * 2;//用文件数量
                            Application.DoEvents();
                            string tempPath = Application.StartupPath + "\\temp\\";
                            if (System.IO.Directory.Exists(tempPath))
                            {
                                //string[] files = System.IO.Directory.GetFiles(tempPath);
                                //foreach (string f1 in files)
                                //{
                                //    System.IO.File.Delete(f1);
                                //}
                                DeleteAndCreateEmptyDirectory(tempPath, false);
                                DeleteAndCreateEmptyDirectory(tempPath, true);
                            }
                            else
                            {
                                DeleteAndCreateEmptyDirectory(tempPath, true);
                            }
                            ArrayList     newFileList = new ArrayList();
                            StringBuilder filepath    = new StringBuilder();
                            StringBuilder dirPath     = new StringBuilder();
                            for (int i1 = 1; i1 < strL2.Length - 1; i1++)
                            {
                                try
                                {
                                    string strNewFileWeb = strL2[i1];
                                    //int iPos1 = strNewFileWeb.LastIndexOf('/');
                                    //int iPos1 = strNewFileWeb.IndexOf("8003/");
                                    int iPos1 = strNewFileWeb.IndexOf("ERMUpdate/");
                                    if (iPos1 > 0)
                                    {
                                        //string NewFileLocal = strNewFileWeb.Substring(iPos1 + 1);
                                        //string NewFileLocal = strNewFileWeb.Substring(iPos1 + 5);
                                        string NewFileLocal = strNewFileWeb.Substring(iPos1 + 10);
                                        dirPath.Remove(0, dirPath.Length);
                                        filepath.Remove(0, filepath.Length);
                                        if (NewFileLocal.IndexOf('/') != -1)
                                        {
                                            string[] directoryList = NewFileLocal.Split(new char[] { '/' });
                                            for (int d = 0; d < directoryList.Length; d++)
                                            {
                                                if (d < directoryList.Length - 1)
                                                {
                                                    dirPath.Append("\\" + directoryList[d]);
                                                }
                                                filepath.Append("\\" + directoryList[d]);
                                            }

                                            if (!System.IO.Directory.Exists(tempPath + dirPath.ToString()))
                                            {
                                                DeleteAndCreateEmptyDirectory(tempPath + dirPath.ToString(), true);
                                            }
                                            if (!System.IO.Directory.Exists(Application.StartupPath + dirPath.ToString()))
                                            {
                                                DeleteAndCreateEmptyDirectory(Application.StartupPath + dirPath.ToString(), true);
                                            }
                                        }
                                        else
                                        {
                                            filepath.Append(NewFileLocal);
                                        }
                                        //newFileList.Add(NewFileLocal);
                                        newFileList.Add(filepath.ToString());

                                        w1.DownloadFile(strNewFileWeb, tempPath + filepath.ToString());

                                        if (progressBar2.Maximum > progressBar2.Value)
                                        {
                                            progressBar2.Value++;
                                        }
                                        Application.DoEvents();
                                    }
                                }
                                catch
                                {
                                    if (progressBar2.Maximum > progressBar2.Value)
                                    {
                                        progressBar2.Value++;
                                    }
                                    Application.DoEvents();
                                }
                            }
                            btnCancel.Enabled = false;
                            lblMsg.Text       = "升级中......";
                            Application.DoEvents();
                            foreach (string tempFile in newFileList)
                            {
                                try
                                {
                                    if (System.IO.File.Exists(Application.StartupPath + "\\" + tempFile))
                                    {
                                        System.IO.File.Delete(Application.StartupPath + "\\" + tempFile);
                                    }
                                    if (System.IO.File.Exists(tempPath + tempFile))
                                    {
                                        System.IO.File.Move(tempPath + tempFile, Application.StartupPath + "\\" + tempFile);
                                    }
                                    if (progressBar2.Maximum > progressBar2.Value)
                                    {
                                        progressBar2.Value++;
                                    }
                                    Application.DoEvents();
                                }
                                catch
                                {
                                    if (progressBar2.Maximum > progressBar2.Value)
                                    {
                                        progressBar2.Value++;
                                    }
                                    Application.DoEvents();
                                }
                            }
                            lblMsg.Text = "升级完成!";
                            if (TXMessageBoxExtensions.Question("更新完成,请重新启动电子文件归档系统,现在启动吗?") == DialogResult.OK)
                            {
                                System.Diagnostics.Process.Start(Application.StartupPath + "\\ERM2.0.exe");
                            }
                            this.Close();
                        }
                    }
                    else
                    {
                        TXMessageBoxExtensions.Info("更新失败!");
                        this.Close();
                    }
                }
            }
            catch
            {
                TXMessageBoxExtensions.Info("更新失败!");
                this.Close();
            }
            ////读取本地配置文件信息
            ////下载服务器上的配置文件到本地临时目录
            ////读取服务器配置文件
            ////检查是否有新版本可以下载
            ////关闭执行程序
            ////初始化下载信息
            ////下载文件
            ////更新配置文件,删除临时目录
            ////关闭,重启主程序
        }
Example #16
0
        /// <summary>
        /// 删除当前节点
        /// </summary>
        private void DelNode()
        {
            frm2PDFProgressMsg dfmsg = null;

            try
            {
                TreeNodeEx theNode = (TreeNodeEx)treeView1.SelectedNode;
                if (theNode == null)
                {
                    return;
                }
                TreeNodeEx parentNode = (TreeNodeEx)theNode.Parent;
                if (parentNode == null)
                {
                    return;
                }
                if (parentNode.Tag != null && parentNode.Tag.ToString() == "")
                {
                    MyFavorites myFav1 = new MyFavorites();
                    myFav1.Delete(theNode.Name);
                    theNode.Remove();
                    return;
                }

                int DelCount = 0;
                if (theNode.ImageIndex == 1)
                {
                    bool check_flg = false;
                    CheckFileNodeIsArch(theNode, ref check_flg, ref DelCount);
                    if (check_flg)
                    {
                        TXMessageBoxExtensions.Info("提示:已经组卷的文件目录不允许修改!");
                        return;
                    }
                }
                DialogResult ret = TXMessageBoxExtensions.Question("确定删除 [" + GetTrueText(theNode.Text) + "] 及其子节点?");
                if (ret == DialogResult.OK)
                {
                    this.Enabled = false;

                    MDL.T_FileList fileMDL = (new BLL.T_FileList_BLL()).Find(theNode.Name, Globals.ProjectNO);
                    if (fileMDL != null)
                    {
                        if (int.Parse(fileMDL.fileStatus) > 3)
                        {
                            TXMessageBoxExtensions.Info("该文件已经 登记或组卷,无法进行删除操作!");
                            this.Enabled = true;
                            return;
                        }
                        dfmsg = new frm2PDFProgressMsg();
                        if (theNode.ImageIndex == 1)
                        {
                            dfmsg.progressBar1.Maximum = DelCount;
                            dfmsg.label2.Text          = "正在删除:0/" + DelCount.ToString();
                            dfmsg.Show();
                            Application.DoEvents();
                        }
                        else
                        {
                            dfmsg.progressBar1.Maximum = 2;
                            dfmsg.progressBar1.Value   = 1;
                            dfmsg.label2.Text          = "正在删除:1/1";
                            dfmsg.Show();
                            Application.DoEvents();
                        }

                        DeleteRecycle(theNode.Name, ref dfmsg);
                        theNode.Remove();
                        CheckEnable();
                        tssLabel1.Text = Globals.NormalStatus;
                    }
                    this.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                this.Enabled = true;
                if (dfmsg != null)
                {
                    dfmsg.Dispose();
                    dfmsg.Close();
                }
            }
            finally
            {
                this.Enabled = true;
                if (dfmsg != null)
                {
                    dfmsg.Dispose();
                    dfmsg.Close();
                }
            }
        }
Example #17
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                if (lstFiles.CheckedItems.Count == 0)
                {
                    return;
                }
                DataTable dt = ((DataView)lstFiles.DataSource).ToTable();
                for (int j = lstFiles.Items.Count - 1; j >= 0; j--)
                {
                    if (!lstFiles.GetItemChecked(j))
                    {
                        dt.Rows[j].Delete();
                    }
                }
                if (!CheckFileExist(dt))
                {
                    return;
                }
                if (dt.Rows.Count == 0)
                {
                    TXMessageBoxExtensions.Info("没有要打印的文件!");
                    return;
                }
                string PrintMode = "2";
                if (PrintMode.Equals("2") && tn != null)
                {
                    string[] printFileList = new string[dt.Rows.Count];
                    string   tempFolder    =
                        System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "erm_print");
                    if (!System.IO.Directory.Exists(tempFolder))
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tempFolder, true);
                    }
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        /*
                         * * 拷贝到临时目录进行打印,因为隐藏章打印会删除掉,影响系统查看
                         * * */
                        string tempFile = System.IO.Path.Combine(tempFolder, dt.Rows[i]["title"].ToString() + ".pdf");
                        System.IO.File.Copy(dt.Rows[i]["filed"].ToString(), tempFile, true);
                        printFileList[i] = tempFile;
                    }

                    using (ConvertCell2PDF cl_print = new ConvertCell2PDF())
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(Application.StartupPath + @"\Reports\printPdf_temp", true);
                        cl_print.MergePDF(printFileList, Application.StartupPath + @"\Reports\printPdf_temp\printFile.pdf");
                        frmReport frmReports = new frmReport("printFile.pdf");
                        frmReports.ShowDialog();
                        //cl_print.BathPrintPDF(printFileList);
                    }
                    //switch (tn.ImageIndex)
                    //{
                    //    case 0://所有
                    //        string[] printFileList = new string[dt.Rows.Count];
                    //        for (int i = 0; i < dt.Rows.Count; i++)
                    //        {
                    //            printFileList[i] = dt.Rows[i]["filed"].ToString();
                    //        }
                    //        break;
                    //    case 1://案卷
                    //        //OperatorFile(dt, printername, ref hMenu, strDefault, dtNew, tn, StartPageNo);
                    //        break;
                    //    case 2://文件
                    //        //hMenu = OperatorTem(dt, printername, hMenu, strDefault, dtNew, StartPageNo);
                    //        break;
                    //    default:
                    //        break;
                    //}
                }
                else
                {
                    frmPrinterList frm = new frmPrinterList();
                    DialogResult   drs = frm.ShowDialog();
                    if (drs != DialogResult.OK)
                    {
                        return;
                    }
                    string printername = frm.GetSelected;
                    btnPrint.Enabled  = false;
                    btnCancel.Enabled = false;
                    lstFiles.Enabled  = false;
                    chkAll.Enabled    = false;
                    IntPtr hMenu = GetSystemMenu(this.Handle, 0);
                    EnableMenuItem(hMenu, SC_CLOSE, MF_DISABLED | MF_GRAYED);
                    string strDefault = "";
                    if (setDefaultPrinter)
                    {
                        strDefault = PrinterOperate.GetDefaultPrinterName();
                        if (string.Compare(strDefault, printername, true) != 0)
                        {
                            PrinterOperate.SetPrinter(printername);
                        }
                    }

                    hMenu = PrintFile(dt, printername, hMenu, strDefault);
                    if (setDefaultPrinter)//设回来
                    {
                        if (string.Compare(strDefault, printername, true) != 0)
                        {
                            PrinterOperate.SetPrinter(strDefault);
                        }
                    }
                    btnCancel.Enabled = true;
                    hMenu             = GetSystemMenu(this.Handle, 0);
                    EnableMenuItem(hMenu, SC_CLOSE, MF_ENABLED);
                    if (TXMessageBoxExtensions.Question("打印任务已经全部输送到打印机,现在可以关闭窗口了,请耐心等待打印机的处理。\n 是否继续打印?") != DialogResult.OK)
                    {
                        this.Close();
                    }
                    else
                    {
                        btnPrint.Enabled  = true;
                        btnCancel.Enabled = true;
                        lstFiles.Enabled  = true;
                        chkAll.Enabled    = true;
                    }
                }
                btnPrint.Enabled  = true;
                btnCancel.Enabled = true;
                lstFiles.Enabled  = true;
                chkAll.Enabled    = true;
            }
            catch (Exception ex)
            {
                btnPrint.Enabled  = true;
                btnCancel.Enabled = true;
            }
        }