/// <summary> /// 資料個數取得 /// </summary> /// <param name="option">資料查詢參數</param> /// <param name="condition">查詢條件</param> /// <param name="parms">其他傳入參數</param> /// <returns></returns> public int GetCount(QueryOption option, T condition = null, params string[] parms) { var context = QueryContextFactory.CreateInstance <T>(option); DataQuery(context.Main, option, condition, parms); return(context.GetCount()); }
/// <summary> /// 實體集合取得 /// </summary> /// <param name="option">資料查詢參數</param> /// <param name="condition">查詢條件</param> /// <param name="parms">其他傳入參數</param> /// <returns></returns> public IEnumerable <T> GetList(QueryOption option, T condition = null, params string[] parms) { var context = QueryContextFactory.CreateInstance <T>(option); DataQuery(context.Main, option, condition, parms); DataPagerSort(context.Main, option); return(context.GetEntities()); }
/// <summary> /// 待通知檢查監控資訊清單取得 /// </summary> /// <returns></returns> public IEnumerable <Monitor> GetNotificationMonitors() { var context = QueryContextFactory.CreateInstance <Monitor>(); var condition = new QueryCondition { PropertyName = "IS_NOTIFICATION", Type = OperatorType.ISNULL }; context.Main.Query("IS_NOTIFICATION", OperatorType.ISNULL, new List <object>()); return(context.GetEntities()); }
/// <summary> /// 通知記錄取得 /// </summary> /// <param name="condition">查詢條件</param> /// <returns></returns> public Notification GetRecord(Notification condition) { var context = QueryContextFactory.CreateInstance <Notification>(); var orders = new List <UserOrder> { new UserOrder { PropertyName = "NOTIFICATION_SN", Type = OrderType.DESC } }; context.Main.Query(condition) .OrderBy(orders) .Pager(1, 1); return(context.GetEntity()); }
/// <summary> /// 前次監控資訊取得 /// </summary> /// <param name="monitor">目前監控資訊</param> /// <returns></returns> public Monitor GetPreviousMonitor(Monitor monitor) { var context = QueryContextFactory.CreateInstance <Monitor>(); var condition = new Monitor { DEVICE_SN = monitor.DEVICE_SN, TARGET_NAME = monitor.TARGET_NAME }; var query = new List <QueryCondition> { new QueryCondition { PropertyName = "RECORD_SN", Type = OperatorType.LessThan, Values = new List <object> { monitor.RECORD_SN } } }; var orders = new List <UserOrder> { new UserOrder { PropertyName = "RECORD_SN", Type = OrderType.DESC } }; context.Main.Query(condition) .UserQuery(query) .OrderBy(orders) .Pager(1, 1); return(context.GetEntity()); }