public void WriteHeader(PrismCustomerInfoContext context, TypeCustomerInfoFile file) { var line = string.Format("HDR|MTCRCustomerInformation|{0}|{1}", file.FileNumber, file.CrDuns); context.AppendLine(line); }
public void WriteRecord(PrismCustomerInfoContext context, TypeCustomerInfoFile file) { var records = exportDataAccess.ListRecords(file.FileId); foreach (var record in records) { var email = (emailMatch.IsMatch(record.Email)) ? record.Email : string.Empty; var line = string.Format( "DET|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{18}|{19}", record.SequenceId, record.CrDuns, record.PremNo, record.CustNo, alphaNumericExp.Replace(record.FirstName, string.Empty), alphaNumericExp.Replace(record.LastName, string.Empty), alphaNumericExp.Replace(record.CompanyName, string.Empty), alphaNumericExp.Replace(record.ContactName, string.Empty), alphaNumericExp.Replace(record.BillingCareOfName, string.Empty), alphaNumericExp.Replace(record.BillingAddress1, string.Empty), alphaNumericExp.Replace(record.BillingAddress2, string.Empty), alphaNumericExp.Replace(record.BillingCity, string.Empty), record.BillingState, alphaNumericExp.Replace(record.BillingPostalCode, string.Empty), record.BillingCountryCode.Trim().Substring(0, 2), numericExp.Replace(record.PrimaryTelephone, string.Empty), alphaNumericExp.Replace(record.PrimaryTelephoneExt, string.Empty), alphaNumericExp.Replace(record.SecondaryTelephone, string.Empty), numericExp.Replace(record.SecondaryTelephoneExt, string.Empty), email); context.AppendLine(line); } context.AppendLine(string.Format("SUM|{0}|0|0", records.Length)); }