public List <InterventionViewByUser> GetListWithValue(List <InterventionViewByUser> anInterventionViewByUserList)
        {
            List <Client> aClientList = aClientManager.GetClientListByDistrict(districtID);

            foreach (Client aClient in aClientList)
            {
                List <Intervention> anInterventionList = anInterventionManager.GetInterventionListByClient(aClient.ClientID);
                foreach (Intervention anIntervention in anInterventionList)
                {
                    InterventionViewByUser anInterventionViewByUser = new InterventionViewByUser();
                    anInterventionViewByUser.InterventionStatus = anIntervention.InterventionState;
                    anInterventionViewByUser.InterventionID     = anIntervention.InterventionID;
                    anInterventionViewByUser.InterventionTypeID = anIntervention.InterventionTypeID;
                    anInterventionViewByUser.InterventionType   = anInterventionTypeManager.GetInterventionNameByTypeId(anIntervention.InterventionTypeID);
                    anInterventionViewByUser.InterventionDate   = anIntervention.InterventionDate;
                    anInterventionViewByUser.ClientID           = aClient.ClientID;
                    anInterventionViewByUser.ClientName         = aClientManager.GetClientNameByClientID(aClient.ClientID);
                    anInterventionViewByUser.CostRequired       = anIntervention.CostRequired;
                    anInterventionViewByUser.LabourRequired     = anIntervention.LabourRequired;
                    if (anInterventionManager.IsEligibleForProposedList(anInterventionViewByUser.InterventionStatus,
                                                                        anIntervention.CostRequired,
                                                                        anIntervention.LabourRequired,
                                                                        anUserManager.GetMaxCostByUserID(userID),
                                                                        anUserManager.GetMaxHourByUserID(userID)))
                    {
                        anInterventionViewByUserList.Add(anInterventionViewByUser);
                    }
                }
            }
            return(anInterventionViewByUserList);
        }
예제 #2
0
        public List <ClientWithIntervention> PopulateViewList(List <Client> aClientList)
        {
            // get intervention for each client -> foreach loop for client
            // Populate intervention list
            List <ClientWithIntervention> aClientWithInterventionList = new List <ClientWithIntervention>();

            foreach (Client aClient in aClientList)
            {
                List <Intervention> anInterventionList = anInterventionManager.GetInterventionListByClient(aClient.ClientID);
                foreach (Intervention anIntervention in anInterventionList)
                {
                    ClientWithIntervention aClientWithIntervention = new ClientWithIntervention();
                    aClientWithIntervention.ClientID           = aClient.ClientID;
                    aClientWithIntervention.ClientName         = aClient.ClientName;
                    aClientWithIntervention.ClientAddress      = aClient.Address;
                    aClientWithIntervention.InterventionID     = anIntervention.InterventionID;
                    aClientWithIntervention.InterventionTypeID = anIntervention.InterventionTypeID;
                    aClientWithIntervention.Intervention       = anInterventionTypeManager.GetInterventionNameByTypeId(anIntervention.InterventionTypeID);
                    aClientWithIntervention.InterventionStatus = anIntervention.InterventionState;
                    if (!(aClientWithIntervention.InterventionStatus).Equals("Cancelled"))
                    {
                        aClientWithInterventionList.Add(aClientWithIntervention);
                    }
                }
            }
            return(aClientWithInterventionList);
        }