示例#1
0
 public static bool InsertTmpFileMsg(FileMsg fileMsg)
 {
     try
     {
         string sql1 = string.Format(@"INSERT into tmpfilemsg( UserID,FileName,FullName,Count,VerForm,PrintColor,PaperType,Printer,PageCount,Price,LoadTime,FinishTime,DeleteTime,State,isRemove,isNormalFile,InitPrice,FileSize) 
                                     VALUES ('{0}','{1}','{2}',{3},'{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}')",
                                     fileMsg.UserID, fileMsg.FileName, fileMsg.FullName, fileMsg.Count, fileMsg.VerForm, fileMsg.PrintColor, fileMsg.PaperType, fileMsg.Printer, fileMsg.PageCount, fileMsg.Price,
                                     fileMsg.LoadTime, fileMsg.FinishTime, fileMsg.DeleteTime, fileMsg.state, fileMsg.isRemove ? "1" : "0", fileMsg.isNormalFile ? "1" : "0", fileMsg.InitPrice, fileMsg.FileSize);
         sql1 = sql1.Replace("\\", "\\\\");
         int    i = SQLiteHelper.ExecuteNonQuery(sql1);
         string s = i > 0 ? "成功" : "失败";
         LogOperate.Add("插入订单:" + fileMsg.UserID + " " + fileMsg.FileName + " " + s);
         if (i == 0)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
 }
示例#2
0
        public static bool InsertTmpUserMsg(GroupMsg groupMsg)
        {
            try
            {
                string sql1 = string.Format(@"INSERT into tmpusermsg( UserID,FileName,FullName,GroupName,FileDirectory,Count,VerForm,PrintColor,PaperType,Printer,PageCount,InitPageCount,Price,InitPrice,Time,Area,Phone,SetTime,LoadTime,FinishTime,DeleteTime,CreateTime,PayType,State,isRemove,isManual,Note,FileSize) 
                                            VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}')",
                                            groupMsg.UserID, groupMsg.FileName, groupMsg.FullName, groupMsg.GroupName, groupMsg.FileDirectory, groupMsg.Count, groupMsg.VerForm, groupMsg.PrintColor, groupMsg.PaperType, groupMsg.Printer, groupMsg.PageCount, groupMsg.InitPageCount, groupMsg.Price, groupMsg.InitPrice, groupMsg.Time, groupMsg.Area,

                                            groupMsg.Phone, groupMsg.SetTime, groupMsg.LoadTime, groupMsg.FinishTime, groupMsg.DeleteTime, groupMsg.CreateTime, groupMsg.PayType, groupMsg.state, groupMsg.isRemove?"1":"0", groupMsg.isManual?"1":"0", groupMsg.Note, groupMsg.fileSize);
                sql1 = sql1.Replace("\\", "\\\\");
                int    i = SQLiteHelper.ExecuteNonQuery(sql1);
                string s = i > 0 ? "成功" : "失败";
                LogOperate.Add("插入订单:" + groupMsg.UserID + " " + s);
                if (i == 0)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
示例#3
0
 public static bool deleteAllTmpFileMsg(string userID)
 {
     try
     {
         string sql1 = string.Format(@"delete FROM tmpfilemsg where UserID = '{0}' ", userID);
         int    i    = SQLiteHelper.ExecuteNonQuery(sql1);
         string s    = i > 0 ? "成功" : "失败";
         LogOperate.Add("删除所有文件:" + userID + " " + s);
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
 }
示例#4
0
 public static bool deleteTmpUserMsg(GroupMsg groupMsg)
 {
     try
     {
         string sql1 = string.Format(@"delete FROM tmpusermsg where UserID = '{0}' ", groupMsg.UserID);
         int    i    = SQLiteHelper.ExecuteNonQuery(sql1);
         string s    = i > 0 ? "成功" : "失败";
         LogOperate.Add("删除订单:" + groupMsg.UserID + " " + s);
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
 }
示例#5
0
 public static bool deleteTmpFileMsg(string userID, string fileName, string fulllName)
 {
     try
     {
         string sql1 = string.Format(@"delete FROM tmpfilemsg where UserID = '{0}' and FileName ='{1}' and FullName = '{2}' ", userID, fileName, fulllName);
         sql1 = sql1.Replace("\\", "\\\\");
         int    i = SQLiteHelper.ExecuteNonQuery(sql1);
         string s = i > 0 ? "成功" : "失败";
         LogOperate.Add("删除文件:" + userID + " " + fileName + " " + s);
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
 }
示例#6
0
 public static bool UpdateTmpFileMsg(FileMsg fileMsg)
 {
     try
     {
         string sql1 = string.Format(@"update tmpfilemsg set UserID = '{0}',FileName = '{1}',FullName = '{2}',Count = '{3}',VerForm = '{4}',PrintColor = '{5}',PaperType = '{6}',Printer = '{7}',PageCount = '{8}',Price = '{9}',LoadTime = '{10}',FinishTime = '{11}',DeleteTime = '{12}',State  = '{13}',isRemove = '{14}',isNormalFile  = '{15}',InitPrice = '{16}' where UserID = '{17}' and FileName ='{18}' and FullName = '{19}' ",
                                     fileMsg.UserID, fileMsg.FileName, fileMsg.FullName, fileMsg.Count, fileMsg.VerForm, fileMsg.PrintColor, fileMsg.PaperType, fileMsg.Printer, fileMsg.PageCount, fileMsg.Price,
                                     fileMsg.LoadTime, fileMsg.FinishTime, fileMsg.DeleteTime, fileMsg.state, fileMsg.isRemove ? "1" : "0", fileMsg.isNormalFile ? "1" : "0", fileMsg.InitPrice, fileMsg.UserID, fileMsg.FileName, fileMsg.FullName);
         sql1 = sql1.Replace("\\", "\\\\");
         int    i = SQLiteHelper.ExecuteNonQuery(sql1);
         string s = i > 0 ? "成功" : "失败";
         LogOperate.Add("更新文件:" + fileMsg.UserID + " " + fileMsg.FileName + " " + s);
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
 }
示例#7
0
 public static bool UpdateTmpUserMsg(GroupMsg groupMsg)
 {
     try
     {
         string sql1 = string.Format(@"update tmpusermsg set UserID = '{0}',FileName = '{1}',FullName = '{2}',GroupName = '{3}',FileDirectory = '{4}',Count = '{5}',VerForm = '{6}',PrintColor = '{7}',PaperType = '{8}',Printer = '{9}',PageCount = '{10}',InitPageCount = '{11}',Price = '{12}',InitPrice = '{13}',Time = '{14}',Area = '{15}',Phone = '{16}',SetTime = '{17}',LoadTime = '{18}',FinishTime = '{19}',DeleteTime = '{20}',CreateTime = '{21}',PayType = '{22}',State  = '{23}',isRemove = '{24}',isManual  = '{25}',Note = '{26}',FileSize = '{27}' where UserID = '{28}'",
                                     groupMsg.UserID, groupMsg.FileName, groupMsg.FullName, groupMsg.GroupName, groupMsg.FileDirectory, groupMsg.Count, groupMsg.VerForm, groupMsg.PrintColor, groupMsg.PaperType, groupMsg.Printer, groupMsg.PageCount, groupMsg.InitPageCount, groupMsg.Price, groupMsg.InitPrice, groupMsg.Time, groupMsg.Area,
                                     groupMsg.Phone, groupMsg.SetTime, groupMsg.LoadTime, groupMsg.FinishTime, groupMsg.DeleteTime, groupMsg.CreateTime, groupMsg.PayType, groupMsg.state, groupMsg.isRemove ? "1" : "0", groupMsg.isManual ? "1" : "0", groupMsg.Note, groupMsg.fileSize, groupMsg.UserID);
         sql1 = sql1.Replace("\\", "\\\\");
         int    i = SQLiteHelper.ExecuteNonQuery(sql1);
         string s = i > 0 ? "成功" : "失败";
         LogOperate.Add("更新订单:" + groupMsg.UserID + " " + s);
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
 }
示例#8
0
 private void frm_Main_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!unInit)
     {
         if (main.groupList.FindIndex(t => t.isPrint == true) != -1)
         {
             MessageBox.Show("请打印文件完成后再退出!");
             e.Cancel = true;
         }
         if (this.Text.IndexOf(preString) != -1)
         {
             this.Text.Replace(preString, "-正在关闭...");
         }
         else
         {
             this.Text += "-正在关闭...";
         }
         foreach (var v in main.groupList)
         {
             if (!v.isRemove)
             {
                 SqlModlus.SaveGroupMsg(v);
             }
         }
         try
         {
             bExit               = true;
             WordToPdf.RunFlag   = false;
             ExcelHelper.RunFlag = false;
             WordToPdf.Stop();
             ExcelHelper.Stop();
             foreach (var v in FileHelper.lockFileList)
             {
                 v.fs.Close();
                 File.Delete(v.FullName);
             }
             LogOperate.Add("软件关闭!");
             LogOperate.Stop();
         }
         catch { }
     }
 }
        public static List <FileMsg> GetAllFile(DirectoryInfo root, string userName, string userID, string newPath, string oldPath)
        {
            List <FileMsg> tmpList = new List <FileMsg>();

            FileInfo[]      files = root.GetFiles();
            DirectoryInfo[] info  = root.GetDirectories();
            foreach (var v in files)
            {
                if ((v.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                {
                    continue;
                }
                if (v.Extension.ToUpper() == "")
                {
                    continue;
                }
                if (v.Extension.ToUpper() == ".RAR")
                {
                    continue;
                }
                if (v.Extension.ToUpper() == ".ZIP")
                {
                    continue;
                }
                double filesize = System.Math.Ceiling(v.Length / 1024.0);
                //string strSize = "";
                //if (filesize > 1024)
                //    strSize = Math.Round((filesize / 1024.0), 2).ToString() + "M";
                //else
                //    strSize = filesize.ToString() + "K";
                if (v.Extension.ToUpper() == ".PDF")
                {
                    if (v.Name.IndexOf("W2P_tmp~W2P_tmp~") == 0)
                    {
                        continue;
                    }
                    string tmpPageCount = FileHelper.GetPDFofPageCount(v.FullName).ToString();
                    if (tmpPageCount == "-1")
                    {
                        tmpList.Add(new FileMsg()
                        {
                            FileSize     = filesize,
                            UserID       = userID,
                            FullName     = newPath + "\\" + v.FullName.Replace(oldPath, "").Trim('\\'),
                            FileName     = v.Name,
                            PageCount    = "----",
                            Count        = "1",
                            PrintColor   = "黑白",
                            VerForm      = "正反",
                            LoadTime     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                            state        = "0",
                            isNew        = true,
                            isInit       = true,
                            isNormalFile = true
                        });
                    }
                    else
                    {
                        tmpList.Add(new FileMsg()
                        {
                            FileSize   = filesize,
                            UserID     = userID,
                            FullName   = newPath + "\\" + v.FullName.Replace(oldPath, "").Trim('\\'),
                            FileName   = v.Name,
                            PageCount  = tmpPageCount,
                            Count      = "1",
                            PrintColor = "黑白",
                            VerForm    = (tmpPageCount == "1" ? "单面" : "正反"),
                            LoadTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                            state      = "0",
                            isNew      = true,
                            isInit     = true
                        });
                    }
                }
                else if (v.Extension.ToUpper() == ".DOC" || v.Extension.ToUpper() == ".DOCX")
                {
                    string newFileName1 = WordToPdf.GetPdfName(v.FullName);
                    string newFileName  = WordToPdf.GetPdfPath(v.FullName);

                    if (File.Exists(newFileName))
                    {
                        string tmpPageCount = FileHelper.GetPDFofPageCount(newFileName).ToString();
                        tmpList.Add(new FileMsg()
                        {
                            FileSize   = filesize,
                            UserID     = userID,
                            FullName   = newPath + "\\" + newFileName.Replace(oldPath, "").Trim('\\'),
                            FileName   = v.Name,
                            PageCount  = tmpPageCount,
                            Count      = "1",
                            PrintColor = "黑白",
                            VerForm    = tmpPageCount == "1"?"单面": "正反",
                            LoadTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                            state      = "0",
                            isNew      = true,
                            isInit     = true
                        });
                    }
                    else
                    {
                        WTPMsg   wTPMsg = new WTPMsg();
                        string[] tmpStr = v.FullName.Split('\\');
                        wTPMsg.FileName     = tmpStr[tmpStr.Count() - 1];
                        wTPMsg.FullFileName = v.FullName;
                        wTPMsg.UserName     = userName;
                        LogOperate.Add("刷新检测Word没有转化,当前路径:" + newFileName + "," + userName);
                        WordToPdf.AddMsg(wTPMsg);
                        return(null);
                    }
                }
                else
                {
                    tmpList.Add(new FileMsg()
                    {
                        FileSize     = filesize,
                        UserID       = userID,
                        FullName     = newPath + "\\" + v.FullName.Replace(oldPath, "").Trim('\\'),
                        FileName     = v.Name,
                        PageCount    = "----",
                        Count        = "1",
                        PrintColor   = "黑白",
                        VerForm      = "正反",
                        LoadTime     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                        state        = "0",
                        isNew        = true,
                        isInit       = true,
                        isNormalFile = true
                    });
                }
            }
            foreach (DirectoryInfo dir in info)
            {
                tmpList.AddRange(GetAllFile(dir, userName, userID, newPath, oldPath));
            }
            return(tmpList);
        }
示例#10
0
        public static void GetUserMsg(string root)
        {
            string destPath = System.Windows.Forms.Application.StartupPath + @"\tmpCaeaload";

            if (!Directory.Exists(destPath))
            {
                Directory.CreateDirectory(destPath);
            }
            int             i           = 0;
            DirectoryInfo   tmpRootInfo = new DirectoryInfo(root);
            List <GroupMsg> tmpList     = new List <GroupMsg>();

            DirectoryInfo[] tmpInfoArray = tmpRootInfo.GetDirectories();
            foreach (var tmpInfo in tmpInfoArray)
            {
                if (frm_Main.bExit)
                {
                    break;
                }
                if (FileHelper.GetFileCount(tmpInfo) == 0)
                {
                    //tmpInfo.Delete();
                    //MessageBox.Show("文件夹:" + tmpInfo.Name + " 异常!");
                    LogOperate.Add("文件夹:" + tmpInfo.Name + "为空");
                    //tmpInfoArray = tmpRootInfo.GetDirectories();
                    continue;
                }
                List <FileMsg> tmpFileMsg = new List <FileMsg>();
                string         tmps       = destPath + "\\" + tmpInfo.Name + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + "(_caeaload)";
                string         newName    = tmps.Replace(destPath + "\\", "");
                if ((tmpFileMsg = GetAllFile(tmpInfo, tmpInfo.Name, newName, tmps, tmpInfo.FullName)) != null && tmpFileMsg.Count != 0)
                {
                    try
                    {
                        newName = tmpInfo.Name;
                        LogOperate.Add("开始移动订单:" + tmpInfo.Name);
                        tmpInfo.MoveTo(tmps);
                    }
                    catch (Exception ex)
                    {
                        LogOperate.Add("移动订单失败:" + tmpInfo.Name + "," + ex.Message);
                        //MessageBox.Show("移动订单失败:" + tmpInfo.Name + "," + ex.Message);
                        Thread.Sleep(100);
                        tmpInfoArray = tmpRootInfo.GetDirectories();
                        continue;
                    }

                    GroupMsg groupmsg = new GroupMsg()
                    {
                        UserID        = tmpInfo.Name,
                        CreateTime    = tmpInfo.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        FileMsgList   = tmpFileMsg,
                        LoadTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                        FileDirectory = frm_Main.CurrentPath,
                        state         = "0",
                        GroupName     = newName,
                        Count         = "1",
                        PageCount     = tmpFileMsg.Sum(t => t.PageCount == "----" ? 0 : int.Parse(t.PageCount)).ToString(),
                        //initPageCount = tmpFileMsg.Sum(t => t.PageCount == -1 ? 0 : t.PageCount),
                        VerForm    = "正反",
                        PrintColor = "黑白",
                        PaperType  = GetPaperType.defaultBWPaper,
                        Printer    = GetPrinterType.defaultBWPrinter,
                        PayType    = "4",
                        SetTime    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                        FullName   = tmpInfo.FullName.Trim('\\'),
                        isInit     = true
                    };
                    groupmsg.FileName      = groupmsg.GetDisplayFileName();
                    groupmsg.InitPageCount = groupmsg.PageCount;
                    groupmsg.InitPrice     = "-2";
                    tmpList.Add(groupmsg);
                    Thread.Sleep(10);
                }
                else
                {
                    Thread.Sleep(100);
                }
            }
            #region
            //while (tmpInfoArray.Count() > 0)
            //{
            //    if (frm_Main.bExit)
            //        break;
            //    DirectoryInfo tmpInfo = tmpInfoArray[0];
            //    if (FileHelper.GetFileCount(tmpInfo) == 0)
            //    {
            //        //tmpInfo.Delete();
            //        MessageBox.Show("文件夹:" + tmpInfo.Name + " 异常!");
            //        tmpInfoArray = tmpRootInfo.GetDirectories();
            //        continue ;
            //    }
            //    List<FileMsg> tmpFileMsg = new List<FileMsg>();
            //    string tmps = destPath + "\\" + tmpInfo.Name + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + "(_caeaload)";
            //    string newName = tmps.Replace(destPath + "\\","");
            //    if ((tmpFileMsg = GetAllFile(tmpInfo, tmpInfo.Name, newName, tmps, tmpInfo.FullName)) != null && tmpFileMsg.Count != 0)
            //    {
            //        try
            //        {
            //            newName = tmpInfo.Name;
            //            LogOperate.Add("开始移动订单:" + tmpInfo.Name);
            //            tmpInfo.MoveTo(tmps);

            //        }
            //        catch (Exception ex)
            //        {
            //            LogOperate.Add("移动订单失败:" + tmpInfo.Name + "," + ex.Message);
            //            MessageBox.Show("移动订单失败:" + tmpInfo.Name + "," + ex.Message);
            //            Thread.Sleep(100);
            //            tmpInfoArray = tmpRootInfo.GetDirectories();
            //            continue;
            //        }

            //        GroupMsg groupmsg = new GroupMsg()
            //        {
            //            UserID = tmpInfo.Name,
            //            CreateTime = tmpInfo.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"),
            //            FileMsgList = tmpFileMsg,
            //            LoadTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
            //            FileDirectory = frm_Main.CurrentPath,
            //            state = "0",
            //            GroupName = newName,
            //            Count = "1",
            //            PageCount = tmpFileMsg.Sum(t => t.PageCount == "----" ? 0: int.Parse( t.PageCount)).ToString(),
            //            //initPageCount = tmpFileMsg.Sum(t => t.PageCount == -1 ? 0 : t.PageCount),
            //            VerForm = "正反",
            //            PrintColor = "黑白",
            //            PaperType = GetPaperType.defaultBWPaper,
            //            Printer = GetPrinterType.defaultBWPrinter,
            //            PayType = "4",
            //            SetTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
            //            FullName = tmpInfo.FullName.Trim('\\'),
            //            isInit = true
            //        };
            //        groupmsg.FileName = groupmsg.GetDisplayFileName();
            //        groupmsg.InitPageCount = groupmsg.PageCount;
            //        groupmsg.InitPrice = "-2";
            //        tmpList.Add(groupmsg);
            //        Thread.Sleep(10);
            //    }
            //    else
            //        Thread.Sleep(100);
            //    tmpInfoArray = tmpRootInfo.GetDirectories();
            //}
            #endregion
            foreach (var v in tmpList)
            {
                UserDB userDB = SqlModlus.selectUserMsg(v.GroupName);
                v.Printer   = v.FileMsgList.Count() == v.FileMsgList.Count(t => t.isNormalFile) ? "----" : GetPrinterType.defaultBWPrinter;
                v.PaperType = GetPaperType.defaultBWPaper;
                v.Area      = FileHelper.addrList.Contains(userDB.lastAddr) ? userDB.lastAddr : null;
                v.Phone     = userDB.phone;
                foreach (var subv in v.FileMsgList)
                {
                    subv.Printer   = subv.isNormalFile ? "----" : GetPrinterType.defaultBWPrinter;
                    subv.PaperType = GetPaperType.defaultBWPaper;
                    subv.Price     = subv.GetPrice();
                    subv.InitPrice = "-2";
                }
                v.Price = v.GetPrice();
                v.GetDisplayVerForm();
            }

            foreach (var v in tmpList)
            {
                if (v.FileMsgList.Count == 0)
                {
                    MessageBox.Show("订单有效文件为空!");
                    continue;
                }
                if (!SqlModlus.InsertTmpUserMsg(v))
                {
                    MessageBox.Show("订单保存异常!");
                }
                Thread.Sleep(1);
                foreach (var v1 in v.FileMsgList)
                {
                    if (!SqlModlus.InsertTmpFileMsg(v1))
                    {
                        MessageBox.Show("文件保存异常!");
                    }
                    Thread.Sleep(1);
                }
            }
            if (main.groupList == null)
            {
                main.groupList = new List <GroupMsg>();
            }
            foreach (var v in main.groupList)
            {
                if (v.isRemove)
                {
                    continue;
                }
                if (v.isManual)
                {
                    v.isInit = true;
                    continue;
                }
            }
            main.groupList.AddRange(tmpList);
            main.groupList.ForEach(t => t.isPrint = false);
            //main.groupList.RemoveAll(t => t.isRemove == true);
        }
示例#11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //File.AppendAllLines(@"E:\代码\C#\Winform\私单\打印管理20190916\20190820\打印管理\打印管理\bin\Debug\log\logtext 20190926 171728.txt",new string[] { "123456"});

            bool b = SQLiteHelper.SQLiteInit(string.Format(@"Data Source={0}\PrintDB.db", Application.StartupPath), "jtmes");

            if (b)
            {
                KeyPreview = true;
                try
                {
                    foreach (var v in toolStrip1.Items)
                    {
                        if (v is ToolStripButton)
                        {
                            ToolStripButton Tbtn = v as ToolStripButton;
                            if (Convert.ToString(Tbtn.Tag) == "1")
                            {
                                Tbtn.Paint     += toolStrip1_Paint;
                                Tbtn.MouseMove += toolStrip1_MouseMove;
                            }
                        }
                    }
                    logFlag = Convert.ToBoolean(ConfigClass.GetConfigString("sys", "log", "true"));
                    LogOperate.Init();
                    LogOperate.Start();
                    LogOperate.Add("软件运行");
                    CurrentPath = ConfigClass.GetConfigString("File", "path", "");
                    if (!Directory.Exists(CurrentPath))
                    {
                        FolderBrowserDialog f = new FolderBrowserDialog();
                        if (f.ShowDialog() == DialogResult.OK)
                        {
                            CurrentPath = f.SelectedPath;
                            ConfigClass.SetConfigString("File", "path", CurrentPath);
                        }
                        else
                        {
                            unInit = true;
                            Application.Exit();
                        }
                    }
                    string strFastPrint = ConfigClass.GetConfigString("Printer", "speed", "false");
                    CK_fastPrint.Checked = strFastPrint.ToUpper() == "TRUE" ? true : false;
                    nFastPrint           = CK_fastPrint.Checked;
                    bool bConvert = Convert.ToBoolean(ConfigClass.GetConfigString("sys", "Convert", "false"));
                    if (bConvert)
                    {
                        timer2.Interval = 1000;
                        timer2.Enabled  = true;
                    }
                    else
                    {
                        fileWatcher.Path = CurrentPath;
                        fileWatcher.EnableRaisingEvents = true;
                    }
                    sysConfigData.printerName = ConfigClass.GetConfigString("sys", "小票打印机", "");
                    sysConfigData.ShopName    = ConfigClass.GetConfigString("sys", "店铺名称", "");
                    sysConfigData.BarcodePath = ConfigClass.GetConfigString("sys", "二维码路径", "");
                    sound = new System.Media.SoundPlayer("Audio.wav");
                    sound.Load();
                    //main.groupList = ConfigClass.LoadCookie<GroupMsg>("cookie.dat");
                    main.groupList = SqlModlus.selectTmpUserMsg();
                    if (main.groupList == null)
                    {
                        main.groupList = new List <GroupMsg>();
                    }
                    foreach (var v in main.groupList)
                    {
                        if (!v.isManual)
                        {
                            List <FileMsg> fmsg = SqlModlus.selectTmpFileMsg(v.UserID);
                            v.FileMsgList = fmsg;
                        }
                    }
                    main.groupList.ForEach(t => t.isPrint = false);
                    main.groupList.RemoveAll(t => t.isRemove == true);
                    txt_Date.Text = DateTime.Now.Date.ToLongDateString();
                    CurrentDate   = txt_Date.Text;

                    FileHelper.timelist = GetPeopleMsg.GetTimeList();
                    FileHelper.addrList = GetPeopleMsg.GetAddrList();
                    FileHelper.rowMsg   = GetDefaultAddMsg.getMsg();
                    GetPaperType.UpdatePaperList();
                    GetPrinterType.UpdatePrinterList();
                    GetPaperPrice.getPrice();

                    GetUserMsg(CurrentPath);
                    WordToPdf.Start();
                    DealControl(new int[] { 0, 0, 0 });
                    CheckForIllegalCrossThreadCalls = false;
                    treeView1.ExpandAll();
                    treeView1.MouseDoubleClick += new MouseEventHandler(treeView1_DoubleClick);
                    txt_path.Text = CurrentPath;
                    //FileHelper.act.BeginInvoke(frm_Main.CurrentPath, callback, null);
                    frm_MainMenu = New_Form(frm_MainMenu);
                    tooldoWork   = frm_MainMenu.doWork;
                    if (frm_MainMenu != null)
                    {
                        frm_MainMenu.setdgvPos(panel_Parent.Width, panel_Parent.Height);
                    }
                    ExcelHelper.Start();
                    frm_MainMenu.refresh("");
                    toolStrip2.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStrip2_ItemClicked);
                    unInit = false;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("数据库连接异常!");
            }
        }