Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
{
var correspondenceList = DbContext.CorresTaxes.Where(ct => ct.StatusCD == CorrespondanceConstants.Post && CorrespondenceIdsToProcess.Contains(ct.CorrespondenceID))
.Join(DbContext.TaxTmplInstProps, ct => ct.TaxTmplInstPropID, ttpd => ttpd.TaxTmplInstPropID,
(ct, ttpd) => new { CorrespondenceId = ct.CorrespondenceID, PdfName = ct.UploadFilename, PdfSize = ct.TotalPdfPage, Payload = ttpd.Payload }).ToList();
string currentDateFolder = Path.Combine(AppConfig["SharedPath"], "FileUpload", "IndexFiles", DateTime.Now.ToString("yyyy_MM_dd"));
Directory.CreateDirectory(currentDateFolder);
string filePath = Path.Combine(currentDateFolder, $"{DateTime.Now.ToString("yyyy_MM_dd")}.csv");
// Build file content in memory
var csvContent = new StringBuilder();
csvContent.AppendLine("CorrespondenceID,EnvelopeID,PDFName,PDFSize,Address,City,State,Zipcode,Country,PDFMergeLocation");
var recordsToUpdate = new List<CorresTax>();
foreach (var correspondence in correspondenceList)
{
var correspondencetoEdit = DbContext.CorresTaxes.FirstOrDefault(c => c.CorrespondenceID == Convert.ToInt64(correspondence.CorrespondenceId));
if (correspondence.PdfName != null && correspondence.PdfSize != null)
{
var jsonValue = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(correspondence.Payload);
string CorrespondenceID = correspondence.CorrespondenceId.ToString();
string EnvelopeID = "";
string PDFName = correspondence.PdfName.ToString().Trim();
string PDFSize = correspondence.PdfSize.ToString().Trim();
string Address = jsonValue["HeaderfootercorresVM"]["Address"].ToString().Trim();
string City = jsonValue["HeaderfootercorresVM"]["City"].ToString().Trim();
string State = jsonValue["HeaderfootercorresVM"]["State"].ToString().Trim();
string Zipcode = jsonValue["HeaderfootercorresVM"]["Zipcode"].ToString().Trim();
string Country = jsonValue["HeaderfootercorresVM"]["Country"].ToString().Trim();
// Append data to CSV content
csvContent.AppendLine($"{CorrespondenceID},{EnvelopeID},{PDFName},{PDFSize},{Address},{City},{State},{Zipcode},{Country}");
// Prepare record for batch update
//var correspondencetoEdit = DbContext.CorresTaxes.FirstOrDefault(c => c.CorrespondenceID == Convert.ToInt64(CorrespondenceID));
if (correspondencetoEdit is not null)
{
correspondencetoEdit.IndexFilePath = filePath.Trim();
correspondencetoEdit.MdfctnDT = DateTime.Now;
correspondencetoEdit.StatusCD = CorrespondanceConstants.Indexed;
recordsToUpdate.Add(correspondencetoEdit);
}
}
else
{
// Update record for error
if (correspondencetoEdit is not null)
{
correspondencetoEdit.StatusCD = CorrespondanceConstants.Error;
correspondencetoEdit.MdfctnDT = DateTime.Now;
recordsToUpdate.Add(correspondencetoEdit);
}
}
}
// Write CSV content to the file
File.WriteAllText(filePath, csvContent.ToString(), Encoding.UTF8);
// Update database records in bulk
if (recordsToUpdate.Any())
{
DbContext.CorresTaxes.UpdateRange(recordsToUpdate);
DbContext.SaveChanges();
IndexFile indexFile = new();
indexFile.FileName = $"{DateTime.Now.ToString("yyyy_MM_dd")}.csv".ToString();
indexFile.FilePath = filePath.ToString().Trim();
indexFile.StatusCD = CorrespondanceConstants.Indexed.Trim();
DbContext.IndexFiles.Attach(indexFile);
DbContext.SaveChanges();
}
Logger.LogInformation("CorrespondenceIndexFileGenerationHelper:ProcessBundling completed.");
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team