public void SaveNote_should_save_note() { var clientCompany = new ClientCompany(); var user = new User(); var text = string.Empty; _target.SaveNote(clientCompany, user, text); }
public ClientCompanyViewModel(ClientCompany clientCompany, string state) { if (clientCompany != null) { Id = clientCompany.Id; CompanyName = clientCompany.CompanyName; CompanyId = clientCompany.CompanyId; Status = clientCompany.Status; if (clientCompany.Profile == null) { CompanyAddress = new AddressViewModel(); } else { CompanyAddress = new AddressViewModel(clientCompany.Profile.Address); CompanyAddress.State = state; IsLender = clientCompany.Profile.IsLender; IsAppraiserManagementCompany = clientCompany.Profile.IsAppraiserManagementCompany; IsBroker = clientCompany.Profile.IsBroker; IsOtherBusinessType = clientCompany.Profile.IsOtherBusinessType; IsWholesale = clientCompany.Profile.IsWholesale; } } }
public ClientCompanyStatusViewModel(ClientCompany clientCompany) { if (clientCompany != null) { Status = clientCompany.Status; CompanyId = clientCompany.CompanyId; } }
public void DeleteInstruction(ClientCompany company, string instructionId) { if (company == null) throw new ArgumentNullException("company"); var instructionToDelete = company.CompanyInstructions.SingleOrDefault(i => i.Id.ToString().Equals(instructionId)); if (instructionToDelete != null) company.CompanyInstructions.Remove(instructionToDelete); }
public void SaveNote(ClientCompany clientCompany, User user, string text) { var note = new ClientCompanyAdminNote { Company = clientCompany, Text = text, User = user, Date = DateTime.Now }; _clientCompanyAdminNotesRepository.Add(note); }
public void GetBranchesCount_should_get() { var filter = new BranchesFilter { BranchNamePart = "Branch", CompanyId = "companyId" }; var branch = new ClientCompanyBranche { Name = "Branch", StatusId = Enum.GetName(typeof(ClientCompanyStatus), ClientCompanyStatus.Active), }; var branches = new[] { branch }; var company = new ClientCompany { Branches = branches }; var companies = new[] { company }; _clientCompanyManagement.GetCompanies(Arg.Any<Func<IQueryable<ClientCompany>, IQueryable<ClientCompany>>>()).ReturnsForAnyArgs(companies); _target.GetBranchesCount(filter).Should().Be(1); }
public void GetNotesByCompanyId_should_get_list_of_ClientCompanyAdminNoteViewModel() { var companyId = string.Empty; var noteId = Arg.Any<int>(); var company = new ClientCompany { CompanyId = companyId }; var date = DateTime.Today; var user = new User(); var notets = new[] { new ClientCompanyAdminNote { Id = noteId, Company = company, Date = date, User = user, Text = string.Empty } }; _clientCompanyAdminNotesRepository.GetNotesByCompanyId(companyId).Returns(notets); _target.GetNotesByCompanyId(companyId); }
public void SaveInstruction(ClientCompany company, InstructionItemViewModel viewModel) { if (company == null) throw new ArgumentNullException("company"); if (viewModel == null) throw new ArgumentNullException("InstructionViewModel"); if (company.CompanyInstructions == null) company.CompanyInstructions = new List<ClientCompanyInstruction>(); var instruction = company.CompanyInstructions.SingleOrDefault(i => i.Id.ToString().Equals(viewModel.Id)); if (instruction == null) { instruction = new ClientCompanyInstruction(); company.CompanyInstructions.Add(instruction); } instruction.Text = viewModel.Text; }
public ClientCompanyProfileViewModel(ClientCompany clientCompany) { if (clientCompany != null) { CompanyName = clientCompany.CompanyName; CompanyId = clientCompany.CompanyId; NotificationsEmail = clientCompany.Profile.NotificationsEmail; FaxNumber = clientCompany.Profile.FaxNumber; PhoneNumber = clientCompany.Profile.PhoneNumber; EscalationEmail = clientCompany.Profile.EscalationEmail; IsLender = clientCompany.Profile.IsLender; IsAppraiserManagementCompany = clientCompany.Profile.IsAppraiserManagementCompany; IsBroker = clientCompany.Profile.IsBroker; IsOtherBusinessType = clientCompany.Profile.IsOtherBusinessType; IsRetail = clientCompany.Profile.IsRetail; IsWholesale = clientCompany.Profile.IsWholesale; IsCorrespondent = clientCompany.Profile.IsCorrespondent; IsOtherChannel = clientCompany.Profile.IsOtherChannel; } }
public void SaveClientCompanyLetter(ClientCompany company, ClientCompanyLetterViewModel viewModel) { if (company == null) throw new ArgumentNullException("company"); var companyInstructions = company.CompanyInstructions; var newInstructions = GetLenderSpecialInstructions(viewModel); if (companyInstructions == null) companyInstructions = new Collection<ClientCompanyInstruction>(); var specInstructions = companyInstructions.Where(c => c.ReferenceId.HasValue).ToList(); if (newInstructions.Count > 0) { for (int i = 0; i < specInstructions.Count; i++) { if (newInstructions.Select(a => a.Id).Contains(specInstructions[i].ReferenceId.Value)) continue; companyInstructions.Remove(specInstructions[i]); newInstructions.Remove(specInstructions[i]); } foreach (var clientCompanyInstruction in newInstructions) { companyInstructions.Add(new ClientCompanyInstruction { ReferenceId = clientCompanyInstruction.ReferenceId, Text = clientCompanyInstruction.Text }); } } else { foreach (var spec in specInstructions) { companyInstructions.Remove(spec); } } }
public string SaveClientCompanyProfile(ClientCompanyProfileViewModel viewModel, string clientCompanyId) { var company = _clientCompanyManagement.FindById(viewModel.CompanyId); if (company != null) { viewModel.FillModel(company); _addressManager.FillAddress(company.Profile.Address, viewModel.Address); _addressManager.FillAddress(company.Profile.MailingAddress, viewModel.MailingAddress); } else { var newCompany = new ClientCompany { CompanyId = _clientCompanyIdentityGenerator.Generate(), Status = ClientCompanyStatus.Active, Settings = new ClientCompanySettings() { AppraiserLicenseRequirementsId = 1 /* No Preference */ } }; viewModel.FillModel(newCompany); _addressManager.FillAddress(newCompany.Profile.Address, viewModel.Address); _addressManager.FillAddress(newCompany.Profile.MailingAddress, viewModel.MailingAddress); _clientCompanyManagement.CreateClientCompany(newCompany); clientCompanyId = newCompany.CompanyId; } return clientCompanyId; }
private static ClientCompanyLetterViewModel GetModel(ClientCompany company) { var viewModel = new ClientCompanyLetterViewModel { InstructionsCollection = new InstructionViewModel { LenderInstructions = new List<InstructionItemViewModel>(), CompanyId = company.CompanyId }, Specialnstructions = new List<int>(), }; if (company.CompanyInstructions == null) return viewModel; foreach (var instruction in company.CompanyInstructions) { if (instruction.ReferenceId.HasValue) { viewModel.Specialnstructions.Add(instruction.ReferenceId.Value); } else { viewModel.InstructionsCollection.LenderInstructions.Add(new InstructionItemViewModel { Id = instruction.Id.ToString(), Text = instruction.Text }); } } return viewModel; }
public void GetBranche_should_get() { const string companyId = "companyId"; const int branchId = 1; var branch = new ClientCompanyBranche { Id = branchId, Name = "Branch", StatusId = Enum.GetName(typeof(ClientCompanyBrancheStatus), ClientCompanyBrancheStatus.Active), Address = new Address() }; var branches = new[] { branch }; var company = new ClientCompany { CompanyId = companyId, Branches = branches, StatusId = Enum.GetName(typeof(ClientCompanyStatus), ClientCompanyStatus.Active), }; var companies = new[] { company }; _clientCompanyManagement.GetCompanies(Arg.Any<Func<IQueryable<ClientCompany>, IQueryable<ClientCompany>>>()).ReturnsForAnyArgs(companies); var statuses = new Dictionary<string, string>(); _referenceManagement.GetAllStates().Returns(statuses); _target.GetBranche(companyId, branchId.ToString(CultureInfo.InvariantCulture)); }
public void FillModel(ClientCompany model) { model.Status = Status; }
private ClientCompany GetClientCompany() { var clientCompany = new ClientCompany(); clientCompany.Id = 1; clientCompany.Branches = new List<ClientCompanyBranche> { new ClientCompanyBranche() { Id = 1 } }; return clientCompany; }
public void Update(ClientCompany clientCompany) { _clientCompanyRepository.Update(clientCompany); }
public void CreateClientCompany(ClientCompany clientCompany) { _clientCompanyRepository.Add(clientCompany); }
public void SaveBranche_should_save_if_branch_is_new() { var companyId = "companyId"; var model = new BrancheViewModel { IsNew = true, Address = new AddressViewModel() }; var branch = new ClientCompanyBranche { Name = "Branch", StatusId = Enum.GetName(typeof(ClientCompanyBrancheStatus), ClientCompanyBrancheStatus.Active), Address = new Address() }; var branches = new[] { branch }.ToList(); var company = new ClientCompany { Branches = branches }; var companies = new[] { company }; _clientCompanyManagement.GetCompanies(Arg.Any<Func<IQueryable<ClientCompany>, IQueryable<ClientCompany>>>()).ReturnsForAnyArgs(companies); _target.SaveBranche(model, companyId); }
public void FillModel(ClientCompany model) { if (model.Profile == null) model.Profile = new ClientCompanyProfile(); model.CompanyName = CompanyName; model.Profile.NotificationsEmail = NotificationsEmail; model.Profile.PhoneNumber = PhoneNumber; model.Profile.FaxNumber = FaxNumber; model.Profile.EscalationEmail = EscalationEmail; model.Profile.Address = new Model.Entities.Address(); model.Profile.MailingAddress = new Model.Entities.Address(); model.Profile.IsLender = IsLender; model.Profile.IsRetail = IsRetail; model.Profile.IsAppraiserManagementCompany = IsAppraiserManagementCompany; model.Profile.IsWholesale = IsWholesale; model.Profile.IsBroker = IsBroker; model.Profile.IsCorrespondent = IsCorrespondent; model.Profile.IsOtherBusinessType = IsOtherBusinessType; model.Profile.IsOtherChannel = IsOtherChannel; }
public void SaveBrancheStatus_should_save() { const string companyId = "companyId"; const int branchId = 1; var branch = new ClientCompanyBranche { Id = branchId, Name = "Branch", StatusId = Enum.GetName(typeof(ClientCompanyBrancheStatus), ClientCompanyBrancheStatus.Active), Address = new Address() }; var branches = new[] { branch }; var company = new ClientCompany { CompanyId = companyId, Branches = branches, StatusId = Enum.GetName(typeof(ClientCompanyStatus), ClientCompanyStatus.Active), }; var companies = new[] { company }; _clientCompanyManagement.GetCompanies(Arg.Any<Func<IQueryable<ClientCompany>, IQueryable<ClientCompany>>>()).ReturnsForAnyArgs(companies); var model = new BrancheStatusViewModel { BrancheId = branchId.ToString(CultureInfo.InvariantCulture) }; _target.SaveBrancheStatus(model, companyId); }