/// <summary> /// Upserts the company employee count. /// </summary> /// <param name="count">The count.</param> /// <returns></returns> public Optional <int> UpsertCompanyEmployeeCount(CompanyEmployeeCount count) { using (var connection = GetOpenedSqlConnection2()) { var cmd = GetUpsertGenerator(count) .WithConnection(connection.SqlConnection()) .WithTableName(Tables.CompanyEmployeeCount) .WithMatchColumns(o => o.CompanyId, o => o.CustomerId) .WithSkipColumns(o => o.Id) .WithOutputColumns(o => o.Id) .Verify() .GenerateCommand(); using (var sqlCommand = cmd) { return(ExecuteScalarAndLog <int>(sqlCommand)); } } }
/// <summary> /// Converts to company details. /// </summary> /// <param name="company">The company.</param> /// <param name="customer">The customer.</param> /// <param name="companyEmployeeCount">The company employee count.</param> /// <returns></returns> public CompanyDetailsInfo ConvertToCompanyDetails(Company company, Customer customer, CompanyEmployeeCount companyEmployeeCount) { var companyDetails = new CompanyDetailsInfo(); if (company != null) { companyDetails.TypeOfBusiness = company.TypeOfBusiness; companyDetails.RegistrationNumber = company.CompanyNumber; companyDetails.BusinessName = company.CompanyName; companyDetails.IsVatRegistered = company.VatRegistered; companyDetails.MainPhoneNumber = company.BusinessPhone; } if (customer != null) { companyDetails.IndustryType = customer.PersonalInfo.IndustryType; } if (companyEmployeeCount != null) { companyDetails.NumberOfEmployees = companyEmployeeCount.EmployeeCount; } return(companyDetails); }