示例#1
0
        /// <summary>
        /// 执行存储过程
        /// </summary>
        /// <param name="ReferSql">调用存储过程语句</param>
        /// <return>DataTable</return>
        //---------------------------------------------------------------------------------------
        //   1.ID           : Gp_MsgBoxDisplay
        //   2.Input  Value : sMsg String, {sIcon String}, {sTitle String}
        //   3.Return Value :
        //   4.Create Date  :
        //   5.Modify Date  :
        //   6.Comment      : Message Box Only Display
        //---------------------------------------------------------------------------------------
        public static DataTable Gf_ExecProc2Ref(string ReferSql)
        {
            DataTable DataTab_temp = new DataTable();

            if (GeneralCommon.OleDbConn.State == 0)
            {
                if (GeneralCommon.GF_DbConnect() == false)
                {
                    return(DataTab_temp);
                }
            }

            try
            {
                GeneralCommon.Gp_LogData(ReferSql);
                OleDbDataAdapter OleDA = new OleDbDataAdapter(ReferSql, OleDbConn);
                OleDA.Fill(DataTab_temp);
                return(DataTab_temp);
            }
            catch (Exception ex)
            {
                Gp_MsgBoxDisplay("Gf_ExecProc2Ref Error : " + ex.Message);
                return(DataTab_temp);
            }

            finally
            {
                if (GeneralCommon.OleDbConn.State != 0)
                {
                    GeneralCommon.OleDbConn.Close();
                }
            }
        }
示例#2
0
        private void DownLoadMain_Load(object sender, System.EventArgs e)
        {
            try
            {
                GeneralCommon.Gp_LogTxt("DownLoad DownLoadMain_Load 00");
                sExePath        = System.IO.Directory.GetCurrentDirectory() + "\\";
                this.KeyPreview = true;
                GeneralCommon.Gp_FormCenter(this);

                // Sets the timer interval to 5 seconds.
                Timer_Conut.Interval = 1000;
                Timer_Conut.Start();
            }
            catch (Exception ex)
            {
                GeneralCommon.Gp_LogData("DownLoadMain_Load " + ex.Message);
            }
        }
示例#3
0
        /// <summary>
        /// 查找代码
        /// </summary>
        /// <param name="sQuery">查询语句</param>
        /// <return>string</return>
        public static string Gf_CodeFind(string sQuery)
        {
            string functionReturnValue = "";

            try
            {
                if (GF_DbConnect() == false)
                {
                    return("");
                }
                GeneralCommon.Gp_LogData(sQuery);
                OleDbCommand oc = new OleDbCommand(sQuery, OleDbConn);
                functionReturnValue = oc.ExecuteScalar().ToString();
                return(functionReturnValue);
            }
            catch (Exception ex)
            {
                Gp_MsgBoxDisplay("Gf_CodeFind Error : " + ex.Message);
                return("");
            }
        }
示例#4
0
        //==============================================================================================
        // Procedure Name : DownLoad_File
        // Description : 下载所有更新文件
        //==============================================================================================
        private bool DownLoad_File(ArrayList WinId)
        {
            //return true;
            bool functionReturnValue = false;

            if (MainMenu_Check())
            {
                if (MessageBox.Show("检验室程序正在运行,是否要关闭?关闭前请保存当前操作以免丢失数据。", "更新提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    Process[] myProcess = null;
                    myProcess = Process.GetProcessesByName(ProcessesName);
                    foreach (Process myPro in myProcess)
                    {
                        myPro.Kill();
                    }
                }
                else
                {
                    return(true);;
                }
            }

            if (WinId == null)
            {
                return(true);
            }



            string sQuery     = null;
            int    i          = 0;
            string Client_Ver = null;
            string Server_Ver = null;


            FILE_SIZE = 0;



            functionReturnValue = false;

            try
            {
                //check ftp server info
                if (string.IsNullOrEmpty(sServerIP) | string.IsNullOrEmpty(sServerID) | string.IsNullOrEmpty(sServerPWD) | string.IsNullOrEmpty(sServerPATH)) //
                {
                    GeneralCommon.Gp_MsgBoxDisplay("FTP服务器信息不存在...!!", "W");
                    return(false);
                }

                Cursor.Current = Cursors.WaitCursor;
                Application.DoEvents();

                //check download folder
                if (!System.IO.Directory.Exists(sExePath))
                {
                    System.IO.Directory.CreateDirectory(sExePath);
                }


                this.pic_Close.Visible = false;
                Label1.Visible         = true;
                Label1.Text            = "程序更新中,请勿关闭";

                for (i = 0; i < WinId.Count; i++)
                {
                    //Server Version
                    sQuery     = "{call PKG_MAIN.P_FIND_VER('" + WinId[i] + "')}";
                    Server_Ver = GeneralCommon.Gf_CodeFind(sQuery);

                    //Client Version
                    Client_Ver = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\" + RegLocation + @"\VERSION\").GetValue(WinId[i].ToString(), "0.0.0").ToString();// Interaction.GetSetting("CYEDM", "VERSION", WinId[i], "0.0.0");

                    if (Server_Ver != Client_Ver | !System.IO.File.Exists(sExePath + WinId[i]))
                    {
                        //Client File Delete
                        if (System.IO.File.Exists(sExePath + WinId[i]))
                        {
                            System.IO.File.Delete(sExePath + WinId[i]);
                        }
                        int    point   = WinId[i].ToString().LastIndexOf(@"\");
                        string spath   = sExePath;
                        string sysname = "";
                        if (point > 0)
                        {
                            spath = sExePath + WinId[i].ToString().Substring(0, point);
                            if (System.IO.Directory.Exists(spath) == false)
                            {
                                System.IO.Directory.CreateDirectory(spath);// FileSystem.MkDir(spath);
                            }
                            sysname = WinId[i].ToString().Substring(point + 1);
                        }
                        FTPClient ftp = new FTPClient(sServerIP, sServerPATH, sServerID, sServerPWD, sServerPORT);
                        if (ftp.Get(WinId[i].ToString(), sExePath, WinId[i].ToString()))
                        {
                            Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\" + RegLocation + @"\VERSION\").SetValue(WinId[i].ToString(), Server_Ver);
                        }
                        else
                        {
                            GeneralCommon.Gp_MsgBoxDisplay("下载文件出错 : " + ftp.strReply);
                            GeneralCommon.Gp_LogData(WinId[i].ToString() + " " + ftp.strReply);
                        }
                    }
                }

                PrgDown.Visible   = false;
                pic_Close.Visible = true;

                Label1.Visible      = false;
                functionReturnValue = true;
                Cursor.Current      = Cursors.Default;

                Application.DoEvents();
            }
            catch (Exception ex)
            {
                PrgDown.Visible = false;

                GeneralCommon.Gp_MsgBoxDisplay("下载文件 Error : " + ex.Message);

                Cursor.Current = Cursors.Default;

                Application.DoEvents();
            }

            return(functionReturnValue);
        }