添加搜索From To DateTime - AddIQueryItemSearchFromToStringDateTimeValue

2017-02-19 11:20:26  访问(1599) 赞(0) 踩(0)


        /// <summary>
        /// 添加搜索From To DateTime - AddIQueryItemSearchFromToStringDateTimeValue
        /// </summary>
        /// <param name="_info"></param>
        /// <param name="theFromValue"></param>
        /// <param name="theToValue"></param>
        public void AddIQueryItemSearchFromToStringDateTimeValue
            (
                EntityFieldInfo _info,
                string theFromValue,
                string theToValue
            )
        {
            DateTime dtValue = DateTime.MinValue;

            if (theFromValue != null && theFromValue.Length > 0)
            {
                if (DateTime.TryParse(theFromValue, out dtValue))
                {
                    m_ListIQueryItem.Add
                        (
                            new DataColumnQueryItem
                                (
                                    _info,
                                    SlowX.Core.Enums.SqlLink.EmSqlLink.GreaterEqual,
                                    dtValue
                                )
                        );
                }
            }

            if (theFromValue != null && theToValue.Length > 0)
            {
                if (DateTime.TryParse(theToValue, out dtValue))
                {
                    if (dtValue == dtValue.Date)
                    {
                        if (dtValue == DateTime.MinValue)
                        {
                            dtValue = dtValue.AddDays(1).AddSeconds(-1);
                        }
                        else
                        {
                            dtValue = dtValue.AddSeconds(-1).AddDays(1);
                        }

                        m_ListIQueryItem.Add
                            (
                                new DataColumnQueryItem
                                    (
                                        _info,
                                        SlowX.Core.Enums.SqlLink.EmSqlLink.LessEqual,
                                        dtValue
                                    )
                            );
                    }
                    else
                    {
                        m_ListIQueryItem.Add
                            (
                                new DataColumnQueryItem
                                    (
                                        _info,
                                        SlowX.Core.Enums.SqlLink.EmSqlLink.LessEqual,
                                        dtValue
                                    )
                            );
                    }
                }
            }
        }


标签:添加搜索From To DateTime - AddIQueryItemSearchFromToStringDateTimeValue 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)