/// <summary>
        /// 保存數據
        /// </summary>
        /// <param name="fst"></param>
        /// <returns></returns>
        public ActionResult TierSetSave(Schedule fst)
        {

            try
            {
                _fstMgr = new ScheduleMgr(connectionString);
                fst.create_user = (Session["caller"] as Caller).user_id;
                fst.create_date = DateTime.Now;
                bool result = _fstMgr.Save(fst);
                return Json(new { success = result });
            }
            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 View();
        }
        /// <summary>
        /// 查詢排程
        /// </summary>
        /// <param name="sc"></param>
        /// <returns></returns>
        public ActionResult GetTiers(ScheduleQuery sc)
        {
            try
            {
                int vendor_id = Request["vendorId"] == null ? 0:int.Parse(Request["vendorId"]);
                string product_id = Request["product_id"] == null ? "" : Request["product_id"];
                List<Schedule> list = new List<Schedule>();
                _fstMgr = new ScheduleMgr(connectionString);
                list = _fstMgr.Query(sc);
                IsoDateTimeConverter iso = new IsoDateTimeConverter() { DateTimeFormat = "yyyy/MM/dd" };
                return Content(JsonConvert.SerializeObject(list, Formatting.None, iso));
            }
            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 new EmptyResult();
            }

        }
 /// <summary>
 /// 加載類型relevantStore
 /// </summary>
 public ActionResult relevantStore()
 {
     try
     {
         int scheduleid = Request["schedule_id"] == null ? 0 : int.Parse(Request["schedule_id"]);//key的值
         string xmlPath = Server.MapPath("../XML/ParameterSrc.xml");
         _scheduleItemMgr = new ScheduleItemMgr(connectionString);
         List<ScheduleItemCustom> list = _scheduleItemMgr.Query(new ScheduleItem { schedule_Id=scheduleid});
         _fstMgr = new ScheduleMgr(connectionString);
         List<Parametersrc> typeList = _fstMgr.GetRelevantInfo(xmlPath, "ScheduleType");
         List<Parametersrc> keyList = _fstMgr.GetRelevantInfo(xmlPath, "Schedule_Key");
         foreach (ScheduleItemCustom i in list)
         {
             i.keyStr = keyList.Find(m=>m.ParameterCode==i.key1.ToString()).parameterName;
             i.tabType = typeList.Find(m=>m.ParameterCode==i.type.ToString()).parameterName;
         }
         return Json(list);
     }
     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 Json(new { success = false });
     }
 }
 public ActionResult GetValueInfo()
 {
     try
     {
         int keyType =Request["keyType"]==null ? 0: int.Parse(Request["keyType"]);//key的值
         keyType = 1;
         _fstMgr = new ScheduleMgr(connectionString);
         return Json(_fstMgr.GetValue(keyType));
         
     }
     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 Json(new { success = false });
     }
 }
 public ActionResult GetRelevantType()
  {
     try
     {
         string type = Request["type"];
         string xmlPath = Server.MapPath("../XML/ParameterSrc.xml");
         _fstMgr = new ScheduleMgr(connectionString);
         return Json(_fstMgr.GetRelevantInfo(xmlPath, type));
     }
     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 Json(new { success = false });
     }
 }
 public ActionResult DeleteTires(string rowID)
 {
     try
     {
         int[] ids = (from i in rowID.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries) select int.Parse(i)).ToArray();
         _fstMgr = new ScheduleMgr(connectionString);
         _fstMgr.Delete(ids);
         return Json(new { success = true });
     }
     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 Json(new { success = false });
     }
 }