/// <summary>
        /// Start synchronised data between OA & MDB
        /// </summary>
        public void Start(int?userId)
        {
            if (!string.IsNullOrEmpty(oaConnectionString) && !string.IsNullOrEmpty(mdbConnectionString) && !string.IsNullOrEmpty(logFilePath))
            {
                SynchOAData.Start(oaConnectionString, mdbConnectionString, logFilePath, userId);

                if (SynchOAData.IsError)
                {
                    throw new ApplicationException("Synchronisation completed with error. Please check log file");
                }
            }
            else
            {
                throw new ApplicationException("Parameter can not be null..");
            }
        }
Exemple #2
0
 /// <summary>
 /// Start synchronisation of OA & MDB data
 /// </summary>
 /// <param name="oaConnectionString"></param>
 /// <param name="mdbConnectionString"></param>
 /// <param name="logFilePath"></param>
 /// <param name="hour"></param>
 private static void Run(string oaConnectionString, string mdbConnectionString, string logFilePath, int hour)
 {
     try
     {
         if (hour < 24 && hour > 0)
         {
             if (!string.IsNullOrEmpty(oaConnectionString) && !string.IsNullOrEmpty(mdbConnectionString))
             {
                 if (DateTime.Now.Hour == hour)
                 {
                     SynchOAData.Start(oaConnectionString, mdbConnectionString, logFilePath, -1);
                 }
             }
         }
         else
         {
             WriteLog("Please enter valid Hour. Hour should be in 24 hour datetime format.", logFilePath);
         }
     }
     catch (Exception e)
     {
         WriteLog(e.Message, logFilePath);
     }
 }