public void Dispose()
        {
            _callCriteriaModel.Dispose();
            _employeeModel.Dispose();

            _callCriteriaModel = null;
        }
 public EmailViewModel(IEmailView view)
 {
     _view = view;
     _callLogModel = new CallLogModel();
     _callCriteriaModel = new CallCriteriaModel();
     _emailModel = new EmailModel();
 }
 public void Dispose()
 {
     _view = null;
     _callLogModel = null;
     _callCriteriaModel = null;
     _emailModel = null;
 }
        /// <summary>
        /// Default Class Constructor
        /// </summary>
        /// <param name="view">Interface View</param>
        public EmployeeMaintenanceViewModel(IEmployeeMaintenanceView view)
        {
            _view = view;

            _callCriteriaModel = new CallCriteriaModel();
            _employeeModel = new EmployeeModel();
        }
        public void Dispose()
        {
            if (_callCriteriaModel != null)
                _callCriteriaModel.Dispose();

            _callCriteriaModel = null;
        }
        /// <summary>
        /// Class Constructor
        /// </summary>
        /// <param name="view">Instance of the CallEntry View Interface</param>
        public CallEntryViewModel(ICallEntryView view)
        {
            _view = view;

            _employeeModel = new EmployeeModel();
            _equipmentModel = new EquipmentModel();
            _callCriteriaModel = new CallCriteriaModel();
        }
        public void Dispose()
        {
            if (_callCriteriaModel != null)
                _callCriteriaModel.Dispose();

            if (_employeeModel != null)
                _employeeModel.Dispose();

            if (_equipmentModel != null)
                _equipmentModel.Dispose();

            _equipmentModel = null;
            _employeeModel = null;
            _callCriteriaModel = null;
        }
        public void TestGenerateBodyCallLogEmail()
        {
            List<CS_CallLog> lstCallLog = new List<CS_CallLog>();

            CS_CallType callType = new CS_CallType { ID = 5, Active = true, Description = "Call Type 1" };

            DateTime dt = new DateTime(2011, 05, 10, 1, 11, 22);

            CS_CallLog callLog = new CS_CallLog
                                     {
                                         ID = 1,
                                         Active = true,
                                         CS_CallType = callType,
                                         CallDate = dt,
                                         Note = "Here is the field note."
                                     };

            lstCallLog.Add(callLog);

            //Arrange
            FakeObjectSet<CS_CallLog> fakeCallLog = new FakeObjectSet<CS_CallLog>();
            fakeCallLog.AddObject(callLog);

            Mock<IUnitOfWork> mockUnitOfWork = new Mock<IUnitOfWork>();
            mockUnitOfWork.Setup(w => w.CreateObjectSet<CS_CallLog>()).Returns(fakeCallLog);
            CallCriteriaModel model = new CallCriteriaModel(mockUnitOfWork.Object);

            //Act
            string body = model.GenerateBodyCallLogEmail(lstCallLog);

            StringBuilder sb = new StringBuilder();
            sb.Append("<div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Call Type:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append("Call Type 1");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Call Date:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append("05/10/2011");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Call Time:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append("1:11");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Here is the field note.");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</div>");

            //Assert
            Assert.AreEqual(sb.ToString(), body);
        }
        /// <summary>
        /// Load data for call criteria
        /// </summary>
        public void ListAllEmployeeCallLogInfoCallCriteria()
        {
            try
            {
                if (_view.JobId.HasValue && _view.CallID.HasValue)
                {
                    IList<CS_CallLogResource> resources = new List<CS_CallLogResource>();

                    using (_callLogModel = new CallLogModel())
                    {
                        resources = _callLogModel.ListCallLogResourceByCallEntry(_view.CallID.Value);
                    }

                    List<CallCriteriaResourceVO> source = new List<CallCriteriaResourceVO>();

                    for (int i = 0; i < resources.Count; i++)
                    {
                        if (resources[i].Type == (int)Globals.CallCriteria.EmailVOType.Employee)
                        {
                            using (_employeeModel = new EmployeeModel())
                            {
                                source.Add(_employeeModel.GetEmployeeDataForInitialAdvise(resources[i].EmployeeID.Value, _view.CallID.Value));
                            }
                        }
                        else
                        {
                            using (_customerModel = new CustomerModel())
                            {
                                source.Add(_customerModel.GetContactDataForInitialAdvise(resources[i].ContactID.Value, _view.CallID.Value));
                            }
                        }
                    }

                    _view.PersonInitialAdviseGridDataSource = source;
                }
                else
                {
                    IList<EmailVO> resourceList = new List<EmailVO>();
                    List<CallCriteriaResourceVO> source = new List<CallCriteriaResourceVO>();
                    List<int> callCriteriasIDs = new List<int>();

                    using (_callCriteriaModel = new CallCriteriaModel())
                    {
                        resourceList = _callCriteriaModel.ListReceiptsByCallLog(_view.SelectedCallType.ID.ToString(), _view.JobId.Value, null, out callCriteriasIDs);
                        _view.CallCriteriaIDs = callCriteriasIDs;
                    }

                    for (int i = 0; i < resourceList.Count; i++)
                    {
                        if (resourceList[i].Type == (int)Globals.CallCriteria.EmailVOType.Employee)
                        {
                            using (_employeeModel = new EmployeeModel())
                            {
                                source.Add(_employeeModel.GetEmployeeDataForInitialAdvise(resourceList[i].PersonID));
                            }
                        }
                        else
                        {
                            using (_customerModel = new CustomerModel())
                            {
                                source.Add(_customerModel.GetContactDataForInitialAdvise(resourceList[i].PersonID));
                            }
                        }
                    }

                    _view.PersonInitialAdviseGridDataSource = source;
                }
            }
            catch (Exception ex)
            {
                Logger.Write(string.Format("An Error has ocurred while trying to List .\n{0}\n{1}", ex.Message, ex.StackTrace));
                _view.DisplayMessage("An Internal Error has ocurred while trying to load the Information. Please try again.", false);
            }
        }
        public void TestIfSubjectIsCorrectForGeneralLog()
        {
            // Arrange
            CS_Job job = new CS_Job()
            {
                ID = 1,
                Number = "99999",
                Active = true
            };
            string callType = "Call Type Description";

            // Act
            CallCriteriaModel model = new CallCriteriaModel();
            string result = model.GenerateSubjectForCallCriteria(job, null, null, null, callType);

            // Assert
            string expectedResult = "99999 - General Log - Call Type Description";
            Assert.AreEqual(expectedResult, result);
        }
        public void TestIfSubjectIsCorrect()
        {
            // Arrange
            CS_JobInfo jobInfo = new CS_JobInfo()
            {
                JobID = 2,
                CS_Job_JobStatus = new EntityCollection<CS_Job_JobStatus>() { new CS_Job_JobStatus() { ID = 1, JobID = 2, JobStatusId = 1, Active = true } },
                CS_PriceType = new CS_PriceType() { ID = 1, Acronym = "P", Active = true },
                CS_JobType = new CS_JobType() { ID = 1, Description = "C", Active = true },
                CS_JobAction = new CS_JobAction() { ID = 1, Description = "Action", Active = true }
            };
            CS_Job job = new CS_Job()
            {
                ID = 2, Number = "000001", Active = true,
                CS_JobInfo = jobInfo
            };
            CS_CustomerInfo customerInfo = new CS_CustomerInfo()
            {
                JobId = 2,
                CS_Customer = new CS_Customer() { ID = 1, Name = "Customer Name", Active = true }
            };
            CS_LocationInfo locationInfo = new CS_LocationInfo()
            {
                JobID = 2,
                CS_City = new CS_City() { ID = 1, Name = "City", Active = true },
                CS_State = new CS_State() { ID = 1, Acronym = "ST", Active = true }
            };
            string callType = "Call Type Description";

            // Act
            CallCriteriaModel model = new CallCriteriaModel();
            string result = model.GenerateSubjectForCallCriteria(job, jobInfo, customerInfo, locationInfo, callType);

            // Assert
            string expectedResult = "PC000001, Customer Name, Action, City ST, Call Type Description";
            Assert.AreEqual(expectedResult, result);
        }
Exemplo n.º 12
0
        public void Dispose()
        {
            _customerRepository = null;
            _contactRepository = null;
            _contractRepository = null;
            _customerInfoRepository = null;
            _requestRepository = null;
            _phoneNumberRepository = null;

            _callCriteriaModel.Dispose();
            _callCriteriaModel = null;

            _unitOfWork.Dispose();
            _unitOfWork = null;
        }
        /// <summary>
        /// Unit Tests Class constructor
        /// </summary>
        /// <param name="view">Interface View</param>
        /// <param name="callCriteriaModel">Mocked model</param>
        public CustomerMaintenanceViewModel(ICustomerMaintenanceView view, CallCriteriaModel callCriteriaModel)
        {
            _view = view;

            _callCriteriaModel = callCriteriaModel;
        }
        public void Dispose()
        {
            _resourceRepository = null;
            _reserveRepository = null;
            _resourceCallLogInfoRepository = null;
            _callLogRepository = null;
            _jobRepository = null;
            _resourceAllocationDetailsRepository = null;

            _callLogModel.Dispose();
            _callLogModel = null;
            _callCriteriaModel.Dispose();
            _callCriteriaModel = null;

            _unitOfWork.Dispose();
            _unitOfWork = null;
        }
        public void TestSaveEmployeeCriteria()
        {
            CallCriteriaModel model = new CallCriteriaModel(new FakeUnitOfWork());

            CS_CallCriteria newCriteria = new CS_CallCriteria()
            {
                EmployeeID = 1
            };

            FakeObjectSet<CS_CallCriteriaValue> newCriteriaValueList = new FakeObjectSet<CS_CallCriteriaValue>();
            newCriteriaValueList.AddObject(new CS_CallCriteriaValue()
            {
                CallCriteriaTypeID = 1,
                Value = "Test"
            });

            newCriteriaValueList.AddObject(new CS_CallCriteriaValue()
            {
                CallCriteriaTypeID = 2,
                Value = "Test2"
            });

            Assert.IsTrue(model.SaveCriteria(newCriteria, newCriteriaValueList.ToList(), "Testing"), "Test finalized with no Exceptions but, there may be errors in the Data inside");
        }
Exemplo n.º 16
0
        private void InstanceObjects()
        {
            _jobRepository = new CachedRepository<CS_Job>();
            _jobRepository.UnitOfWork = _unitOfWork;

            _jobStatusRepository = new CachedRepository<CS_JobStatus>();
            _jobStatusRepository.UnitOfWork = _unitOfWork;

            _jobDivisionRepository = new EFRepository<CS_JobDivision>();
            _jobDivisionRepository.UnitOfWork = _unitOfWork;

            _priceTypeRepository = new CachedRepository<CS_PriceType>();
            _priceTypeRepository.UnitOfWork = _unitOfWork;

            _jobCategoryRepository = new CachedRepository<CS_JobCategory>();
            _jobCategoryRepository.UnitOfWork = _unitOfWork;

            _jobTypeRepository = new CachedRepository<CS_JobType>();
            _jobTypeRepository.UnitOfWork = _unitOfWork;

            _jobActionRepository = new CachedRepository<CS_JobAction>();
            _jobActionRepository.UnitOfWork = _unitOfWork;

            _lostJobReasonRepository = new CachedRepository<CS_LostJobReason>();
            _lostJobReasonRepository.UnitOfWork = _unitOfWork;

            _competitorRepository = new EFRepository<CS_Competitor>();
            _competitorRepository.UnitOfWork = _unitOfWork;

            _frequencyRepository = new CachedRepository<CS_Frequency>();
            _frequencyRepository.UnitOfWork = _unitOfWork;

            _customerInfoRepository = new EFRepository<CS_CustomerInfo>();
            _customerInfoRepository.UnitOfWork = _unitOfWork;

            _jobDescriptionRepository = new EFRepository<CS_JobDescription>();
            _jobDescriptionRepository.UnitOfWork = _unitOfWork;

            _scopeOfWorkRepository = new EFRepository<CS_ScopeOfWork>();
            _scopeOfWorkRepository.UnitOfWork = _unitOfWork;

            _locationInfoRepository = new EFRepository<CS_LocationInfo>();
            _locationInfoRepository.UnitOfWork = _unitOfWork;

            _jobPhotoReportRepository = new EFRepository<CS_JobPhotoReport>();
            _jobPhotoReportRepository.UnitOfWork = _unitOfWork;

            _presetInfoRepository = new EFRepository<CS_PresetInfo>();
            _presetInfoRepository.UnitOfWork = _unitOfWork;

            _lostJobInfoRepository = new EFRepository<CS_LostJobInfo>();
            _lostJobInfoRepository.UnitOfWork = _unitOfWork;

            _specialPricingRepository = new EFRepository<CS_SpecialPricing>();
            _specialPricingRepository.UnitOfWork = _unitOfWork;

            _jobInfoRepository = new EFRepository<CS_JobInfo>();
            _jobInfoRepository.UnitOfWork = _unitOfWork;

            _jobStatusHistoryRepository = new EFRepository<CS_Job_JobStatus>();
            _jobStatusHistoryRepository.UnitOfWork = _unitOfWork;

            _jobPermitRepository = new EFRepository<CS_JobPermit>();
            _jobPermitRepository.UnitOfWork = _unitOfWork;

            _divisionRepository = new EFRepository<CS_Division>();
            _divisionRepository.UnitOfWork = _unitOfWork;

            _employeeRepository = new EFRepository<CS_Employee>();
            _employeeRepository.UnitOfWork = _unitOfWork;

            _customerRepository = new EFRepository<CS_Customer>();
            _customerRepository.UnitOfWork = _unitOfWork;

            _cityRepository = new EFRepository<CS_City>();
            _cityRepository.UnitOfWork = _unitOfWork;

            _stateRepository = new EFRepository<CS_State>();
            _stateRepository.UnitOfWork = _unitOfWork;

            _countryRepository = new EFRepository<CS_Country>();
            _countryRepository.UnitOfWork = _unitOfWork;

            _zipCodeRepository = new EFRepository<CS_ZipCode>();
            _zipCodeRepository.UnitOfWork = _unitOfWork;

            _contactRepository = new EFRepository<CS_Contact>();
            _contactRepository.UnitOfWork = _unitOfWork;

            _callLogRepository = new EFRepository<CS_CallLog>();
            _callLogRepository.UnitOfWork = _unitOfWork;

            _jobPermitTypeRepository = new CachedRepository<CS_JobPermitType>();
            _jobPermitTypeRepository.UnitOfWork = _unitOfWork;

            _jobSummaryRepository = new EFRepository<CS_View_JobSummary>();
            _jobSummaryRepository.UnitOfWork = _unitOfWork;

            _callLogResourceRepository = new EFRepository<CS_CallLogResource>();
            _callLogResourceRepository.UnitOfWork = _unitOfWork;

            _callLogCallCriteriaEmailRepository = new EFRepository<CS_CallLogCallCriteriaEmail>();
            _callLogCallCriteriaEmailRepository.UnitOfWork = _unitOfWork;

            _turnoverActiveReportRepository = new EFRepository<CS_View_TurnoverActiveReport>();
            _turnoverActiveReportRepository.UnitOfWork = _unitOfWork;

            _turnoverNonActiveReportRepository = new EFRepository<CS_View_TurnoverNonActiveReport>();
            _turnoverNonActiveReportRepository.UnitOfWork = _unitOfWork;

            _jobLocalEquipmentTypeRepository = new EFRepository<CS_Job_LocalEquipmentType>();
            _jobLocalEquipmentTypeRepository.UnitOfWork = _unitOfWork;

            _settingsModel = new SettingsModel(_unitOfWork);
            _emailModel = new EmailModel(_unitOfWork);
            _callCriteriaModel = new CallCriteriaModel(_unitOfWork);

            _mailList = new List<CS_ScopeOfWork>();
            _divisionList = new List<CS_JobDivision>();

            _mailScope = new StringBuilder();
            _mailBillingBuilder = new StringBuilder();

            _jobDataRepository = new EFRepository<CS_View_GetJobData>();
            _jobDataRepository.UnitOfWork = _unitOfWork;

            _jobLocalEquipmentTypeRepository = new EFRepository<CS_Job_LocalEquipmentType>();
            _jobLocalEquipmentTypeRepository.UnitOfWork = _unitOfWork;

            _projectCalendarAllocationRepository = new EFRepository<CS_View_ProjectCalendar_Allocation>();
            _projectCalendarAllocationRepository.UnitOfWork = _unitOfWork;

            _projectCalendarReservedRepository = new EFRepository<CS_View_ProjectCalendar_Reserved>();
            _projectCalendarReservedRepository.UnitOfWork = _unitOfWork;

            _projectCalendarCallLogRepository = new EFRepository<CS_View_ProjectCalendar_CallLog>();
            _projectCalendarCallLogRepository.UnitOfWork = _unitOfWork;
        }
Exemplo n.º 17
0
 /// <summary>
 /// Metod that intances all attribute objects
 /// </summary>
 private void InstanceObjects()
 {
     _firstAlertRepository = new EFRepository<CS_FirstAlert> { UnitOfWork = _unitOfWork };
     _firstAlertPersonRepository = new EFRepository<CS_FirstAlertPerson> { UnitOfWork = _unitOfWork };
     _firstAlertVehicleRepository = new EFRepository<CS_FirstAlertVehicle> { UnitOfWork = _unitOfWork };
     _firstAlertDivisionRepository = new EFRepository<CS_FirstAlertDivision> { UnitOfWork = _unitOfWork };
     _callLogRepository = new EFRepository<CS_CallLog> { UnitOfWork = _unitOfWork };
     _settingsModel = new SettingsModel(_unitOfWork);
     _callCriteriaModel = new CallCriteriaModel(_unitOfWork);
     _callLogResourceRepository = new EFRepository<CS_CallLogResource> { UnitOfWork = _unitOfWork };
     _callLogCallCriteriaEmailRepository = new EFRepository<CS_CallLogCallCriteriaEmail> { UnitOfWork = _unitOfWork };
     _firstAlertTypeRepository = new EFRepository<CS_FirstAlertType> { UnitOfWork = _unitOfWork };
     _firstAlertFirstAlertTypeRepository = new EFRepository<CS_FirstAlertFirstAlertType> { UnitOfWork = _unitOfWork };
     _firstAlertContactPersonalRepository = new EFRepository<CS_FirstAlertContactPersonal> { UnitOfWork = _unitOfWork };
     _firstAlertReportRepository = new EFRepository<CS_View_FirstAlertReport> { UnitOfWork = _unitOfWork };
     _firstAlertReportHulcherVehicleRepository = new EFRepository<CS_View_FirstAlertReportHulcherVehicles> { UnitOfWork = _unitOfWork };
     _firstAlertReportOtherVehicleRepository = new EFRepository<CS_View_FirstAlertReportOtherVehicle> { UnitOfWork = _unitOfWork };
     _firstAlertReportContactPersonalViewRepository = new EFRepository<CS_View_FirstAlertReportContactPersonal> { UnitOfWork = _unitOfWork };
 }
        public CallCriteriaInfoViewModel(ICallCriteriaInfoView view)
        {
            _view = view;

            _callCriteriaModel = new CallCriteriaModel();
        }
        public void TestFilterEmployeeByCriteriaValueJobCategory()
        {
            FakeObjectSet<CS_CallCriteriaValue> fakecallcriteriavalues = new FakeObjectSet<CS_CallCriteriaValue>();

            fakecallcriteriavalues.AddObject
                    (
                        new CS_CallCriteriaValue()
                        {
                            Active = true,
                            CallCriteriaID = 1,
                            CallCriteriaTypeID = (int)Globals.CallCriteria.CallCriteriaType.JobCategory,
                            Value = (4).ToString(),
                            CS_CallCriteria = new CS_CallCriteria()
                            {
                                EmployeeID = 1,
                                ID = 1,
                                Active = true
                            }
                        }
                    );

            IList<CS_Employee> lstEmployeeBase = new List<CS_Employee>
            {
                new CS_Employee()
                {
                    ID = 1,
                    CS_CallCriteria = new EntityCollection<CS_CallCriteria>()
                    {
                        new CS_CallCriteria()
                        {
                            EmployeeID = 1,
                            ID = 1,
                            Active = true,
                            CS_CallCriteriaValue = new EntityCollection<CS_CallCriteriaValue>()
                            {
                                new CS_CallCriteriaValue()
                                {
                                    Active = true,
                                    CallCriteriaID = 1,
                                    CallCriteriaTypeID = (int)Globals.CallCriteria.CallCriteriaType.Customer,
                                    Value = "1090"
                                },
                                new CS_CallCriteriaValue()
                                {
                                    Active = true,
                                    CallCriteriaID = 1,
                                    CallCriteriaTypeID = (int)Globals.CallCriteria.CallCriteriaType.Division,
                                    Value = "1"
                                }
                            }
                        }
                    }
                }
            };

            IList<CS_Employee> lstEmployee = lstEmployeeBase;

            CS_Job job = new CS_Job()
            {
                ID = 1,
                CS_JobInfo = new CS_JobInfo() { JobID = 1, JobCategoryID = 4 },
                CS_JobDivision = new EntityCollection<CS_JobDivision>() { new CS_JobDivision() { JobID = 1, DivisionID = 1 } },
                CS_CustomerInfo = new CS_CustomerInfo() { JobId = 1, CustomerId = 1090 },
                CS_LocationInfo = new CS_LocationInfo(),
                CS_JobDescription = new CS_JobDescription()
            };

            Mock<IUnitOfWork> mockUnitOfWork = new Mock<IUnitOfWork>();
            mockUnitOfWork.Setup(w => w.CreateObjectSet<CS_CallCriteriaValue>()).Returns(fakecallcriteriavalues);
            CallCriteriaModel model = new CallCriteriaModel(mockUnitOfWork.Object);

            lstEmployee = model.FilterEmployeeByCriteriaValue(lstEmployeeBase, job);

            Assert.AreEqual(1, lstEmployee.Count);
        }
        public void TestFilterContactByCriteriaValuePriceTypeNoCriteria()
        {
            FakeObjectSet<CS_CallCriteriaValue> fakecallcriteriavalues = new FakeObjectSet<CS_CallCriteriaValue>();

            fakecallcriteriavalues.AddObject
                    (
                        new CS_CallCriteriaValue()
                        {
                            Active = true,
                            CallCriteriaID = 1,
                            CallCriteriaTypeID = (int)Globals.CallCriteria.CallCriteriaType.PriceType,
                            Value = ((int)Globals.JobRecord.PriceType.PublishedRates).ToString(),
                            CS_CallCriteria = new CS_CallCriteria()
                            {
                                ContactID = 2,
                                ID = 1,
                                Active = true
                            }
                        }
                    );

            IList<CS_Contact> lstContactBase = new List<CS_Contact>
            {
                new CS_Contact()
                {
                    ID = 1,
                    CS_CallCriteria = new EntityCollection<CS_CallCriteria>()
                    {
                        new CS_CallCriteria()
                        {
                            ContactID = 1,
                            ID = 1,
                            Active = true,
                            CS_CallCriteriaValue = new EntityCollection<CS_CallCriteriaValue>()
                            {
                                new CS_CallCriteriaValue()
                                {
                                    Active = true,
                                    CallCriteriaID = 1,
                                    CallCriteriaTypeID = (int)Globals.CallCriteria.CallCriteriaType.Customer,
                                    Value = "1090"
                                },
                                new CS_CallCriteriaValue()
                                {
                                    Active = true,
                                    CallCriteriaID = 1,
                                    CallCriteriaTypeID = (int)Globals.CallCriteria.CallCriteriaType.Division,
                                    Value = "1"
                                }
                            }
                        }
                    }
                }
            };

            IList<CS_Contact> lstContact = lstContactBase;

            CS_Job job = new CS_Job()
            {
                ID = 1,
                CS_JobInfo = new CS_JobInfo() { JobID = 1, PriceTypeID = (int)Globals.JobRecord.PriceType.PublishedRates },
                CS_JobDivision = new EntityCollection<CS_JobDivision>() { new CS_JobDivision() { JobID = 1, DivisionID = 1 } },
                CS_CustomerInfo = new CS_CustomerInfo() { JobId = 1, CustomerId = 1090 },
                CS_LocationInfo = new CS_LocationInfo(),
                CS_JobDescription = new CS_JobDescription()
            };

            Mock<IUnitOfWork> mockUnitOfWork = new Mock<IUnitOfWork>();
            mockUnitOfWork.Setup(w => w.CreateObjectSet<CS_CallCriteriaValue>()).Returns(fakecallcriteriavalues);
            CallCriteriaModel model = new CallCriteriaModel(mockUnitOfWork.Object);

            lstContact = model.FilterContactsByCriteriaValue(lstContactBase, job);

            Assert.AreEqual(1, lstContact.Count);
        }
 /// <summary>
 /// Gets the Initial advise Note
 /// </summary>
 public void GetInitialAdviseNote()
 {
     try
     {
         using (_callCriteriaModel = new CallCriteriaModel())
         {
             string initialAdvise = _callCriteriaModel.GetInitalAdviseNote(_view.AdviseNoteIsEmployee, _view.AdviseNoteResourceID);
             if (!string.IsNullOrEmpty(initialAdvise))
             {
                 initialAdvise = initialAdvise.Replace(":", ":<Text>").Replace(";", "<BL>");
                 _view.AdviseNote = StringManipulation.TabulateString(initialAdvise);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Write(string.Format("An Error has ocurred while trying to get the Resource Initial Advise Note.\n{0}\n{1}", ex.Message, ex.StackTrace));
         _view.DisplayMessage("An Internal Error has ocurred while trying to get the Resource Initial Advise Note. Please try again.", false);
     }
 }
Exemplo n.º 22
0
        public CustomerModel(IUnitOfWork unitOfWork)
        {
            _unitOfWork = unitOfWork;

            _customerRepository = new EFRepository<CS_Customer>();
            _customerRepository.UnitOfWork = _unitOfWork;

            _contactRepository = new EFRepository<CS_Contact>();
            _contactRepository.UnitOfWork = _unitOfWork;

            _contractRepository = new EFRepository<CS_CustomerContract>();
            _contractRepository.UnitOfWork = _unitOfWork;

            _customerInfoRepository = new EFRepository<CS_CustomerInfo>();
            _customerInfoRepository.UnitOfWork = _unitOfWork;

            _callCriteriaRepository = new EFRepository<CS_CallCriteria>();
            _callCriteriaRepository.UnitOfWork = _unitOfWork;

            _callCriteriaValueRepository = new EFRepository<CS_CallCriteriaValue>();
            _callCriteriaValueRepository.UnitOfWork = _unitOfWork;

            _customerContactRepository = new EFRepository<CS_Customer_Contact>();
            _customerContactRepository.UnitOfWork = _unitOfWork;

            _callLogResourceRepository = new EFRepository<CS_CallLogResource>();
            _callLogResourceRepository.UnitOfWork = _unitOfWork;

            _requestRepository = new EFRepository<CS_Request>();
            _requestRepository.UnitOfWork = _unitOfWork;

            _phoneNumberRepository = new EFRepository<CS_PhoneNumber>();
            _phoneNumberRepository.UnitOfWork = _unitOfWork;

            _customerSpecificInfoTypeRepository = new EFRepository<CS_CustomerSpecificInfoType>();
            _customerSpecificInfoTypeRepository.UnitOfWork = _unitOfWork;

            _customerContactPhoneRepository = new EFRepository<CS_View_Customer_Contact_Phone>();
            _customerContactPhoneRepository.UnitOfWork = _unitOfWork;

            _callCriteriaModel = new CallCriteriaModel(_unitOfWork);
        }
Exemplo n.º 23
0
 /// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="unitOfWork">Unit of Work instance (used for unit tests)</param>
 public EquipmentModel(IUnitOfWork unitOfWork)
 {
     _equipmentTypeRepository = new EFRepository<CS_EquipmentType> { UnitOfWork = unitOfWork };
     _viewReserveEquipmentRepository = new EFRepository<CS_View_ReserveEquipment> { UnitOfWork = unitOfWork };
     _equipmentInfoRepository = new EFRepository<CS_View_EquipmentInfo> { UnitOfWork = unitOfWork };
     _equipmentRepository = new EFRepository<CS_Equipment> { UnitOfWork = unitOfWork };
     _callLogRepository = new EFRepository<CS_CallLog> { UnitOfWork = unitOfWork };
     _callLogResourceRepository = new EFRepository<CS_CallLogResource> { UnitOfWork = unitOfWork };
     _equipmentComboRepository = new EFRepository<CS_EquipmentCombo> { UnitOfWork = unitOfWork };
     _equipmentPermitRepository = new EFRepository<CS_EquipmentPermit> { UnitOfWork = unitOfWork };
     _equipmentDownHistoryRepository = new EFRepository<CS_EquipmentDownHistory> { UnitOfWork = unitOfWork };
     _equipmentCoverageRepository = new EFRepository<CS_EquipmentCoverage> { UnitOfWork = unitOfWork };
     _conflictedCombosRepository = new EFRepository<CS_View_ConflictedEquipmentCombos> { UnitOfWork = unitOfWork };
     _equipmentWhiteLightRepository = new EFRepository<CS_EquipmentWhiteLight> { UnitOfWork = unitOfWork };
     _equipmentPermitEmailRepository = new EFRepository<CS_EquipmentPermitEmail> { UnitOfWork = unitOfWork };
     _resourceRepository = new EFRepository<CS_Resource> { UnitOfWork = unitOfWork };
     _localEquipmentTypeRepository = new CachedRepository<CS_LocalEquipmentType> { UnitOfWork = unitOfWork };
     _jobRepository = new EFRepository<CS_Job> { UnitOfWork = _unitOfWork };
     _callCriteriaModel = new CallCriteriaModel(_unitOfWork);
 }
        public void TestListEmployeeCriteriaByDivisionAndCustomer()
        {
            FakeObjectSet<CS_Employee> fakeemployee = new FakeObjectSet<CS_Employee>();
            fakeemployee.AddObject(
                new CS_Employee()
                {
                    ID = 1,
                    CS_CallCriteria = new EntityCollection<CS_CallCriteria>()
                    {
                        new CS_CallCriteria()
                        {
                            EmployeeID = 1,
                            ID = 1,
                            Active = true,
                            CS_CallCriteriaValue = new EntityCollection<CS_CallCriteriaValue>()
                            {
                                new CS_CallCriteriaValue()
                                {
                                    Active = true,
                                    CallCriteriaID = 1,
                                    CallCriteriaTypeID = 1,
                                    Value = "1090"
                                },
                                new CS_CallCriteriaValue()
                                {
                                    Active = true,
                                    CallCriteriaID = 1,
                                    CallCriteriaTypeID = 2,
                                    Value = "1"
                                }
                            }
                        }
                    }
                });

            CS_Job job = new CS_Job()
            {
                ID = 3,
                CS_JobDivision = new EntityCollection<CS_JobDivision>() { new CS_JobDivision() { JobID = 3, DivisionID = 1 } },
                CS_CustomerInfo = new CS_CustomerInfo() { JobId = 3, CustomerId = 1090 }
            };

            Mock<IUnitOfWork> mockUnitOfWork = new Mock<IUnitOfWork>();
            mockUnitOfWork.Setup(w => w.CreateObjectSet<CS_Employee>()).Returns(fakeemployee);
            CallCriteriaModel model = new CallCriteriaModel(mockUnitOfWork.Object);

            IList<CS_Employee> lstEmployee = model.ListEmployeeCriteriaByDivisionAndCustomer(job);

            Assert.AreEqual(1, lstEmployee.Count);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Dispose all objects that are no longer needed
        /// </summary>
        public void Dispose()
        {
            _firstAlertRepository = null;
            _firstAlertPersonRepository = null;
            _firstAlertVehicleRepository = null;
            _firstAlertDivisionRepository = null;
            _callLogRepository = null;
            _callLogResourceRepository = null;
            _callLogCallCriteriaEmailRepository = null;
            _firstAlertTypeRepository = null;
            _firstAlertFirstAlertTypeRepository = null;

            _settingsModel.Dispose();
            _settingsModel = null;
            _callCriteriaModel.Dispose();
            _callCriteriaModel = null;

            _unitOfWork.Dispose();
            _unitOfWork = null;
        }
Exemplo n.º 26
0
        /// <summary>
        /// Instance objects
        /// </summary>
        private void InstanceObjects()
        {
            _employeeRepository = new CachedRepository<CS_Employee>();
            _employeeOffCallRepository = new EFRepository<CS_EmployeeOffCallHistory>();
            _employeeCoverageRepository = new EFRepository<CS_EmployeeCoverage>();
            _employeeInfoRepository = new EFRepository<CS_View_EmployeeInfo>();
            _employeeCallLogInfoRepository = new EFRepository<CS_View_Employee_CallLogInfo>();
            _divisionRepository = new EFRepository<CS_Division>();
            _employeeEmergencyContactRepository = new EFRepository<CS_EmployeeEmergencyContact>();
            _customerInfoRepository = new EFRepository<CS_CustomerInfo>();
            _contactRepository = new EFRepository<CS_Contact>();
            _callCriteriaRepository = new EFRepository<CS_CallCriteria>();
            _callCriteriaValueRepository = new EFRepository<CS_CallCriteriaValue>();
            _callLogRepository = new EFRepository<CS_CallLog>();
            _callLogResourceRepository = new EFRepository<CS_CallLogResource>();
            _resourceRepository = new EFRepository<CS_Resource>();
            _phoneTypeRepository = new EFRepository<CS_PhoneType>();
            _phoneNumberRepository = new EFRepository<CS_PhoneNumber>();
            _managersLocationRepository = new EFRepository<CS_View_ManagersLocation>();

            _employeeRepository.UnitOfWork = _unitOfWork;
            _employeeOffCallRepository.UnitOfWork = _unitOfWork;
            _employeeCoverageRepository.UnitOfWork = _unitOfWork;
            _employeeInfoRepository.UnitOfWork = _unitOfWork;
            _employeeCallLogInfoRepository.UnitOfWork = _unitOfWork;
            _divisionRepository.UnitOfWork = _unitOfWork;
            _employeeEmergencyContactRepository.UnitOfWork = _unitOfWork;
            _customerInfoRepository.UnitOfWork = _unitOfWork;
            _contactRepository.UnitOfWork = _unitOfWork;
            _callCriteriaRepository.UnitOfWork = _unitOfWork;
            _callCriteriaValueRepository.UnitOfWork = _unitOfWork;
            _callLogRepository.UnitOfWork = _unitOfWork;
            _callLogResourceRepository.UnitOfWork = _unitOfWork;
            _resourceRepository.UnitOfWork = _unitOfWork;
            _phoneTypeRepository.UnitOfWork = _unitOfWork;
            _phoneNumberRepository.UnitOfWork = _unitOfWork;
            _managersLocationRepository.UnitOfWork = _unitOfWork;

            _callCriteriaModel = new CallCriteriaModel(_unitOfWork);
            _settingsModel = new SettingsModel(_unitOfWork);
            _emailModel = new EmailModel(_unitOfWork);
            _callLogModel = new CallLogModel(_unitOfWork);
        }
        public void BindCallcriteriaListing()
        {
            try
            {
                CallCriteriaModel _model = new CallCriteriaModel();

                if (_view.EmployeeID.HasValue)
                {
                    _view.CallCriteriaList = _model.FindCallCriteriaByEmployee(_view.EmployeeID.Value);
                    _view.CallCriteriaEditable(true);
                }
                else if (_view.ContactID.HasValue)
                {
                    _view.CallCriteriaList = _model.FindCallCriteriaByContact(_view.ContactID.Value);
                    _view.CallCriteriaEditable(true);
                }

                if (_view.CallCriteriaList != null)
                {
                    _view.CallCriteriaRepeaterDataSource = _view.CallCriteriaList;
                    if (_view.CallCriteriaList.Count > 0)
                        _view.ShowHidePanelNowRowsCcListing = false;
                    else
                        _view.ShowHidePanelNowRowsCcListing = true;
                }

            }
            catch (Exception ex)
            {
                Logger.Write(string.Format("An Error has ocurred while trying to get the Call Criteria Listing info.\n{0}\n{1}", ex.Message, ex.StackTrace));
                _view.DisplayMessage("An Internal Error has ocurred while trying to get the Call Criteria Listing info.", false);
            }
        }
        private void InstanceObjects()
        {
            _reserveRepository = new EFRepository<CS_Reserve>() { UnitOfWork = _unitOfWork };
            _resourceRepository = new EFRepository<CS_Resource>() { UnitOfWork = _unitOfWork };
            _resourceCallLogInfoRepository = new EFRepository<CS_View_Resource_CallLogInfo>() { UnitOfWork = _unitOfWork };
            _callLogRepository = new EFRepository<CS_CallLog>() { UnitOfWork = _unitOfWork };
            _callLogResourceRepository = new EFRepository<CS_CallLogResource>() { UnitOfWork = _unitOfWork };
            _jobRepository = new EFRepository<CS_Job>() { UnitOfWork = _unitOfWork };
            _jobDivisionRepository = new EFRepository<CS_JobDivision>() { UnitOfWork = _unitOfWork };
            _reserveListRepository = new EFRepository<CS_View_ReserveList>() { UnitOfWork = _unitOfWork };
            _resourceAllocationDetailsRepository = new EFRepository<CS_ResourceAllocationDetails>() { UnitOfWork = _unitOfWork };

            _callLogModel = new CallLogModel(_unitOfWork);
            _callCriteriaModel = new CallCriteriaModel(_unitOfWork);
        }