Hi Guys,
How can i apply a filter on "IEnumerable"? "GetTaskAllocatedOnFilter" property list any value can be null basis on that i need a data
Please help, also let know if you guys want any other information to proved me solution on this
What I have tried:
public class GetTaskAllocatedOnFilter
{
public Guid? Project_ID { get; set; }
public Guid? Emp_ID { get; set; }
public Guid? Task_ID { get; set; }
}
public IEnumerable<task_allocationmodel> GetTaskAllocatedList(GetTaskAllocatedOnFilter getOnFilter)
{
_DALTaskAllocation = new DALTaskAllocation();
DataTable taskAllocatedList = _DALTaskAllocation.GetTaskAllocatedList(getOnFilter);
IEnumerable<task_allocationmodel> IEtaskAllocationList = taskAllocatedList.AsEnumerable().Select(row => new Task_AllocationModel() {
Emp_ID = new Guid(row["Emp_ID"].ToString()),
Emp_Name = row["Emp_Name"].ToString(),
Hrs = Convert.ToInt16(row["Hrs"]),
Location = row["Location"].ToString(),
Location_ID = Convert.ToInt16(row["Location_ID"]),
Month = Convert.ToInt16(row["Month"].ToString()),
Project_ID = new Guid(row["Project_ID"].ToString()),
Project_Name = row["Project_Name"].ToString(),
Reporting_Manager = row["Reporting_Manager"].ToString(),
Task_ID = new Guid(row["Task_ID"].ToString()),
Total = Convert.ToInt16(row["Total"].ToString()),
Type_ID = Convert.ToInt16(row["Type_ID"].ToString()),
Year = Convert.ToInt16(row["Year"].ToString()),
Createddate = Convert.ToDateTime(row["Createddate"].ToString()),
CreatedBy = row["CreatedBy"].ToString()
});
if ((Guid.Empty == getOnFilter.Emp_ID && Guid.Empty == getOnFilter.Project_ID) && Guid.Empty != getOnFilter.Task_ID)
if ((Guid.Empty == getOnFilter.Emp_ID && Guid.Empty == getOnFilter.Task_ID) && Guid.Empty != getOnFilter.Project_ID)
if ((Guid.Empty == getOnFilter.Project_ID && Guid.Empty == getOnFilter.Task_ID) && Guid.Empty != getOnFilter.Emp_ID)
if ((Guid.Empty == getOnFilter.Project_ID && Guid.Empty == getOnFilter.Task_ID) && Guid.Empty != getOnFilter.Emp_ID)
return IEtaskAllocationList;
}