コード例 #1
0
        /// <summary>
        /// 執行單個排程;只添加日誌
        /// </summary>
        /// <param name="schedule_api"></param>
        /// <param name="schedule_code"></param>
        /// <returns></returns>
        public bool ExeScheduleService(string schedule_api,string schedule_code)
        {
            bool result = false;
            try
            {
                //執行排程
                string path = System.Web.HttpContext.Current.Server.MapPath(xmlPath);
                SiteConfigMgr _siteConfigMgr = new SiteConfigMgr(path);
                BLL.gigade.Model.SiteConfig NETDoMain_Name = _siteConfigMgr.GetConfigByName("NETDoMain_Name");

                string api = "http://" + NETDoMain_Name.Value + "/" + schedule_api + "?schedule_code=" + schedule_code; ;
                _secheduleServiceMgr = new ScheduleServiceMgr(mySqlConnectionString);
                result = _secheduleServiceMgr.ExeScheduleService(api);
                if (result)
                {
                    //添加排程日誌
                    ScheduleAddLog(schedule_code);
                }
                
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }
            return result;
        }