Beispiel #1
0
        /// <summary>
        /// 工程下拉 改变事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolProjCombox_SelectedIndexChanged(object sender, EventArgs e)
        {
            ToolStripComboBox c1 = (ToolStripComboBox)myToolStrip1.Items["toolProjCombox"];

            ArrayList projName_list = c1.Tag as ArrayList;

            if (projName_list != null && projName_list.Count > 0)
            {
                foreach (string proj in projName_list)
                {
                    string[] projString = proj.Split(new char[] { '|' });
                    if (projString != null && projString[1] == c1.Text.Trim())
                    {
                        Globals.Ajdh        = projString[2];
                        Globals.Projectname = projString[1];
                        Globals.ProjectNO   = projString[0];
                        break;
                    }
                }
                this.btnFileCreate.Enabled     = true;
                this.toolStripButton2.Enabled  = true;
                this.btnProjectMaint.Enabled   = true;
                this.btnProjectArchive.Enabled = true;
                this.btnChangePass.Enabled     = true;
                this.myMenuStrip1.Enabled      = true;
                this.btnProjectSelect.Enabled  = true;
                this.toolProjCombox.Enabled    = true;
                this.btnExit.Enabled           = true;

                this.Text = Globals.AppTitle + " - " + Globals.Projectname;
                ReadWriteAppConfig config = new ReadWriteAppConfig();
                config.Write("Current_Project", Globals.ProjectNO);
                config.Write("Current_ProjectAjdh", Globals.Ajdh);

                Globals.CreateProjectPath();
            }
            else
            {
                this.btnFileCreate.Enabled     = false;
                this.toolStripButton2.Enabled  = false;
                this.btnProjectMaint.Enabled   = false;
                this.btnProjectArchive.Enabled = false;
                this.btnChangePass.Enabled     = false;
                this.myMenuStrip1.Enabled      = false;
                this.btnProjectSelect.Enabled  = true;
                this.toolProjCombox.Enabled    = false;
                this.btnExit.Enabled           = false;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 工程管理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmiProjectSelect_Click(object sender, EventArgs e)
        {
            this.btnProjectSelect.Enabled  = false;
            this.btnFileCreate.Enabled     = false;
            this.toolStripButton2.Enabled  = false;
            this.btnProjectMaint.Enabled   = false;
            this.btnProjectArchive.Enabled = false;
            this.btnChangePass.Enabled     = false;
            this.myMenuStrip1.Enabled      = false;
            this.toolProjCombox.Enabled    = false;
            this.btnExit.Enabled           = false;
            frmProjectList frm = new frmProjectList(setComBox);
            DialogResult   drs = frm.ShowDialog();

            this.Text = Globals.AppTitle + " - " + Globals.Projectname;//Globals.ProjectNO;
            if (drs != DialogResult.OK)
            {
                ToolStripComboBox c1 = (ToolStripComboBox)myToolStrip1.Items["toolProjCombox"];
                c1.Items.Clear();
                this.btnExit.Enabled = true;
            }
            else
            {
                ToolStripComboBox c1 = (ToolStripComboBox)myToolStrip1.Items["toolProjCombox"];
                c1.Items.Clear();

                BLL.T_Projects_BLL     projBLL  = new ERM.BLL.T_Projects_BLL();
                IList <MDL.T_Projects> projList =
                    projBLL.GetAll();

                ArrayList projname_list =
                    new ArrayList();

                foreach (MDL.T_Projects obj in projList)
                {
                    //c1.Items.Add(obj.ProjectNO);
                    projname_list.Add(obj.ProjectNO + "|" + obj.projectname + "|" + obj.ajdh);
                    c1.Items.Add(obj.projectname);
                }
                c1.Tag  = projname_list;
                c1.Text = Globals.Projectname;
                ReadWriteAppConfig config = new ReadWriteAppConfig();
                config.Write("Current_Project", Globals.ProjectNO);
                config.Write("Current_ProjectAjdh", Globals.Ajdh);
            }
        }
Beispiel #3
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);
        }
Beispiel #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            bool  bRun = true;
            Mutex m    = new Mutex(true, Application.ProductName, out bRun);

            if (bRun)
            {
                m.ReleaseMutex();
            }
            else
            {
                TXMessageBoxExtensions.Info("程序已经运行!");
                return;
            }
            if (!System.IO.Directory.Exists(Globals.ProjectPath))
            {
                System.IO.Directory.CreateDirectory(Globals.ProjectPath);
            }
            if (!System.IO.Directory.Exists(Globals.CellPath))
            {
                System.IO.Directory.CreateDirectory(Globals.CellPath);
            }
            if (!Globals.UpdateSettings() ||
                !System.IO.Directory.Exists(Globals.CellPath) ||
                !System.IO.Directory.Exists(Globals.ProjectPath))
            {
                return;
            }
            //启动清空临时打印目录
            #region
            System.Diagnostics.Process[] pro_Print = System.Diagnostics.Process.GetProcessesByName("JRPDFPrint");
            string tempFolder = string.Empty;
            if (pro_Print == null || pro_Print.Length == 0)
            {
                tempFolder =
                    System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "erm_print");
                if (System.IO.Directory.Exists(tempFolder))
                {
                    MyCommon.DeleteAndCreateEmptyDirectory(tempFolder, false);
                    MyCommon.DeleteAndCreateEmptyDirectory(tempFolder, true);
                }
                else
                {
                    MyCommon.DeleteAndCreateEmptyDirectory(tempFolder, true);
                }
            }
            ///移交时生成的临时目录
            tempFolder = System.IO.Path.Combine(Application.StartupPath, "temp_YJ");
            if (System.IO.Directory.Exists(tempFolder))
            {
                MyCommon.DeleteAndCreateEmptyDirectory(tempFolder, false);
                MyCommon.DeleteAndCreateEmptyDirectory(tempFolder, true);
            }
            else
            {
                MyCommon.DeleteAndCreateEmptyDirectory(tempFolder, true);
            }
            #endregion

            ReadWriteAppConfig config = new ReadWriteAppConfig();
            if (config.Read("Upload_ProjectSize") == "")
            {
                config.Write("Upload_ProjectSize", "4");
            }

            /**************************************************************************************************
             * 验证:
             * C7643B2A-EC98-4A8C-ACDD-1BF0A20F8C04:次数+天数
             * 99673744-DF8F-4001-83A9-8E77DF2D1EEB:时间
             * CC4526BE-800D-4EBC-BFE9-9D44C88ED7EE:次数
             **********************************************************************************************/
            //判断注册项表中的值
            //判断注册项表中的值
            //try
            //{
            //    RegistAction rAction = new RegistAction();
            //    ReadWriteAppConfig configAction = new ReadWriteAppConfig();
            //    if (configAction.Read("UseType") == "C7643B2A-EC98-4A8C-ACDD-1BF0A20F8C04")
            //    {
            //        if (rAction.IsRegeditExit("UseCount"))
            //        {
            //            string UseCount = rAction.GetRegistData("UseCount");
            //            string UseCurCount = rAction.GetRegistData("UseCurCount");
            //            string UseDay = rAction.GetRegistData("UseDay");
            //            if (Convert.ToInt32(UseCount) <= Convert.ToInt32(UseCurCount) ||
            //                DateTime.Now >= Convert.ToDateTime(UseDay))
            //            {
            //                TXMessageBoxExtensions.Info("提示:软件已过期 或 已过使用次数" + UseCount + "! \n  【温馨提示:如有疑问请与我们联系,0755-83995038】");
            //                return;
            //            }
            //            else
            //            {
            //                if (Convert.ToInt32(UseCount) - Convert.ToInt32(UseCurCount) <= 10)
            //                {
            //                    TXMessageBoxExtensions.Info("提示:软件使用次数只剩:" + (Convert.ToInt32(UseCount) - Convert.ToInt32(UseCurCount)) + " 次! \n  【温馨提示:如有疑问请与我们联系,0755-83995038】");
            //                }
            //                else if (Convert.ToInt32((Convert.ToDateTime(UseDay) - DateTime.Now).TotalDays) <= 10)
            //                {
            //                    TXMessageBoxExtensions.Info("提示:软件使用天数只剩:" + Convert.ToInt32((Convert.ToDateTime(UseDay) - DateTime.Now).TotalDays) + " 天! \n  【温馨提示:如有疑问请与我们联系,0755-83995038】");
            //                }
            //                rAction.WTRegedit("UseCurCount", (Convert.ToInt32(UseCurCount) + 1).ToString());
            //            }
            //        }
            //        else
            //        {
            //            rAction.WTRegedit("UseCount", configAction.Read("UseCount"));
            //            rAction.WTRegedit("UseCurCount", "1");
            //            rAction.WTRegedit("UseDay", DateTime.Now.AddDays(Convert.ToDouble(configAction.Read("UseDay"))).ToString("yyyy-MM-dd hh:mm:ss"));
            //        }
            //    }
            //    else if (configAction.Read("UseType") == "99673744-DF8F-4001-83A9-8E77DF2D1EEB")
            //    {
            //        if (rAction.IsRegeditExit("UseDate"))
            //        {
            //            string UseDate = rAction.GetRegistData("UseDate");
            //            if (DateTime.Compare(Convert.ToDateTime(UseDate), DateTime.Now) < 0)
            //            {
            //                TXMessageBoxExtensions.Info("提示:软件已过期 ! \n  【温馨提示:如有疑问请与我们联系,0755-83995038】");
            //                return;
            //            }
            //            else
            //            {
            //                if (Convert.ToInt32((Convert.ToDateTime(UseDate) - DateTime.Now).TotalDays) <= 10)
            //                {
            //                    TXMessageBoxExtensions.Info("提示:软件使用天数只剩:" + Convert.ToInt32((Convert.ToDateTime(UseDate) - DateTime.Now).TotalDays) + " 天! \n  【温馨提示:如有疑问请与我们联系,0755-83995038】");
            //                }
            //            }
            //        }
            //        else
            //        {
            //            string date_flg = configAction.Read("UseValue");
            //            string dataValue = rAction.Decrypt(date_flg, "digipowo");
            //            if (DateTime.Compare(Convert.ToDateTime(dataValue), DateTime.Now) < 0)
            //            {
            //                TXMessageBoxExtensions.Info("提示:软件已过期 ! \n  【温馨提示:如有疑问请与我们联系,0755-83995038】");
            //                return;
            //            }
            //            rAction.WTRegedit("UseDate", dataValue);
            //        }
            //    }
            //    else if (configAction.Read("UseType") == "CC4526BE-800D-4EBC-BFE9-9D44C88ED7EE")
            //    {
            //        //次数 100次:tkHPYaX8TwI= 150次:GnDjrw+KlkA= 0次:MoYeGrkYqas=
            //        //string temp = rAction.Decrypt("lrfJqKfPr2I=", "digipowo");
            //        string UseCount = configAction.Read("UseCount");
            //        string UseCurCount = configAction.Read("UseCurCount");
            //        UseCount = rAction.Decrypt(UseCount, "digipowo");
            //        UseCurCount = rAction.Decrypt(UseCurCount, "digipowo");

            //        if (Convert.ToInt32(UseCurCount) < Convert.ToInt32(UseCount))
            //        {
            //            configAction.Write("UseCurCount", rAction.Encrypt((Convert.ToInt32(UseCurCount) + 1).ToString(), "digipowo"));
            //        }
            //        else
            //        {
            //            TXMessageBoxExtensions.Info("提示:软件已过期 ! \n  【温馨提示:如有疑问请与我们联系,0755-83995038】");
            //            return;
            //        }
            //    }
            //    else
            //    {
            //        TXMessageBoxExtensions.Info("注册信息读取失败! \n     【温馨提示:如有疑问请与我们联系,0755-83995038】");
            //        return;
            //    }
            //}
            //catch (Exception ex)
            //{
            //    TXMessageBoxExtensions.Info("注册信息读取失败! \n     【温馨提示:如有疑问请与我们联系,0755-83995038】");
            //    return;
            //}

            //string system32Path = Environment.GetFolderPath(Environment.SpecialFolder.System);//"C:\\Windows\\system32"
            //try
            //{
            //    if (!System.IO.File.Exists(system32Path + "\\CellCtrl5.ocx"))
            //    {
            //        System.IO.File.Copy(Application.StartupPath + "\\SystemFiles\\CellCtrl5.ocx", system32Path + "\\CellCtrl5.ocx", true);
            //    }
            //}
            //catch (Exception ex) { MyCommon.WriteLog("注册插件失败:" + ex.Message); }

            frmLogin     frm = new frmLogin();
            DialogResult ret = frm.ShowDialog();
            if (ret == DialogResult.OK)
            {
                Application.Run(new frmMDIMain());
            }
            else
            {
                Application.Exit();
            }
        }