Linq2Object : The Name "myTypeVariable" doesn't exist in the current context
before ask this question, i tried to implement this accepted answer on
StackOverflow where given by user414076 but unfortunately i couldn't..
so i want to ask where am i wrong.. how should i go on for the efficient
"Goal"..
in my winforms .Net4 project
i have two classes : Employee and Mods.. and a subclass of Employee : RM
The Mods class carries data something like Government's "working
permittance" rules i.e. if the employee is a Mechanical engineer then
should work in one of the Mechanical Labs, should have salary min. "x"
dollars per hour, -if has a successfull finished research- should take %1
of the research gain as a success prize, etc. ..
The employee class with many properties, and carries all of the data for
an employee i.e. name, homeaddress, List of phones, List of Yearly
Vacations, List of Hospital Illness Papers, List of
Should_Attend_Seminars, List of AcceptedWorkingRules, etc. ..
The RM subclass carries details of the employee as it's working rules i.e.
WorkingType - is the salary hourly or weekly or monthly,Have extra
commission or not etc. - , WorkingHours, PermittanceID -As a reference to
the Mods Class ID Value- , etc. ..
My Goal is to select Employees from the static list of All Employees as
seperate lists (if seperate list is not possible then grouped in a list)
of which employees' RM.PermittanceID are the same
i.e. RmPermittanceIdList_1 contains the employees which are have working
type in (3,6,9,12) and permittance ID is 1
RmPerMittanceIdList_2 contains th employees which are have working Type in
( 3,6,9,129 an permittance ID is 2 ....goes on
{ i need these lists for a later use }
and what i tried and took error { The Name "em" doesn't exist in the
current context } :
List<Employees> emps = from md in Program.modList
from em in Program.empList
from emo in em.RmList
where emo.EndDate > DateTime.Today
&& (emo.Worktype == 3 ||
emo.WorkType == 6
|| emo.WorkType == 9 ||
emo.WorkType == 12)
group o by emo.PermittanceID == md.ModId
into rm
select new { id = em.ID, r =
rm.ToList() };
No comments:
Post a Comment