You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

61 lines
1.5 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models
{
public class JobParameter
{
[Key]
public long Id { get; set; }
[Index("IX_JobParameterUniqueIndex", Order=1, IsUnique=true)]
[Required]
public long ParameterId { get; set; }
[Index]
[Index("IX_JobParameterUniqueIndex", Order=2, IsUnique=true)]
[Required]
public long JobId { get; set; }
public string StringValue { get; private set; }
public decimal? NumericValue { get; private set; }
public byte Moscow { get; set; }
public virtual Parameter Parameter { get; set; }
public virtual Job Job { get; set; }
public JobParameter()
{}
public JobParameter(Job job, Parameter parameter)
{
this.Job = job;
this.Parameter = parameter;
this.StringValue = "";
this.NumericValue = null;
this.Moscow = 0;
}
public void SetValue(string value)
{
decimal val;
if (decimal.TryParse(value, out val))
{
NumericValue = val;
StringValue = value;
}
else
{
NumericValue = null;
StringValue = value;
}
}
}
}