Exemple #1
0
        public UnifiedProcessStatus UpdateJob(UnifiedResponse.UnifiedProcessStatus processState, ExecutionStatus AssetState, ExecutionStatus JobState, string JobStateDetails, ExecutionStatus watermarkState, string WaterMarkCopiesStatusDetails)
        {
            processState.AssetStatus.State = AssetState;

            processState.JobStatus.State   = JobState;
            processState.JobStatus.Details = JobStateDetails;
            switch (processState.JobStatus.State)
            {
            case ExecutionStatus.Finished:
            case ExecutionStatus.Error:
            case ExecutionStatus.Aborted:
                processState.JobStatus.FinishTime = DateTime.Now;
                processState.JobStatus.Duration   = DateTime.Now.Subtract(processState.JobStatus.StartTime);
                break;
            }
            foreach (var watermaekAssetInfo in processState.EmbebedCodesList)
            {
                watermaekAssetInfo.State   = watermarkState;
                watermaekAssetInfo.Details = WaterMarkCopiesStatusDetails;
            }

            UpdateUnifiedProcessStatus(processState);

            return(processState);
        }
Exemple #2
0
 public UnifiedResponse.UnifiedProcessStatus GetUnifiedProcessStatus(string AssetId, string JobID)
 {
     UnifiedResponse.UnifiedProcessStatus Manifest = new UnifiedResponse.UnifiedProcessStatus
     {
         AssetStatus      = GetAssetStatus(AssetId),
         JobStatus        = GetJobStatus(AssetId, JobID),
         EmbebedCodesList = new List <UnifiedResponse.WaterMarkedAssetInfo>()
     };
     foreach (var ecode in Manifest.JobStatus.EmbebedCodeList)
     {
         Manifest.EmbebedCodesList.Add(GetWaterMarkedAssetInfo(AssetId, ecode));
     }
     return(Manifest);
 }
Exemple #3
0
        public void UpdateUnifiedProcessStatus(UnifiedResponse.UnifiedProcessStatus curretnData)
        {
            //Update Asset
            var asset = curretnData.AssetStatus;

            UpdateAssetStatus(asset);
            //Update JobInformation
            TableOperation InsertOrReplace = TableOperation.InsertOrReplace(new UnifiedResponse.TJobStatus(curretnData.JobStatus, curretnData.AssetStatus.AssetId));

            _ProcessStatusTable.Execute(InsertOrReplace);
            //Update all Enbebed
            foreach (var data in curretnData.EmbebedCodesList)
            {
                UpdateWaterMarkedAssetInfo(data, curretnData.AssetStatus.AssetId);
            }
        }
Exemple #4
0
        public UnifiedResponse.UnifiedProcessStatus StartNewProcess(string AssetId, string JobId, string[] EmbebedCodeList)
        {
            //NEW Process
            UnifiedResponse.UnifiedProcessStatus newProcess = new UnifiedResponse.UnifiedProcessStatus
            {
                EmbebedCodesList = new List <UnifiedResponse.WaterMarkedAssetInfo>(),
                //2. JobStatus
                JobStatus = new UnifiedResponse.JobStatus()
                {
                    Details         = "Queue",
                    Duration        = null,
                    FinishTime      = null,
                    JobID           = JobId,
                    StartTime       = DateTime.Now,
                    State           = ExecutionStatus.Running,
                    EmbebedCodeList = EmbebedCodeList
                },

                AssetStatus = GetAssetStatus(AssetId) ?? new UnifiedResponse.AssetStatus()
                {
                    AssetId = AssetId, State = ExecutionStatus.New
                }
            };

            //Status
            ExecutionStatus EmbebedStatus = ExecutionStatus.New;

            switch (newProcess.AssetStatus.State)
            {
            case ExecutionStatus.Error:
                newProcess.JobStatus.State      = ExecutionStatus.Error;
                newProcess.JobStatus.Details    = "Invalid Asset becouse MMRK Files Generation failed";
                newProcess.JobStatus.FinishTime = DateTime.Now;
                newProcess.JobStatus.Duration   = DateTime.Now.Subtract(newProcess.JobStatus.StartTime);
                EmbebedStatus = ExecutionStatus.Aborted;

                break;

            case ExecutionStatus.Running:
                newProcess.JobStatus.Details    = "Already MMRK Files Generation Runnig";
                newProcess.JobStatus.State      = ExecutionStatus.Error;
                newProcess.JobStatus.FinishTime = DateTime.Now;
                newProcess.JobStatus.Duration   = DateTime.Now.Subtract(newProcess.JobStatus.StartTime);
                EmbebedStatus = ExecutionStatus.Aborted;

                break;

            case ExecutionStatus.New:
            case ExecutionStatus.Finished:

                if (newProcess.AssetStatus.State == ExecutionStatus.New)
                {
                    //New Asset
                    //Asset has not oter process running
                    newProcess.AssetStatus.State = ExecutionStatus.Running;
                    EmbebedStatus = ExecutionStatus.Running;
                    newProcess.JobStatus.State = ExecutionStatus.Running;
                }
                else
                {
                    //Asset  Ready
                    //Is another process running for this Asset??
                    if (AssetIsRunningAnyProcess(AssetId))
                    {
                        //Already Running a process
                        newProcess.JobStatus.Details    = "Asset ready but another process is running on asset";
                        newProcess.JobStatus.State      = ExecutionStatus.Error;
                        newProcess.JobStatus.FinishTime = DateTime.Now;
                        newProcess.JobStatus.Duration   = DateTime.Now.Subtract(newProcess.JobStatus.StartTime);
                        EmbebedStatus = ExecutionStatus.Aborted;
                    }
                    else
                    {
                        //Asset has not other process running
                        EmbebedStatus = ExecutionStatus.Running;
                        newProcess.JobStatus.State = ExecutionStatus.Running;
                    }
                }
                break;

            default:
                break;
            }
            //Embebedecodes only if Process is Running
            if (newProcess.JobStatus.State == ExecutionStatus.Running)
            {
                foreach (var code in EmbebedCodeList)
                {
                    newProcess.EmbebedCodesList.Add(
                        new UnifiedResponse.WaterMarkedAssetInfo()
                    {
                        ParentAssetID    = AssetId,
                        State            = EmbebedStatus,
                        EmbebedCodeValue = code,
                        AssetID          = "",
                        Details          = "Just Start"
                    });
                }
            }
            UpdateUnifiedProcessStatus(newProcess);


            return(newProcess);
        }
        public UnifiedResponse.UnifiedProcessStatus StartNewProcess(string AssetId, string JobId, string[] EmbebedCodeList)
        {
            //NEW Process
            UnifiedResponse.UnifiedProcessStatus newProcess = new UnifiedResponse.UnifiedProcessStatus
            {
                EmbebedCodesList = new List <UnifiedResponse.WaterMarkedAssetInfo>(),
                //2. JobStatus
                JobStatus = new UnifiedResponse.JobStatus()
                {
                    Details         = "Queue",
                    Duration        = null,
                    FinishTime      = null,
                    JobID           = JobId,
                    StartTime       = DateTime.Now,
                    State           = ExecutionStatus.Running,
                    EmbebedCodeList = EmbebedCodeList
                },

                AssetStatus = GetAssetStatus(AssetId) ?? new UnifiedResponse.AssetStatus()
                {
                    AssetId = AssetId, State = ExecutionStatus.New
                }
            };

            //Status
            ExecutionStatus EmbebedStatus = ExecutionStatus.New;

            switch (newProcess.AssetStatus.State)
            {
            case ExecutionStatus.Error:
                newProcess.JobStatus.State      = ExecutionStatus.Error;
                newProcess.JobStatus.Details    = "MMRK Files Generation Error";
                newProcess.JobStatus.FinishTime = DateTime.Now;
                newProcess.JobStatus.Duration   = DateTime.Now.Subtract(newProcess.JobStatus.StartTime);
                EmbebedStatus = ExecutionStatus.Aborted;

                break;

            case ExecutionStatus.Running:
                newProcess.JobStatus.Details    = "MMRK Files Generation Runnig";
                newProcess.JobStatus.State      = ExecutionStatus.Error;
                newProcess.JobStatus.FinishTime = DateTime.Now;
                newProcess.JobStatus.Duration   = DateTime.Now.Subtract(newProcess.JobStatus.StartTime);
                EmbebedStatus = ExecutionStatus.Aborted;

                break;

            case ExecutionStatus.New:
            case ExecutionStatus.Finished:
                if (newProcess.AssetStatus.State == ExecutionStatus.New)
                {
                    newProcess.AssetStatus.State = ExecutionStatus.Running;
                }
                EmbebedStatus = ExecutionStatus.Running;


                newProcess.JobStatus.State = ExecutionStatus.Running;

                break;

            default:
                break;
            }
            //Embebedecodes
            foreach (var code in EmbebedCodeList)
            {
                newProcess.EmbebedCodesList.Add(
                    new UnifiedResponse.WaterMarkedAssetInfo()
                {
                    ParentAssetID    = AssetId,
                    State            = EmbebedStatus,
                    EmbebedCodeValue = code,
                    AssetID          = "",
                    Details          = "Just Start"
                });
            }

            UpdateUnifiedProcessStatus(newProcess);


            return(newProcess);
        }