Exemplo n.º 1
0
        // for Retrieve Employee data on based on Company List
        public List <EmpAllItem> EmpDetailsByCompany(int Compid)
        {
            //Mapper.CreateMap<employee_master, EmpAllItem>();
            //List<employee_master> objEm = DbContext.employee_master.Where(m => m.Compid == Compid).ToList();
            //List<EmpAllItem> objEmpItem = Mapper.Map<List<EmpAllItem>>(objEm);
            //return objEmpItem;
            var EmpDetails = (from Emp in DbContext.employee_master
                              join Company in DbContext.Company_master on Emp.Compid equals Company.id into CompanyMst
                              from Companys in CompanyMst.DefaultIfEmpty()
                              join Branch in DbContext.Branch_master on Emp.Branchid equals Branch.id into BranchMst
                              from Branchs in BranchMst.DefaultIfEmpty()
                              where Emp.Compid == Compid
                              select new EmpAllItem()
            {
                EmployeeItem = new EmployeeItem()
                {
                    Empname = Emp.Empname,
                    Mobile = Emp.Mobile,
                    id = Emp.id,
                    JobTitle = Emp.JobTitle
                },
                CompanyItem = new CompanyItem()
                {
                    CompName = Companys.CompName,
                },
                BranchItem = new BranchItem()
                {
                    BranchName = Branchs.BranchName
                }
            }
                              ).Distinct().ToList();

            return(EmpDetails);
        }
Exemplo n.º 2
0
        public List <EmpAllItem> getEmpContacts(int cid)
        {
            var ab = (from Emp in DbContext.employee_master
                      //join Contact in DbContext.EmployeeContacts on Emp.id equals Contact.EmpId into Contact1
                      //from C in Contact1.DefaultIfEmpty()
                      //join Passport in DbContext.EmployeePassports on Emp.id equals Passport.EmpId into Passport1
                      //from P in Passport1.DefaultIfEmpty()
                      //join Relative in DbContext.EmployeeRelatives on Emp.id equals Relative.EmpId into Relative1
                      //from R in Relative1.DefaultIfEmpty()
                      join mt in DbContext.Masters_Tran on Emp.JobTitle equals mt.Id into mtt
                      from m in mtt.DefaultIfEmpty()
                      join Company in DbContext.Company_master on Emp.Compid equals Company.id into Company1
                      from Companys in Company1.DefaultIfEmpty()
                      join Branch in DbContext.Branch_master on Emp.Branchid equals Branch.id into BranchMst
                      from Branchs in BranchMst.DefaultIfEmpty()
                      where Emp.Compid == (cid == 0 ? Emp.Compid : cid) && Emp.WorkingStatus != 94
                      //where Emp.Compid == (Compid == 0 ? Emp.Compid : Compid)
                      //where Emp.WorkingStatus == (FID == 0 ? Emp.WorkingStatus : FID)
                      select new EmpAllItem
            {
                //EmpContactItem = new EmpContactItem()
                //{
                //    Area = C.Area,
                //    City = C.City,
                //},
                EmployeeItem = new EmployeeItem()
                {
                    Empno = Emp.Empno,
                    Empname = Emp.Empname,
                    Mobile = Emp.Mobile,
                    id = Emp.id,
                    JobTitle = Emp.JobTitle
                },
                //EmpPassportItem = new EmpPassportItem()
                //{
                //    PassportNo = P.PassportNo

                //},
                //EmpRelativeItem = new EmpRelativeItem()
                //{
                //    RName = R.RName,
                //    RAddress = R.RAddress
                //},
                CompanyItem = new CompanyItem()
                {
                    CompName = (Companys == null ? string.Empty : Companys.CompName)
                },
                BranchItem = new BranchItem()
                {
                    BranchName = (Branchs == null ? string.Empty : Branchs.BranchName)
                },
                desiDetails = new clsMasterData()
                {
                    Name = (m == null ? string.Empty : m.Name)
                }

                //Company = Companys.CompName
            }

                      ).Distinct().ToList();


            return(ab);
            //
        }
Exemplo n.º 3
0
        public List <EmpAllItem> GetALLDetails(int FID, int cid)
        {
            //     Mapper.Initialize(cfg =>
            //    {
            //        cfg.CreateMap<EmployeeContact, EmpContactItem>();
            //        cfg.CreateMap<EmployeePassport, EmpPassportItem>();
            //        cfg.CreateMap<EmployeeRelative, EmpRelativeItem>();
            //    });
            //     List<EmpAllItem> a = new List<EmpAllItem>();
            //     return a ;
            EmpContactItem      ContactItem  = new EmpContactItem();
            EmpPassportItem     PassportItem = new EmpPassportItem();
            List <EmployeeItem> a            = new List <EmployeeItem>();


            var ab = (from Emp in DbContext.employee_master
                      join Contact in DbContext.EmployeeContacts on Emp.id equals Contact.EmpId into Contact1
                      from C in Contact1.DefaultIfEmpty()
                      join Passport in DbContext.EmployeePassports on Emp.id equals Passport.EmpId into Passport1
                      from P in Passport1.DefaultIfEmpty()
                      join Relative in DbContext.EmployeeRelatives on Emp.id equals Relative.EmpId into Relative1
                      from R in Relative1.DefaultIfEmpty()
                      join Company in DbContext.Company_master on Emp.Compid equals Company.id into Company1
                      from Companys in Company1.DefaultIfEmpty()
                      join Branch in DbContext.Branch_master on Emp.Branchid equals Branch.id into BranchMst
                      from Branchs in BranchMst.DefaultIfEmpty()
                      //where Emp.Compid == (Compid == 0 ? Emp.Compid : Compid)
                      where Emp.WorkingStatus == (FID == 0 ? Emp.WorkingStatus : FID) && Emp.Compid == (cid == 0 ? Emp.Compid : cid)
                      select new EmpAllItem
            {
                //EmpContactItem = new EmpContactItem()
                //{
                //    Area = C.Area,
                //    City = C.City,
                //},
                EmployeeItem = new EmployeeItem()
                {
                    Empno = Emp.Empno,
                    Empname = Emp.Empname,
                    Mobile = Emp.Mobile,
                    id = Emp.id,
                    JobTitle = Emp.JobTitle
                },
                //EmpPassportItem = new EmpPassportItem()
                //{
                //    PassportNo = P.PassportNo

                //},
                //EmpRelativeItem = new EmpRelativeItem()
                //{
                //    RName = R.RName,
                //    RAddress = R.RAddress
                //},
                CompanyItem = new CompanyItem()
                {
                    CompName = Companys.CompName,
                },
                BranchItem = new BranchItem()
                {
                    BranchName = Branchs.BranchName
                }

                //Company = Companys.CompName
            }

                      ).Distinct().ToList();


            return(ab);
            //
        }