public static ProcessEntity?CreateProcess(FileTypeSymbol?fileType = null) { using (Transaction tr = new Transaction()) { var query = Database.Query <PrintLineEntity>() .Where(a => a.State == PrintLineState.ReadyToPrint); if (fileType != null) { query = query.Where(a => a.File.FileType == fileType); } if (query.Count() == 0) { return(null); } var package = new PrintPackageEntity() { Name = fileType?.ToString() + " (" + query.Count() + ")" }.Save(); query.UnsafeUpdate() .Set(a => a.Package, a => package.ToLite()) .Set(a => a.State, a => PrintLineState.Enqueued) .Execute(); var result = ProcessLogic.Create(PrintPackageProcess.PrintPackage, package).Save(); return(tr.Commit(result)); } }
public void Execute(ExecutingProcess executingProcess) { PrintPackageEntity package = (PrintPackageEntity)executingProcess.Data !; executingProcess.ForEachLine(package.Lines().Where(a => a.State != PrintLineState.Printed), line => { PrintLineGraph.Print(line); }); }
public static IQueryable <PrintLineEntity> Lines(this PrintPackageEntity e) { return(LinesExpression.Evaluate(e)); }
public static IQueryable <PrintLineEntity> Lines(this PrintPackageEntity e) => As.Expression(() => Database.Query <PrintLineEntity>().Where(a => a.Package.Is(e)));