public IList<EmailVO> ListReceiptsByCallLog(string callLogTypeId, int jobId, CS_CallLog callLog, out List<int> callCriteriaIDs) { CS_Job job = new CS_Job(); IList<CS_Employee> lstEmployee = new List<CS_Employee>(); List<CS_Employee> lstEmployeeAux = new List<CS_Employee>(); IList<CS_Contact> lstContacts = new List<CS_Contact>(); IList<EmailVO> lstEmail = new List<EmailVO>(); string emailDomain = string.Empty; SettingsModel model = new SettingsModel(_unitOfWork); emailDomain = model.GetDomain(); CS_CallCriteriaRepository _rep = new CS_CallCriteriaRepository(_callCriteriaRepository, _callCriteriaRepository.UnitOfWork); int callLogID = 0; if (callLog != null) callLogID = callLog.ID; IList<CS_SP_CheckCallCriteria_Result> callCriteriaResult = _rep.CheckCallCriteria(callLogID, int.Parse(callLogTypeId), jobId); IList<int> result = new List<int>(); for (int i = 0; i < callCriteriaResult.Count; i++) { result.Add(callCriteriaResult[i].CallCriteriaID.Value); } callCriteriaIDs = result.ToList(); lstEmployee = _employeeRepository.ListAll(e => e.CS_CallCriteria.Any(f => result.Contains(f.ID) && f.Active)).ToList(); lstContacts = _contactRepository.ListAll(e => e.CS_CallCriteria.Any(f => result.Contains(f.ID) && f.Active)).ToList(); //OLD METHOD //job = _jobRepository.Get(e => e.ID == jobId, new string[] { "CS_JobDivision", "CS_CustomerInfo", "CS_JobInfo", "CS_LocationInfo", "CS_JobDescription" }); //lstEmployee = ListEmployeeCriteriaByDivisionAndCustomer(job); //if (!job.ID.Equals(Globals.GeneralLog.ID)) // lstEmployeeAux = FilterEmployeeByCriteriaValue(lstEmployee, job).ToList(); //if (null != callLog) // lstEmployeeAux.AddRange(VerifyHeavyEquipmentCallCriteria(lstEmployee.ToList(), callLog)); //lstEmployee = lstEmployeeAux.Distinct().ToList(); //lstEmployee = ListEmployeeByCallLogCriteria(callLogTypeId, lstEmployee.ToList()); //for (int i = 0; i < lstEmployee.Count; i++) //{ // CS_EmployeeOffCallHistory offCall = GetActiveOffCallByEmployeeID(lstEmployee[i].ID); // if (null != offCall) // lstEmployee[i] = offCall.CS_Employee_Proxy; //} //lstContacts = ListContactsCriteriaByDivisionAndCustomer(job); //if (!job.ID.Equals(Globals.GeneralLog.ID)) // lstContacts = FilterContactsByCriteriaValue(lstContacts, job); //lstContacts = ListCustomerContactByCallLogCriteria(callLogTypeId, lstContacts.ToList()); //if (null != callLog) // lstContacts = VerifyHeavyEquipmentCallCriteria(lstContacts.ToList(), callLog); for (int i = 0; i < lstEmployee.Count; i++) { if (!string.IsNullOrEmpty(lstEmployee[i].GetEmployeeEmail(emailDomain))) { EmailVO email = new EmailVO(); email.PersonID = lstEmployee[i].ID; email.Name = lstEmployee[i].FullName; email.Email = lstEmployee[i].GetEmployeeEmail(emailDomain); email.Type = (int)Globals.CallCriteria.EmailVOType.Employee; if (!lstEmail.Contains(email, new Globals.EmailService.EmailVO_Comparer())) lstEmail.Add(email); } } for (int i = 0; i < lstContacts.Count; i++) { if (!string.IsNullOrEmpty(lstContacts[i].Email)) { EmailVO email = new EmailVO(); email.PersonID = lstContacts[i].ID; email.Name = lstContacts[i].FullName; email.Email = lstContacts[i].Email; email.Type = (int)Globals.CallCriteria.EmailVOType.Contact; if (!lstEmail.Contains(email, new Globals.EmailService.EmailVO_Comparer())) lstEmail.Add(email); } } return lstEmail; }
/// <summary> /// Gets the Initial Advise Note string based on selected call criteria values /// </summary> /// <param name="isEmployee">If is Hulcher Employee, then TRUE, else FALSE</param> /// <param name="personID">Person Identifier (EmployeeID or ContactID)</param> /// <returns>Initial Advise Note</returns> public string GetInitalAdviseNote(bool isEmployee, int personID) { CS_CallCriteriaRepository repository = new CS_CallCriteriaRepository(_callCriteriaRepository, _unitOfWork); return repository.GetInitialAdviseNote(isEmployee, personID); }