public Response GetToNextWorkingDay(string token, [FromBody] GetToNextWorkingDayParam param)
        {
            Response response = new Response();

            if (string.IsNullOrEmpty(token) || !token.Equals(_token))
            {
                response.code    = "404";
                response.message = "Invild token";
            }
            else
            {
                List <SingleField> lstResult = CalendarHelper.GetToNextWorkingDay(param);
                if (lstResult.Count == 0)
                {
                    response.code    = "500";
                    response.message = "No Data";
                }
                else
                {
                    response.code    = "200";
                    response.content = lstResult;
                }
            }
            return(response);
        }
Beispiel #2
0
        /// <summary>
        /// 取得至下个工作日的所有日期 + weekday中文
        /// </summary>
        /// <param name="strDate"></param>
        /// <param name="strCostCenterCode"></param>
        /// <returns></returns>
        public List <SingleField> GetToNextWorkingDay(GetToNextWorkingDayParam param)
        {
            if (string.IsNullOrWhiteSpace(param.date) || string.IsNullOrWhiteSpace(param.costCenterCode))
            {
                return(null);
            }

            List <SingleField> lstResult = new List <SingleField>();
            DateTime           dateTemp  = Convert.ToDateTime(param.date);
            DateTime           endDate   = (new CalendarFactory()).GetNextWorkingDay(dateTemp, param.costCenterCode);

            dateTemp = dateTemp.AddDays(1);

            while (dateTemp <= endDate)
            {
                SingleField sf = new SingleField();

                sf.date    = DateCommon.convertDateTime(dateTemp, "yyyy-MM-dd");
                sf.weekDay = DateCommon.ToWeekDay(dateTemp, param.lang, param.formatString);

                lstResult.Add(sf);

                dateTemp = dateTemp.AddDays(1);
            }
            return(lstResult);
        }
 /// <summary>
 /// 取得至下个工作日的所有日期 + weekday中文
 /// </summary>
 /// <param name="strDate"></param>
 /// <param name="strCostCenterCode"></param>
 /// <returns></returns>
 public static List <SingleField> GetToNextWorkingDay(GetToNextWorkingDayParam param)
 {
     try
     {
         List <SingleField> lstResult = CalendarFactory.GetToNextWorkingDay(param);
         if (lstResult.Count == 0)
         {
             throw new Exception("DAL.MastData.CalendarFactory.GetToNextWorkingDay()==null");
         }
         return(lstResult);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(new Log()
         {
             message = ex.Message
         }, "GetToNextWorkingDayParam");
         return(null);
     }
 }