Ejemplo n.º 1
0
        public List <AssetDetails> GetRejectedAssetListByEmpCode(List <string> asset)
        {
            List <AssetDetails> rejectedassetlist = new List <AssetDetails>();

            foreach (string empid in asset)
            {
                List <AssetDetails> assetdetail = _assetDbRepo.GetMyEmployeeAsset(empid);
                List <Assets>       matchassets = _assetrepo.GetAssetByEmpCode(empid);
                foreach (Assets myasset in matchassets)
                {
                    foreach (AssetDetails assdet in assetdetail)
                    {
                        if (assdet.AssetCode == myasset.AssetCode && assdet.EmployeeCode == myasset.EmployeeCode)
                        {
                            if (myasset.AssetStatus == Status.Rejected)
                            {
                                assdet.ReAssignedTo = myasset.ReassignedTo;
                                assdet.AssetId      = myasset.AssetId;
                                rejectedassetlist.Add(assdet);
                            }
                        }
                    }
                }
            }
            return(rejectedassetlist);
        }
Ejemplo n.º 2
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);
        }
 //Method to get the assets according to the employee code
 public List <Assets> GetAssetDetailsByEmpcode(string code)
 {
     return(_assetrepo.GetAssetByEmpCode(code)); //repo call
 }