@ -0,0 +1,54 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace Sevomin.Models | |||
{ | |||
public class JobParameterViewModel | |||
{ | |||
public string StringValue { get; private set; } | |||
public byte MoscowValue { get; set; } | |||
public long Id { get; set; } | |||
public long ParameterId { get; set; } | |||
public long JobId { get; set; } | |||
public string AvalinId { get; set; } | |||
public string ParameterName { get; set; } | |||
public bool HasMoscow { get; set; } | |||
public byte DisplayMethod { get; set; } | |||
public string GroupName { get; set; } | |||
public string CommentAvalin { get; set; } | |||
public string CommentDovomin { get; set; } | |||
public IList<Tuple<decimal,string>> ParameterValues { get; set; } | |||
public JobParameterViewModel(JobParameter jp) | |||
{ | |||
StringValue = jp.StringValue; | |||
MoscowValue = jp.Moscow; | |||
Id = jp.Id; | |||
ParameterId = jp.Parameter.Id; | |||
JobId = jp.Job.Id; | |||
AvalinId = jp.Job.Avalin.Id; | |||
ParameterName = jp.Parameter.Name; | |||
HasMoscow = jp.Parameter.Moscow; | |||
DisplayMethod = jp.Parameter.DisplayMethod; | |||
GroupName = jp.Parameter.GroupName; | |||
CommentAvalin = jp.Parameter.CommentAvalin; | |||
CommentDovomin = jp.Parameter.CommentDovomin; | |||
foreach (var val in jp.Parameter.ParameterValues) | |||
{ | |||
ParameterValues.Add(new Tuple<decimal, string>(val.NumbericValue, val.Value)); | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,29 @@ | |||
// <auto-generated /> | |||
namespace Sevomin.Models.Migrations | |||
{ | |||
using System.CodeDom.Compiler; | |||
using System.Data.Entity.Migrations; | |||
using System.Data.Entity.Migrations.Infrastructure; | |||
using System.Resources; | |||
[GeneratedCode("EntityFramework.Migrations", "6.1.0-30225")] | |||
public sealed partial class ParameterValueChange : IMigrationMetadata | |||
{ | |||
private readonly ResourceManager Resources = new ResourceManager(typeof(ParameterValueChange)); | |||
string IMigrationMetadata.Id | |||
{ | |||
get { return "201403290719225_ParameterValue Change"; } | |||
} | |||
string IMigrationMetadata.Source | |||
{ | |||
get { return null; } | |||
} | |||
string IMigrationMetadata.Target | |||
{ | |||
get { return Resources.GetString("Target"); } | |||
} | |||
} | |||
} |
@ -0,0 +1,18 @@ | |||
namespace Sevomin.Models.Migrations | |||
{ | |||
using System; | |||
using System.Data.Entity.Migrations; | |||
public partial class ParameterValueChange : DbMigration | |||
{ | |||
public override void Up() | |||
{ | |||
AddColumn("dbo.ParameterValues", "NumbericValue", c => c.Decimal(nullable: false, precision: 18, scale: 2)); | |||
} | |||
public override void Down() | |||
{ | |||
DropColumn("dbo.ParameterValues", "NumbericValue"); | |||
} | |||
} | |||
} |
@ -0,0 +1,47 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Rhino.Mocks; | |||
using Sevomin.Models; | |||
using Sevomin.Models.Repositories; | |||
namespace Sevomin.Tests | |||
{ | |||
public class FakeJobRepository | |||
{ | |||
private static IJobRepository _JobRepository; | |||
private static IQueryable<Job> _Job; | |||
static FakeJobRepository() | |||
{ | |||
Init(); | |||
} | |||
internal static void Init() | |||
{ | |||
//_Job = (new List<Job>() { | |||
// new Job{ id = 1, Name = "A", TaskDefinitions = new List<TaskDefinition>()}, | |||
// new Job{ id = 2, Name = "B", TaskDefinitions = new List<TaskDefinition>() } | |||
//}).AsQueryable(); | |||
//_JobRepository = MockRepository.GenerateStub<IJobRepository>(); | |||
//_JobRepository.Stub(x => x.Find(Arg<long>.Is.Anything)) | |||
// .WhenCalled(x => x.ReturnValue = _Job.FirstOrDefault(y => y.id == (long)x.Arguments[0])) | |||
// .Return(new Job()); | |||
//_JobRepository.Stub(x => x.ListAll()).Return(_Job); | |||
//_JobRepository.Stub(x => x.FindByUsername("new-mission")) | |||
// .Return(null); | |||
//_JobRepository.Stub(x => x.FindByUsername(Arg<string>.Is.Anything)) | |||
// .Return(new Job() { id = 1, Username = "test", Name = "A", TaskDefinitions = new List<TaskDefinition>() }); | |||
} | |||
internal static IJobRepository Instance() | |||
{ | |||
return _JobRepository; | |||
} | |||
} | |||
} |