Click here to Skip to main content
16,019,593 members

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