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.

59 lines
1.5 KiB

11 years ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace Sevomin.Models
  9. {
  10. public class DovominParameter
  11. {
  12. [Key]
  13. public long Id { get; set; }
  14. [Index("IX_DovominParameterUniqueIndex", Order = 1, IsUnique = true)]
  15. [Required]
  16. public long ParameterId { get; set; }
  17. [Index]
  18. [Index("IX_DovominParameterUniqueIndex", Order=2, IsUnique=true)]
  19. [Required]
  20. [StringLength(128)]
  21. public string DovominId { get; set; }
  22. public string StringValue { get; private set; }
  23. public decimal? NumericValue { get; private set; }
  24. public virtual Parameter Parameter { get; set; }
  25. public virtual Dovomin Dovomin { get; set; }
  26. public DovominParameter()
  27. {}
  28. public DovominParameter(Dovomin dovomin, Parameter parameter)
  29. {
  30. this.Dovomin = dovomin;
  31. this.Parameter = parameter;
  32. this.StringValue = "";
  33. this.NumericValue = null;
  34. }
  35. public void SetValue(string value)
  36. {
  37. decimal val;
  38. if (decimal.TryParse(value, out val))
  39. {
  40. NumericValue = val;
  41. StringValue = value;
  42. }
  43. else
  44. {
  45. NumericValue = null;
  46. StringValue = value;
  47. }
  48. }
  49. }
  50. }