private static string UpdateStatus(List <SyncResultRecords.SyncResult> syncResultList)
        {
            var errorMsg   = "";
            var updateList = new List <FileApi.UpdateInfo>();

            syncResultList.ForEach(e =>
            {
                updateList.Add(new FileApi.UpdateInfo
                {
                    id      = e.Id,
                    size    = e.Size,
                    status  = (e.Status.ToLower() == "failed" || e.Status.ToLower() == "exception") ? "error" : "success",
                    message = e.Message,
                });
            });

            if (updateList.Count > 0)
            {
                FileApi api = new FileApi();
                errorMsg = api.UpdateSyncStatus(updateList);
            }
            return(errorMsg);
        }
        static void Main(string[] args)
        {
            try
            {
                Setting.SetConfigureSettings();
                Setting.SetScheduleStartTime();
                Setting.SetScheduleID(Time.GetNow(Time.TimeFormatType.YearMonthDayHourMinute));
                Log.WriteLog("#######################################################################");
                Log.WriteLog("Schedule Start.");
                SyncResultRecords.Init();

                var isScheduleReady = CheckScheduleReady("DownloadCenter");
                if (!isScheduleReady)
                {
                    Log.WriteLog("Waiting for anoher schedule is finish", Log.Type.Failed);
                    Setting.SetSyncResultMessage(
                        "<font color = \"#c61919\" size = \"2\" face = \"Verdana, sans-serif\">"
                        + "Waiting for anoher schedule is finish</font>");
                }
                else
                {
                    //1.取SourceSata資料
                    var    api        = new FileApi();
                    JArray syncDatas  = null;
                    JArray storages   = null;
                    var    sourceData = api.GetSyncData();
                    if (sourceData.Item1 != null)
                    {
                        syncDatas = (JArray)sourceData.Item1["syncdata"];
                        storages  = (JArray)sourceData.Item1["storages"];
                        Setting.SetAzureStorageRegion(storages);
                        //Setting.SetAzureStorageRegionCount(api.GetStorageRegionCount());
                    }

                    if (syncDatas == null || syncDatas.Count == 0)
                    {
                        Log.WriteLog("No file need to be sync");
                        Setting.SetSyncResultMessage(
                            "<font color = \"#4A72A2\" size = \"2\" face = \"Verdana, sans-serif\">"
                            + "No file need to be sync </font>");
                    }
                    else if (string.IsNullOrEmpty(Setting.RuntimeSettings.SyncAzureStorageRegion))
                    {
                        Log.WriteLog("Not get azure storage setting", Log.Type.Failed);
                        Setting.SetSyncResultMessage(
                            "<font color = \"#c61919\" size = \"2\" face = \"Verdana, sans-serif\">"
                            + "Not get azure storage setting</font>");
                    }
                    else
                    {
                        //2.登入StoreSimple
                        var cmd     = new NetCommand();
                        var isLogin = cmd.ExeLoginCmd();
                        if (!isLogin)
                        {
                            Log.WriteLog("Not login server " + Setting.Config.TargetServerIP, Log.Type.Failed);
                            Setting.SetSyncResultMessage(
                                "<font color = \"#c61919\" size = \"2\" face = \"Verdana, sans-serif\">"
                                + "Not login server " + Setting.Config.TargetServerIP + "</font>");
                        }
                        else
                        {
                            //3. Sync data
                            SyncData(syncDatas, storages);
                            if (SyncResultRecords.All().Count > 0)
                            {
                                Setting.SetSyncResultMessage(GenerateResultMessage());
                            }
                        }
                    }
                }

                Setting.SetScheduleFinishTime();
                var mail = new Mail();
                mail.sendMail();
                Log.WriteLog("Schedule Finish");
            }
            catch (Exception e)
            {
                Log.WriteLog(e.Message, Log.Type.Exception);
            }
        }