Ejemplo n.º 1
0
    public static DA.Run ToEntity(DT.Run source, DA.OKBDataContext okb) {
      if (source == null) return null;

      List<DA.BinaryData> binCache = new List<DA.BinaryData>();

      DA.Run entity = new DA.Run { Id = 0, AlgorithmId = source.AlgorithmId, ProblemId = source.ProblemId, CreatedDate = source.CreatedDate, UserId = source.UserId, ClientId = source.ClientId };
      foreach (var value in source.ParameterValues)
        entity.Values.Add(Convert.ToEntity(value, entity, DA.ValueNameCategory.Parameter, okb, binCache));
      foreach (var value in source.ResultValues)
        entity.Values.Add(Convert.ToEntity(value, entity, DA.ValueNameCategory.Result, okb, binCache));
      return entity;
    }
Ejemplo n.º 2
0
        public static DT.Run ToDto(DA.Run source, bool includeBinaryValues, IEnumerable <DT.ValueName> valueNames)
        {
            if (source == null)
            {
                return(null);
            }
            var dto = new DT.Run {
                Id = source.Id, Algorithm = Convert.ToDto(source.Algorithm), Problem = Convert.ToDto(source.Problem), CreatedDate = source.CreatedDate, ClientId = source.ClientId, UserId = source.UserId
            };

            dto.ParameterValues = source.Values.Where(x => x.ValueName.Category == DA.ValueNameCategory.Parameter && valueNames.Count(y => y.Name == x.ValueName.Name) > 0).Select(x => Convert.ToDto(x, includeBinaryValues)).ToArray();
            dto.ResultValues    = source.Values.Where(x => x.ValueName.Category == DA.ValueNameCategory.Result && valueNames.Count(y => y.Name == x.ValueName.Name) > 0).Select(x => Convert.ToDto(x, includeBinaryValues)).ToArray();
            return(dto);
        }
Ejemplo n.º 3
0
        public static DA.Run ToEntity(DT.Run source, DA.OKBDataContext okb)
        {
            if (source == null)
            {
                return(null);
            }

            List <DA.BinaryData> binCache = new List <DA.BinaryData>();

            DA.Run entity = new DA.Run {
                Id = 0, AlgorithmId = source.AlgorithmId, ProblemId = source.ProblemId, CreatedDate = source.CreatedDate, UserId = source.UserId, ClientId = source.ClientId
            };
            foreach (var value in source.ParameterValues)
            {
                entity.Values.Add(Convert.ToEntity(value, entity, DA.ValueNameCategory.Parameter, okb, binCache));
            }
            foreach (var value in source.ResultValues)
            {
                entity.Values.Add(Convert.ToEntity(value, entity, DA.ValueNameCategory.Result, okb, binCache));
            }
            return(entity);
        }
Ejemplo n.º 4
0
        private static DA.Value ToEntity(DT.Value source, DA.Run run, DA.ValueNameCategory category, DA.OKBDataContext okb, List <DA.BinaryData> binCache)
        {
            if (source == null)
            {
                return(null);
            }
            var entity = new DA.Value();

            entity.Run      = run;
            entity.DataType = Convert.ToEntity(source.DataType, okb);
            if (source is DT.BoolValue)
            {
                entity.ValueName = Convert.ToEntity(source.Name, category, DA.ValueNameType.Bool, okb);
                entity.BoolValue = ((DT.BoolValue)source).Value;
            }
            else if (source is DT.IntValue)
            {
                entity.ValueName = Convert.ToEntity(source.Name, category, DA.ValueNameType.Int, okb);
                entity.IntValue  = ((DT.IntValue)source).Value;
            }
            else if (source is DT.TimeSpanValue)
            {
                entity.ValueName = Convert.ToEntity(source.Name, category, DA.ValueNameType.TimeSpan, okb);
                entity.LongValue = ((DT.TimeSpanValue)source).Value;
            }
            else if (source is DT.LongValue)
            {
                entity.ValueName = Convert.ToEntity(source.Name, category, DA.ValueNameType.Long, okb);
                entity.LongValue = ((DT.LongValue)source).Value;
            }
            else if (source is DT.FloatValue)
            {
                entity.ValueName  = Convert.ToEntity(source.Name, category, DA.ValueNameType.Float, okb);
                entity.FloatValue = ((DT.FloatValue)source).Value;
            }
            else if (source is DT.DoubleValue)
            {
                entity.ValueName   = Convert.ToEntity(source.Name, category, DA.ValueNameType.Double, okb);
                entity.DoubleValue = ((DT.DoubleValue)source).Value;
            }
            else if (source is DT.PercentValue)
            {
                entity.ValueName   = Convert.ToEntity(source.Name, category, DA.ValueNameType.Percent, okb);
                entity.DoubleValue = ((DT.PercentValue)source).Value;
            }
            else if (source is DT.StringValue)
            {
                entity.ValueName   = Convert.ToEntity(source.Name, category, DA.ValueNameType.String, okb);
                entity.StringValue = ((DT.StringValue)source).Value;
            }
            else if (source is DT.BinaryValue)
            {
                entity.ValueName  = Convert.ToEntity(source.Name, category, DA.ValueNameType.Binary, okb);
                entity.BinaryData = Convert.ToEntity(((DT.BinaryValue)source).Value, okb, binCache);
            }
            else
            {
                throw new ArgumentException("Unknown value type.", "source");
            }
            return(entity);
        }
Ejemplo n.º 5
0
 partial void DeleteRun(Run instance);
Ejemplo n.º 6
0
 partial void UpdateRun(Run instance);
Ejemplo n.º 7
0
 partial void InsertRun(Run instance);
Ejemplo n.º 8
0
		private void detach_Runs(Run entity)
		{
			this.SendPropertyChanging();
			entity.Problem = null;
		}
Ejemplo n.º 9
0
		private void attach_Runs(Run entity)
		{
			this.SendPropertyChanging();
			entity.Problem = this;
		}
Ejemplo n.º 10
0
		private void attach_Runs(Run entity)
		{
			this.SendPropertyChanging();
			entity.Algorithm = this;
		}