예제 #1
0
        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));
            }
        }
예제 #2
0
            public void Execute(ExecutingProcess executingProcess)
            {
                PrintPackageEntity package = (PrintPackageEntity)executingProcess.Data !;

                executingProcess.ForEachLine(package.Lines().Where(a => a.State != PrintLineState.Printed), line =>
                {
                    PrintLineGraph.Print(line);
                });
            }
예제 #3
0
 public static IQueryable <PrintLineEntity> Lines(this PrintPackageEntity e)
 {
     return(LinesExpression.Evaluate(e));
 }
예제 #4
0
 public static IQueryable <PrintLineEntity> Lines(this PrintPackageEntity e) =>
 As.Expression(() => Database.Query <PrintLineEntity>().Where(a => a.Package.Is(e)));