Exemplo n.º 1
0
        public List <RequestDetails> GetRequestPendingWithCso(string code)
        {
            List <RequestDetails>  requests = new List <RequestDetails>();
            List <EmployeeDetails> emps     = new List <EmployeeDetails>();
            //get only those requests that are pending with cso
            List <Requests> requestList = _repo.GetAllCsoRequest();

            string employeeCso = code;

            foreach (Requests req in requestList)
            {
                string pa          = _empDetails.GetPA(req.EmployeeCode);
                string locationCso = _empDetails.GetCso(pa);


                if (employeeCso == locationCso)
                {
                    List <Assets> assetList = _assetRepo.GetAssetByEmpCode(req.EmployeeCode);
                    List <Assets> assets    = _assetRepo.GetAssetsByCso(req.EmployeeCode);
                    if (assets.Count == assetList.Count)
                    {
                        //get the employer name with the corresponding request id
                        EmployeeDetails empName = _empDetails.GetOneEmployee(req.EmployeeCode);
                        EmployeeDetails supName = _empDetails.GetSupervisor(req.SupervisorCode);
                        RequestDetails  model   = new RequestDetails();
                        model.DateOfRequest           = req.DateOfRequest;
                        model.EmployeeCode            = req.EmployeeCode;
                        model.EmployeeName            = empName.EmployeeName;
                        model.SupervisorCode          = req.SupervisorCode;
                        model.SupervisorName          = supName.SupervisorName;
                        model.Newpacode               = req.NewPaCode;
                        model.Newpsacode              = req.NewPsaCode;
                        model.NewOucode               = req.NewOuCode;
                        model.NewCcCode               = req.NewCcCode;
                        model.RequestStatus           = req.RequestStatus;
                        model.TypeOfRequest           = req.TypeOfRequest;
                        model.pendingWith             = req.PendingWith;
                        model.RequestId               = req.RequestId;
                        model.DateOfTransfer          = req.DateOfTransfer;
                        model.DateOfCompletionRequest = req.DateOfCompletionRequest;
                        requests.Add(model); //add the requests to the view model
                    }
                }
            }
            return(requests);
        }
Exemplo n.º 2
0
        //Method to return the requests pending with the HR
        public List <HrViewModel> GetAllRequest(string code)
        {
            List <HrViewModel> requests   = new List <HrViewModel>();
            string             hrEmployee = _niitdb.GetPsa(code);

            if (hrEmployee != null)
            {
                List <Requests> requestlist = _requestrepository.GetAllRequest(); //repo call
                foreach (Requests req in requestlist)
                {
                    string tempCode    = req.EmployeeCode;
                    string reqEmployee = _niitdb.GetPsa(tempCode);
                    if (hrEmployee == reqEmployee)
                    {
                        EmployeeDetails employee   = _niitdb.GetOneEmployee(req.EmployeeCode);
                        EmployeeDetails supervisor = _niitdb.GetSupervisor(req.SupervisorCode);
                        HrViewModel     model      = new HrViewModel();
                        model.DateOfRequest  = req.DateOfRequest;
                        model.DateOfTransfer = req.DateOfTransfer;
                        model.EmployeeCode   = req.EmployeeCode;
                        model.EmployeeName   = employee.EmployeeName;
                        model.NewcCode       = req.NewCcCode;
                        model.NewOucode      = req.NewOuCode;
                        model.Newpacode      = req.NewPaCode;
                        model.Newpsacode     = req.NewPsaCode;
                        model.OldcCode       = employee.CcCode;
                        model.OldOucode      = employee.OuCode;
                        model.Oldpacode      = employee.PaCode;
                        model.Oldpsacode     = employee.PsaCode;
                        model.RequestId      = req.RequestId;
                        model.SupervisorCode = req.SupervisorCode;
                        model.SupervisorName = supervisor.SupervisorName;
                        requests.Add(model);
                    }
                }
            }
            return(requests);
        }
        //Method for getting request details for particular employee code
        public RequestDetails GetUserByEmpcode(string code)
        {
            //Details
            Requests        req     = _reqRepo.GetRequestByEmpcode(code);
            EmployeeDetails empName = _empRepo.GetOneEmployee(req.EmployeeCode);
            EmployeeDetails supName = _empRepo.GetSupervisor(req.SupervisorCode);
            RequestDetails  model   = new RequestDetails();

            model.DateOfRequest           = req.DateOfRequest;
            model.EmployeeCode            = req.EmployeeCode;
            model.EmployeeName            = empName.EmployeeName;
            model.SupervisorCode          = empName.SupervisorCode;
            model.SupervisorName          = supName.SupervisorName;
            model.Newpacode               = req.NewPaCode;
            model.Newpsacode              = req.NewPsaCode;
            model.NewOucode               = req.NewOuCode;
            model.NewCcCode               = req.NewCcCode;
            model.RequestStatus           = req.RequestStatus;
            model.TypeOfRequest           = req.TypeOfRequest;
            model.pendingWith             = req.PendingWith;
            model.DateOfTransfer          = req.DateOfTransfer;
            model.DateOfCompletionRequest = req.DateOfCompletionRequest;
            return(model);
        }
Exemplo n.º 4
0
 public EmployeeDetails GetOneEmp(string empCode)
 {
     return(_empcontext.GetOneEmployee(empCode));
 }