//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)); } }
public static Cycle[] SelectByIntervalShift( string operation, ShiftInterval shiftInterval, string tabKey, ColumnFilter[] filters, SortBy[] sortBy) { using (var connection = Utility.GetConnection <Cycle> ()) { var list = new SelectAll <Cycle> () .WherePropertyEquals("Operation", operation) .WherePropertyEquals("DateOp", shiftInterval.DateOp) .WherePropertyEquals("Shift", shiftInterval.Shift) .WherePropertyBetween("DateTimeStart", shiftInterval.GetIntervalStartTimeUtc(operation), shiftInterval.GetIntervalEndTimeUtc(operation)) .WherePropertyEquals("DataEntryTab", tabKey) .WherePropertyEquals("Datasource", DatasourceValidator.ManualEntry); GridHelpers.ApplyFiltersToSelectAll( list, new [] { new UnitHierarchyImplementation(new [] { operation }) }, filters, out ColumnFilter[] unknownFilters); GridHelpers.ApplySortByToSelectAll(list, sortBy, "DateTimeModified"); return(list.Execute(connection)); } }
public static Cycle[] SelectByPrimaryKey(DateTime dateTimestart, string operation, string loader, string hauler, string loaderOperatorId, string haulerOperatorId, string origin, string destination, string material, DateTime dateop) { using (var connection = Utility.GetConnection <Cycle> ()) { var list = new SelectAll <Cycle> () .WherePropertyEquals("Operation", operation) .WherePropertyEquals("Loader", loader) .WherePropertyEquals("Hauler", hauler) .WherePropertyEquals("LoaderOperatorId", loaderOperatorId) .WherePropertyEquals("HaulerOperatorId", haulerOperatorId) .WherePropertyEquals("Origin", origin) .WherePropertyEquals("Destination", destination) .WherePropertyEquals("Material", material) .WherePropertyEquals("DateOp", dateop); return(list.Execute(connection)); } }