Esempio n. 1
0
 public static SqlConnection getConnectionStr()
 {
     address = CallUpdate.GetLocation();
     if (address.Substring(0, 2) == "TW")
     {
         connectionString =
             "Data Source=10.20.86.68;Initial Catalog=WKE10;Persist Security Info=True;User ID=workday;Password=workday;";
     }
     else
     {
         connectionString =
             "Data Source=172.16.1.28;Initial Catalog=NJE10;Persist Security Info=True;User ID=sa;Password=518518;";
     }
     return(new SqlConnection(connectionString));
 }
Esempio n. 2
0
        //取得機碼執行檔路徑

        //autoUpdate
        public static void autoUpdate()
        {
            if (CallUpdate.GetServerExePath("VSTool") != "")
            {
                if (File.Exists(CallUpdate.GetServerExePath("VSTool")))
                {
                    if (CallUpdate.CompareFileLastWritedate(Application.ExecutablePath,
                                                            CallUpdate.GetServerExePath("VSTool")))
                    {
                        if (File.Exists(CallUpdate.GetServerExePath("WFLiveUpdate")))
                        {
                            if (File.Exists(Environment.CurrentDirectory + @"\WFLiveUpdate.exe"))
                            {
                                File.SetAttributes(Environment.CurrentDirectory + @"\WFLiveUpdate.exe",
                                                   FileAttributes.Normal);
                            }
                            File.Copy(CallUpdate.GetServerExePath("WFLiveUpdate"),
                                      Environment.CurrentDirectory + @"\WFLiveUpdate.exe", true);
                            if (File.Exists(Environment.CurrentDirectory + @"\WFLiveUpdate.exe"))
                            {
                                //string lpParameters = "";
                                ////取得From路徑
                                //lpParameters = lpParameters + VSTool.CallUpdate.GetServerExePath("VSTool").Replace(" ", "§") + " ";
                                ////取得TO路徑
                                //lpParameters = lpParameters + Application.ExecutablePath.Replace(" ", "§") + " ";
                                //VSTool.CallUpdate.CallExe(0, Environment.CurrentDirectory + @"\WFLiveUpdate.exe", lpParameters);
                                //Environment.Exit(Environment.ExitCode);
                                //Thread.Sleep(5000);
                            }
                        }
                    }
                }
            }
            else
            {
                //
                MessageBox.Show("您的機器尚未執行過登錄檔,請先執行登錄檔才可使用工具!");
                Environment.Exit(Environment.ExitCode);
                //Exit;
            }
        }