Exemplo n.º 1
0
        /// <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();
            }

        }
Exemplo n.º 2
0
        public ActionResult GetTiersByConditon(ScheduleQuery sc)
        {
            try
            {
                string vendor_id = Request["vendorId"] == null ? "0" : Request["vendorId"];
                string product_id = Request["product_id"] == null ? "" : Request["product_id"];
                IScheduleItemImplMgr _scheduleItemMgr = new ScheduleItemMgr(connectionString);
                List<ScheduleItemCustom> list = _scheduleItemMgr.QueryByCondition(new ScheduleItem { type = 1 });
                List<ScheduleItemCustom> resultList = new List<ScheduleItemCustom>();
                
                if (product_id != "")
                {
                    ///eidt by wwei0216w 2018/9/27 添加對schedule_name的判斷,防止錯誤數據造成 排程選中時的空白選項
                    list = list.FindAll(m => m.key1 == 1&& m.schedule_name!="");
                    if (list.Count > 0)
                    {
                        list = list.FindAll(m => m.value1 == vendor_id);
                    }
                }

                resultList.AddRange(list);
                IsoDateTimeConverter iso = new IsoDateTimeConverter() { DateTimeFormat = "yyyy/MM/dd" };
                return Content(JsonConvert.SerializeObject(resultList, 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();
            }

        }