예제 #1
0
        public List <RequestDetails> GetRequestApprovedByCso(string code)
        {//implementation in progreeesssss
            List <Requests>       requestList = _repo.GetAllClearedRequest();
            List <RequestDetails> requests    = new List <RequestDetails>();

            foreach (Requests req in requestList)
            {
                //get the approved list of request by cso
                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.RequestId               = req.RequestId;
                model.TypeOfRequest           = req.TypeOfRequest;
                model.pendingWith             = req.PendingWith;
                model.DateOfTransfer          = req.DateOfTransfer;
                model.DateOfCompletionRequest = req.DateOfCompletionRequest;
                requests.Add(model);
            }
            return(requests);
        }
예제 #2
0
        //Method to get all the discrepant records based on the data from the final report generated
        //and the updated data from the SAP
        public List <DiscrepancyReport> GetAllDiscrepantRecordsList()
        {
            List <DiscrepancyReport> discrepancyList = new List <DiscrepancyReport>();
            //repo call to get all the cleared requests
            List <Requests> requestList = _requestrepository.GetAllClearedRequest();///progreess work

            //here the discrepancy for the completed requests are being checked
            foreach (var req in requestList)
            {
                //time difference between the request completion and current date is being checked here
                DateTime date       = DateTime.Today;
                TimeSpan difference = date.Date - req.DateOfCompletionRequest.Date;
                if (difference.Days >= 1)
                {
                    //A call to the niit database is being triggered to get a single employee details
                    EmployeeDetails obj = _niitdb.GetOneEmployee(req.EmployeeCode);
                    //check for the discrepant data
                    if (obj.PaCode != req.NewPaCode && obj.PsaCode != req.NewPsaCode &&
                        obj.OuCode != req.NewOuCode && obj.CcCode != req.NewCcCode)
                    {
                        //if discrepancy exists then values are being assigned to the view model
                        DiscrepancyReport report = new DiscrepancyReport();
                        report.EmployeeCode = req.EmployeeCode;
                        report.EmployeeName = req.EmployeeCode;
                        report.RequestCc    = req.NewCcCode;
                        report.RequestId    = req.RequestId;
                        report.RequestOu    = req.NewOuCode;
                        report.RequestPa    = req.NewPaCode;
                        report.RequestPsa   = req.NewPsaCode;
                        report.SapCc        = obj.CcCode + ":" + obj.CcName;
                        report.SapOu        = obj.OuCode + ":" + obj.OuName;
                        report.SapPa        = obj.PaCode + ":" + obj.PaName;
                        report.SapPsa       = obj.PsaCode + ":" + obj.PsaName;

                        discrepancyList.Add(report); //discrepant record are being added to the list to be returned
                    }
                }
            }
            return(discrepancyList);
        }
        //Method to get all the discrepant asset records based on the data from the final report generated
        //and the updated data from the SAP
        public List <AssetControllerDiscrepancyReport> GetDiscrepantRecords()
        {
            List <AssetControllerDiscrepancyReport> discrepancyList = new List <AssetControllerDiscrepancyReport>();
            //Repository method to get all the cleared request
            List <Requests> requestList = _requestrepo.GetAllClearedRequest();

            foreach (var req in requestList)
            {
                //time difference between the request completion and current date is being checked here
                DateTime date       = DateTime.Today;
                TimeSpan difference = date.Date - req.DateOfCompletionRequest.Date;
                if (difference.Days >= 1)
                {
                    //Repository method to get all the asset associated to a employee
                    List <Assets> assetList = _assetrepo.GetAssetByEmpCode(req.EmployeeCode);
                    foreach (var asset in assetList)
                    {
                        //A call to the niit database is being triggered to get a single asset details
                        AssetDetails assetSAP = _assetDb.GetAssetByCode(asset.AssetCode);
                        string[]     empId    = asset.ReassignedTo.Split(':');
                        if (assetSAP.EmployeeCode != empId[0])
                        {
                            EmployeeDetails emp  = _empDb.GetName(empId[0]);
                            EmployeeDetails emp2 = _empDb.GetName(assetSAP.EmployeeCode);
                            //if discrepancy exists then values are being assigned to the view model
                            AssetControllerDiscrepancyReport report = new AssetControllerDiscrepancyReport();
                            report.RequestId       = req.RequestId;
                            report.AssetCode       = asset.AssetCode;
                            report.RepEmployeeCode = asset.ReassignedTo;
                            report.RepEmployeeName = emp.EmployeeName;
                            report.SapEmployeeCode = assetSAP.EmployeeCode;
                            report.SapEmployeeName = emp2.EmployeeName;
                            discrepancyList.Add(report); //discrepant record are being added to the list to be returned
                        }
                    }
                }
            }
            return(discrepancyList);
        }