Пример #1
0
        static void MainThread()
        {
            try
            {
                //check status db
                if (!StatusRefresh.CheckStatusDBConnect(projectid))
                {
                    Console.WriteLine("Can not connect datacake db or project ID is not exists! The process status will not update!");
                }
                else
                {
                    CanUpdateStatus = true;
                }

                //init target db;

                MysqlClass.InitDatabasePara(DataBaseName);

                if (MysqlClass.ConnectDb() == null)
                {
                    Console.WriteLine("Can not connect target database,please check setting! press any key to exit!");
                    Logging.LogStop();
                    return;
                }

                //check logfile

                string        logfoldname = ConfigurationManager.AppSettings["LogFoldName"];
                string        folderpath  = logpath + "\\" + logfoldname;
                DirectoryInfo di          = new DirectoryInfo(folderpath);
                if (!di.Exists)
                {
                    Console.WriteLine("Wrong Path, Try To Use Application Current Path!");
                    DirectoryInfo cdi = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "LogFoldName");
                    if (!cdi.Exists)
                    {
                        Console.WriteLine("Wrong Path, application will close!");
                        Logging.LogStop();
                        return;
                    }
                }
                CSVToDB.Process(folderpath, projectid, DataBaseName);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Logging.LogStop();
            }
            Logging.LogStop();
        }
Пример #2
0
 public static Boolean CheckStatusDBConnect(string RecordID)
 {
     try
     {
         if (MysqlClass.ConnectDb(connectstring) == null)
         {
             return(false);
         }
         string    sql = "select id,ToCLStatus, ToCLProcess, ToCLRemark from datacake.sync_datasource where id = " + RecordID;
         DataTable dt  = MysqlClass.GetDataTable(sql, "recordtable", connectstring);
         if (dt.Rows.Count > 0)
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         Logging.WriteLog("SQLERROR", e.Message + "\r\n");
         return(false);
     }
     return(false);
 }