Ejemplo n.º 1
0
 public PartialViewResult GetEmployeeDesignation(int lookupID)
 {
     if (lookupID != -1)
     {
         var employeeDesign = lookUpBO.GetByProperty(x => x.LookUpID == lookupID && x.IsActive == true);
         return(PartialView("GetEmployeeDesignation", employeeDesign));
     }
     else
     {
         return(PartialView("GetEmployeeDesignation", new LookUp {
             LookUpID = -1
         }));
     }
 }
Ejemplo n.º 2
0
        public ActionResult add(int?EmployeeId)
        {
            ViewData["BranchId"] = BRANCHID;
            ViewData["RoleCode"] = ROLECODE;
            var count = salaryStructureHeaderBO.GetListByProperty(x => x.BranchId == BRANCHID && x.IsActive == true).Count();

            ViewData["IsEnable"] = false;
            if (count > 0)
            {
                ViewData["IsEnable"] = true;
            }
            if (EmployeeId != null)
            {
                var empObj = new EmployeeVm();

                empObj.empHeader         = empHeaderBO.GetById(EmployeeId.Value);
                empObj.empPersonalDetail = empPersonalDetailBO.GetByProperty(x => x.EmployeeId == EmployeeId.Value);
                empObj.empWorkDetail     = empWorkDetailBO.GetByProperty(x => x.EmployeeId == EmployeeId.Value);
                empObj.address           = addressBO.GetByProperty(x => x.LinkID == EmployeeId.Value && x.AddressType == UTILITY.EMPLOYEE);
                empObj.empBankdetail     = empbankdetailBO.GetByProperty(x => x.EmployeeId == EmployeeId.Value);
                List <EmployeeDocumentDetail> empDocumentDetList = empDocDetailBO.GetAll().ToList();

                var documentTypeLookupids = lookUpBO.GetByAll()
                                            .Where(x => x.LookUpCategory == UTILITY.CONFIG_DOCUMENTTYPE)
                                            .Select(x => x.LookUpID)
                                            .ToList();
                empDocumentDetList = empDocumentDetList
                                     .Where(x => x.EmployeeId == EmployeeId.Value &&
                                            documentTypeLookupids.Contains(x.DocumentType))
                                     .ToList();

                var codeList = empDocumentDetList.Select(x => x.DocumentType).ToList();

                if (empObj != null)
                {
                    if (empDocumentDetList.Count > 0)
                    {
                        List <EmployeeDocumentVm> docVmList = new List <EmployeeDocumentVm>();
                        foreach (EmployeeDocumentDetail item in empDocumentDetList)
                        {
                            EmployeeDocumentVm docVm = new EmployeeDocumentVm()
                            {
                                DocumentType        = item.DocumentType,
                                DocumentDescription = lookUpBO
                                                      .GetByProperty(y => y.LookUpCategory == UTILITY.CONFIG_DOCUMENTTYPE && y.LookUpID == item.DocumentType)
                                                      .LookUpDescription,
                                fileName         = item.FileName,
                                DocumentDetailId = item.DocumentDetailID
                            };
                            docVmList.Add(docVm);
                        }



                        empObj.empDocument = lookUpBO.GetListByProperty(y => y.LookUpCategory == UTILITY.CONFIG_DOCUMENTTYPE)
                                             .Select(y => new EmployeeDocumentVm
                        {
                            DocumentType        = y.LookUpID,
                            DocumentDescription = y.LookUpDescription
                        }).Where(x => !codeList.Contains(x.DocumentType)).ToList();
                        empObj.empDocument.AddRange(docVmList);

                        ViewData["empdocumentsPath"] = "Uploads/" + empObj.empHeader.EmployeeId + "/";
                    }
                    else
                    {
                        empObj.empDocument = lookUpBO.GetListByProperty(y => y.LookUpCategory == UTILITY.CONFIG_DOCUMENTTYPE)
                                             .Select(y => new EmployeeDocumentVm
                        {
                            DocumentType        = y.LookUpID,
                            DocumentDescription = y.LookUpDescription
                        }).ToList();
                    }
                }
                return(View(empObj));
            }
            else
            {
                var documentTypes = lookUpBO.GetListByProperty(y => y.LookUpCategory == UTILITY.CONFIG_DOCUMENTTYPE)
                                    .Select(x => new EmployeeDocumentVm
                {
                    DocumentType        = x.LookUpID,
                    DocumentDescription = x.LookUpDescription
                }).ToList();
                var listleave = new List <OtherLeave>();
                listleave = otherleaveBo.GetListByProperty(x => x.BranchId == BRANCHID && x.IsActive == true).ToList();

                var List = new List <AssignLeaves>();
                foreach (var item in listleave)
                {
                    var AssignLeaves = new AssignLeaves()
                    {
                        LeaveTypeID = item.LeaveTypeId.Value,
                        Description = item.Description,
                    };

                    List.Add(AssignLeaves);
                }

                return(View(new EmployeeVm
                {
                    empHeader = new EmployeeHeader
                    {
                        EmployeeId = -1, IsActive = true
                    },
                    empDocument = documentTypes,
                    ListAssignLeaves = List,
                    empPersonalDetail = new EmployeePersonalDetail()
                    {
                        Gender = 101
                    }
                }));
            }
        }