using com.hnshituo.core.webapp.vo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common
{
    public class MeterWorkStaticMonitorService
    {
        public RESTfulResult<List<MeterWorkStaticMonitor>> doQueryWf(MeterWorkStaticMonitor info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<MeterWorkStaticMonitor>>> rm = db.doOption<PageList<List<MeterWorkStaticMonitor>>>("meterworkstaticmonitors", "/", new object[] { info }, 0);

            RESTfulResult<List<MeterWorkStaticMonitor>> result = new RESTfulResult<List<MeterWorkStaticMonitor>>();
            result.Succeed = rm.Succeed;
            result.Status = rm.Status;
            result.Message = rm.Message;
            result.ResultMessage = rm.ResultMessage;
            result.Code = rm.Code;
            if (rm.Succeed && rm.Data != null && rm.Data.list != null)
            {
                PbStaticRailwayCache.ltMonitor = rm.Data.list;
                result.Data = rm.Data.list;
            }
            else
            {
                PbCache.monitor = new MeterWorkMonitor();
            }
            return result;
        }

        /// <summary>
        /// 修改
        /// </summary>
        public RESTfulResult<string> doUpdateWf(MeterWorkStaticMonitor info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<string> rm = db.doOption<string>("meterworkstaticmonitors", "doUpdateWf", new object[] { info }, 1);
            return rm;
        }
    }
}
