Пример #1
0
        static void Main(string[] args)
        {
            TypeQueryField<DateTime> q = new TypeQueryField<DateTime>("date");
            CAMLExpression<object> exp = q.LessEqual(DateTime.Now);
            exp &= q.MoreEqual(DateTime.Now.AddDays(-1));

            string rs=CAMLBuilder.Where(exp);
        }
Пример #2
0
        private void TRReportDataBind(DateTime dateFrom, DateTime dateTo)
        {
            SPList travelRequestList = SPContext.Current.Web.Lists[WorkflowListName.TravelRequestWorkflow2];
            TypeQueryField<DateTime> queryField = new TypeQueryField<DateTime>("Created");

            //SPUtility.FormatDate(SPContext.Current.Web, dateFrom, SPDateFormat.DateOnly)
            CAMLExpression<object> exp = queryField.MoreEqual(dateFrom);

            exp &= queryField.LessEqual(dateTo);

            SPQuery query = new SPQuery();
            query.Query = CAMLBuilder.Where(exp);

            SPListItemCollection items = travelRequestList.GetItems(query);

            if (items.Count > 0)
            {
                SPGridView1.DataSource = GetDataSource(items);
            }
            else
            {
                SPGridView1.DataSource = null;
            }
            SPGridView1.DataBind();
        }