Beispiel #1
0
 public static (bool IsValid, String ErrorMessage) Validate(CreateWorkloadAnalysisRequest createRequest)
 {
     if (createRequest == null)
     {
         return(false, "Input data wasn´t provided.");
     }
     else if (createRequest.WorkloadID <= 0)
     {
         return(false, "Workload identification wasn´t provided.");
     }
     else if (!(createRequest.PeriodFromDate < createRequest.PeriodToDate))
     {
         return(false, "Date period is not valid.");
     }
     return(true, String.Empty);
 }
Beispiel #2
0
        internal WorkloadAnalysis CreateWorkloadAnalysis(CreateWorkloadAnalysisRequest source)
        {
            WorkloadAnalysis result = new WorkloadAnalysis();

            result.CreatedDate          = DateTime.Now;
            result.PeriodFromDate       = source.PeriodFromDate;
            result.PeriodToDate         = source.PeriodToDate;
            result.RelationReplacements = new List <WorkloadAnalysisRelationReplacement>();
            if (source.RelationReplacements != null)
            {
                foreach (var kv in source.RelationReplacements)
                {
                    result.RelationReplacements.Add(new WorkloadAnalysisRelationReplacement()
                    {
                        SourceId = kv.Key, TargetId = kv.Value
                    });
                }
            }
            result.State      = WorkloadAnalysisStateType.Created;
            result.WorkloadID = source.WorkloadID;
            return(result);
        }