Beispiel #1
0
        //note that if the interval id passed through is null, it returns the whole shift.
        public static Cycle[] SelectByInterval(
            string operation,
            DateTime dateOp,
            string shift,
            string tabKey,
            ProductionEntryInterval entryInterval,
            ColumnFilter[] filters,
            SortBy[] sortBy)
        {
            if (entryInterval == null)
            {
                return(Select(operation, dateOp, shift, tabKey, filters, sortBy));
            }

            using (var connection = Utility.GetConnection <Cycle> ()) {
                var list = new SelectAll <Cycle> ()
                           .WherePropertyEquals("Operation", operation)
                           .WherePropertyEquals("DateOp", dateOp)
                           .WherePropertyEquals("Shift", shift)
                           .WherePropertyBetween("DateTimeStart", entryInterval.IntervalStartUtc, entryInterval.IntervalEndUtc)
                           .WherePropertyEquals("DataEntryTab", tabKey)
                           .WherePropertyEquals("Datasource", DatasourceValidator.ManualEntry);

                ColumnFilter[] unknownFilters;
                GridHelpers.ApplyFiltersToSelectAll(list, new [] { new UnitHierarchyImplementation(new [] { operation }) }, filters, out unknownFilters);
                GridHelpers.ApplySortByToSelectAll(list, sortBy, "DateTimeModified");

                return(list.Execute(connection));
            }
        }
Beispiel #2
0
        //note that if intervalid is null, it should select the whole shift
        public static Cycle[] Select(string operation, DateTime dateOp, string shift, ProductionEntryInterval entryInterval)
        {
            if (entryInterval == null)
            {
                return(Select(operation, dateOp, shift));
            }

            using (var connection = Utility.GetConnection <Cycle> ()) {
                return(new SelectAll <Cycle> ()
                       .WherePropertyEquals("Operation", operation)
                       .WherePropertyBetween("DateTimeStart", entryInterval.IntervalStartUtc, entryInterval.IntervalEndUtc)
                       .WherePropertyEquals("Datasource", DatasourceValidator.ManualEntry)
                       .Execute(connection));
            }
        }