Ejemplo n.º 1
0
        internal static JobOverview MapFromJob(vRpt_Job job)
        {
            var j = new JobOverview();

            j.CopyFrom2(job);

            return(j);
        }
        public JobOverview[] GetJobs(int?franchiseId, DateTime fromDateInclusive, DateTime toDateExclusive)
        {
            var joboverviews = GetJobData(franchiseId, null, fromDateInclusive, toDateExclusive, null, null).Select(
                p => JobOverview.MapFromJob(p.Key)).ToArray();

            using (var ctx = new EightHundredEntities(UserKey))
            {
                var techs = ctx.tbl_Employee.Select(t => new { t.EmployeeID, t.Employee }).ToArray();
                foreach (var j in joboverviews)
                {
                    var techId = j.TechId;
                    var tech   = techs.FirstOrDefault(t => t.EmployeeID == techId);
                    j.Tech = tech == null ? string.Empty : tech.Employee;
                }
            }

            return(joboverviews);

            //return GetJobData(franchiseId, null, fromDateInclusive, toDateExclusive, null).SelectMany(
            // p => JobOverview.MapFromJobAndTasks(p.Key, p.Value)).ToArray();
        }