16,019,593 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by sindhukrothapalli (Top 10 by date)
sindhukrothapalli
28-Mar-14 7:40am
View
Hi thanks for reply i follwed this http://www.codeproject.com/Tips/513522/Providing-session-state-in-ASP-NET-WebAPI. I got solution
sindhukrothapalli
4-Mar-14 0:01am
View
I saw this link but i didnt undarstand what to do can u please elobarate the steps
sindhukrothapalli
7-Jan-14 23:17pm
View
Hi Sir we tried like this with dictionary.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace employee
{
public class Department
{
public int deptId { get; set; }
public string deptName { get; set; }
}
public class Employee
{
private employee.Department dept;
public Employee(employee.Department dept)
{
// TODO: Complete member initialization
this.dept = dept;
}
public int empId { get; set; }
public string empName { get; set; }
public int empSalary { get; set; }
public Department Department { get; set; }
}
class Program
{
static void Main(string[] args)
{
Dictionary<string, list<employee="">> dictionary = new Dictionary<string, list<employee="">>();
List<department> list = new List<department>();
Department dept = new Department();
dept.deptId = 1;
dept.deptName = "IT";
list.Add(dept);
List<employee> list1 = new List<employee>();
Employee emp = new Employee(dept);
emp.empId = 101;
emp.empName = "anusha";
emp.empSalary = 9000;
emp.Department = dept;
list1.Add(emp);
emp = new Employee(dept);
emp.empId = 102;
emp.empName = "Sindhu";
emp.empSalary = 9000;
emp.Department = dept;
list1.Add(emp);
dept = new Department();
dept.deptId = 2;
dept.deptName = "HR";
list.Add(dept);
emp = new Employee(dept);
emp.empId = 103;
emp.empName = "usha";
emp.empSalary = 2000;
emp.Department = dept;
list1.Add(emp);
emp = new Employee(dept);
emp.empId = 104;
emp.empName = "indhu";
emp.empSalary = 3000;
emp.Department = dept;
list1.Add(emp);
var query = from Employee employee in list1
where employee.empId == 101
select employee;
Console.WriteLine("EmpID\tEmpName\tEmpSal\tDepartmentID");
foreach(Employee e in query)
{
Console.WriteLine(e.empId+"\t"+e.empName +"\t"+e.empSalary+"\t"+e.Department.deptId+"");
}
var query1 = (from Employee employee1 in list1
join Department department1 in list
on employee1.Department.deptId equals department1.deptId into o
from department1 in o.DefaultIfEmpty()
select employee1);
Console.WriteLine("----****----");
Console.WriteLine("EmpID\tEmpName\tEmpSal\tDepartmentName");
foreach (Employee e1 in query1)
{
Console.WriteLine(e1.empId + "\t" + e1.empName + "\t" + e1.empSalary + "\t" + e1.Department.deptName + "");
}
var query2=(from Employee employee2 in list1
where employee2.empSalary > 1000 && employee2.empSalary<= 10000
select employee2);
Console.WriteLine("----****----");
Console.WriteLine("EmpID\tEmpName\tEmpSal\tDepartmentID");
foreach (Employee e2 in query2)
{
Console.WriteLine(e2.empId + "\t" + e2.empName + "\t" + e2.empSalary + "\t" + e2.Department.deptId + "");
}
int count;
string spec="A101";
dictionary.Add(spec, list1);
count = dictionary[spec].Count;
count = (from employee3 in dictionary[spec] where employee3.Department.deptId == 1 select employee3).Count();
//Console.WriteLine("DepartmentID\tCount");
Console.WriteLine("----****----
sindhukrothapalli
7-Jan-14 6:02am
View
Hi sir, We need to group employee details with help of dictionary not by Groupby clause.
sindhukrothapalli
7-Jan-14 4:58am
View
Thanks it works
sindhukrothapalli
7-Jan-14 4:40am
View
ok
sindhukrothapalli
7-Jan-14 4:31am
View
While using join condition we are facing this type error.Near Join- The type of one of the expression in the join clause is incorrect.Type inference failed in the call to 'GroupJoin'.
Near foreach-Cannot convert type 'Anonymous Type#1' to 'employee.Employee'.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace employee
{
public class Department
{
public int deptId { get; set; }
public string deptName { get; set; }
}
public class Employee
{
private employee.Department dept;
public Employee(employee.Department dept)
{
// TODO: Complete member initialization
this.dept = dept;
}
public int empId { get; set; }
public string empName { get; set; }
public int empSalary { get; set; }
public Department Department { get; set; }
}
class Program
{
static void Main(string[] args)
{
ArrayList list = new ArrayList();
Department dept = new Department();
dept.deptId = 1;
dept.deptName = "IT";
list.Add(dept);
ArrayList list1 = new ArrayList();
Employee emp = new Employee(dept);
emp.empId = 100;
emp.empName = "anusha";
emp.empSalary = 10000;
emp.Department = dept;
list1.Add(emp);
dept = new Department();
dept.deptId = 2;
dept.deptName = "HR";
list.Add(dept);
emp = new Employee(dept);
emp.empId = 101;
emp.empName = "usha";
emp.empSalary = 20000;
emp.Department = dept;
list1.Add(emp);
var query = from Employee employee in list1
where employee.empId == 101
select employee;
foreach(Employee e in query)
{
Console.WriteLine("EmpID\tEmpName\tEmpSal\tDepartmentID");
Console.WriteLine(e.empId+"\t"+e.empName +"\t"+e.empSalary+"\t"+e.Department.deptId+"");
}
var query1=(from Employee employee1 in list1
join Department department1 in list
on employee1.Department equals department1.deptId into o
from department1 in o.DefaultIfEmpty()
select new
{
id=employee1.empId,
name=employee1.empName,
salary=employee1.empSalary,
departmentname=department1.deptName
});
foreach (Employee e1 in query1)
{
Console.WriteLine("EmpID\tEmpName\tEmpSal\tDepartmentID");
Console.WriteLine(e1.empId + "\t" + e1.empName + "\t" + e1.empSalary + "\t" + e1.Department.deptName + "");
}
Console.ReadLine();
}
}
}
sindhukrothapalli
7-Jan-14 2:57am
View
Thanks sir. Its Working.
sindhukrothapalli
7-Jan-14 2:46am
View
Deleted
Sorry Kornfeld Eliyahu Peter.
sindhukrothapalli
7-Jan-14 2:45am
View
Hi Kornfeld Eliyahu Peter, For this what we have to do. Any Suggestion.. to get complete details of department.
Show More