J
Justair07
Guest
Hello,
I have a Custom Class (ProjectsBySite) where I'm projecting to a datagrid using LINQ for some SQL data I want users to edit on my form.
Everything looks good and with the exception to this error, it compiles fine and projects fine. Why is it that these to objects are receiving this error?
Here is my class:
public class ProjectsBySite
{
public int IDSite { get; set; }
public string SiteName { get; set; }
public int IDProjects { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string ProjectName { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public DateTime SavingsDate { get; set; }
public decimal PlannedSavings { get; set; }
public decimal ActualSavings { get; set; }
}
Here is my LINQ:
public List<ProjectsBySite> GetProjectsBySiteID(int siteid/*<---*/)
{
var prjs = new List<ProjectsBySite>();
using (ProductivityEntities context = new ProductivityEntities())
{
prjs = (from s in context.pt_Site
join ps in context.pt_ProjectsSites
on s.IDSite equals ps.Site_id
join p in context.pt_Projects
on ps.Project_id equals p.IDProjects
join pz in context.pt_ProjectSavings
on p.IDProjects equals pz.Project_id
join l in context.pt_Personnel
on p.Personnel_id equals l.IDPersonnel
where s.IDSite == siteid
select new ProjectsBySite
{
IDSite = s.IDSite,
SiteName = s.SiteName,
IDProjects = p.IDProjects,
FirstName = l.FirstName,
LastName = l.LastName,
ProjectName = p.ProjectName,
StartDate = p.StartDate,
EndDate = p.EndDate,
SavingsDate = pz.SavingsDate,
PlannedSavings = pz.PlannedSavings,
ActualSavings = pz.ActualSavings
}).ToList();
}
return prjs;
}
And my error:
Continue reading...
I have a Custom Class (ProjectsBySite) where I'm projecting to a datagrid using LINQ for some SQL data I want users to edit on my form.
Everything looks good and with the exception to this error, it compiles fine and projects fine. Why is it that these to objects are receiving this error?
Here is my class:
public class ProjectsBySite
{
public int IDSite { get; set; }
public string SiteName { get; set; }
public int IDProjects { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string ProjectName { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public DateTime SavingsDate { get; set; }
public decimal PlannedSavings { get; set; }
public decimal ActualSavings { get; set; }
}
Here is my LINQ:
public List<ProjectsBySite> GetProjectsBySiteID(int siteid/*<---*/)
{
var prjs = new List<ProjectsBySite>();
using (ProductivityEntities context = new ProductivityEntities())
{
prjs = (from s in context.pt_Site
join ps in context.pt_ProjectsSites
on s.IDSite equals ps.Site_id
join p in context.pt_Projects
on ps.Project_id equals p.IDProjects
join pz in context.pt_ProjectSavings
on p.IDProjects equals pz.Project_id
join l in context.pt_Personnel
on p.Personnel_id equals l.IDPersonnel
where s.IDSite == siteid
select new ProjectsBySite
{
IDSite = s.IDSite,
SiteName = s.SiteName,
IDProjects = p.IDProjects,
FirstName = l.FirstName,
LastName = l.LastName,
ProjectName = p.ProjectName,
StartDate = p.StartDate,
EndDate = p.EndDate,
SavingsDate = pz.SavingsDate,
PlannedSavings = pz.PlannedSavings,
ActualSavings = pz.ActualSavings
}).ToList();
}
return prjs;
}
And my error:
Continue reading...