private static void MapToDB(Job job, DJob djob) { djob.Started = job.Started; djob.Finished = job.Finished; djob.Name = job.Name; djob.Owner = job.Owner; djob.State = job.State.ToString(); djob.Result = job.Result.ToString(); djob.ResultData = job.ResultData; }
// ReSharper disable InconsistentNaming private static Job MapFromDB(DJob d) { return new Job { Id = d.Id, Owner = d.Owner, Name = d.Name, Started = d.Started, Finished = d.Finished, RunningSince = d.RunningSince, State = (JobState)Enum.Parse(typeof(JobState), d.State), Result = (JobResult) Enum.Parse(typeof (JobResult), d.Result), ResultData = d.ResultData }; }
/// <summary> /// Deprecated Method for adding a new object to the DJobs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDJobs(DJob dJob) { base.AddObject("DJobs", dJob); }
public Job AddJobManually(Job job) { var dJob = new DJob(); dJob.Id = job.Id; //dJob.ProcTime = job.ProcTime.ToString(CultureInfo.InvariantCulture); MapToDB(job, dJob); _ctx.DJobs.AddObject(dJob); _ctx.SaveChanges(); return MapFromDB(dJob); }
/// <summary> /// Create a new DJob object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="started">Initial value of the Started property.</param> /// <param name="owner">Initial value of the Owner property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="state">Initial value of the State property.</param> public static DJob CreateDJob(global::System.Guid id, global::System.DateTime started, global::System.String owner, global::System.String name, global::System.String state) { DJob dJob = new DJob(); dJob.Id = id; dJob.Started = started; dJob.Owner = owner; dJob.Name = name; dJob.State = state; return dJob; }