/// <summary> /// Loads the DT list from excel of recipients to DB /// </summary> public void LoadToTable() { if (this.StrEmailsRecipientsDT.Rows.Count > 0) { MyDbUtils mduForDelete = new MyDbUtils(this.DbPath); mduForDelete.DeleteAllEntries(TABLE_NAME); foreach (DataRow drX in this.StrEmailsRecipientsDT.AsEnumerable()) { Dictionary <string, string> recordsX = new Dictionary <string, string>() { ["Email"] = drX["Email"]?.ToString().Trim() ?? string.Empty, ["EmailUsername"] = drX["EmailUsername"]?.ToString().Trim() ?? string.Empty, ["LastName"] = drX["LastName"]?.ToString().Trim() ?? string.Empty, ["FirstName"] = drX["FirstName"]?.ToString().Trim() ?? string.Empty, ["IsMandatory"] = drX["IsMandatory"]?.ToString().Trim() ?? string.Empty, ["IsAvailable"] = drX["IsAvailable"]?.ToString().Trim() ?? string.Empty, ["RecipientGroup"] = drX["RecipientGroup"]?.ToString().Trim() ?? string.Empty, ["Investigators"] = drX["Investigators"]?.ToString().Trim() ?? string.Empty }; MyDbUtils mdu = new MyDbUtils(this.DbPath); mdu.CreateEntry(TABLE_NAME, recordsX); } } else { Console.WriteLine($"[StrEmailsRecipientsHandler] DataTable is empty"); } }
private void CreateEntryInboundStrEmails(string FileName, string EmailUsername, string TABLE_NAME, string Subject, string Response, string ResponseDate, string Phase) { Dictionary <string, string> criteriaX = new Dictionary <string, string>() { ["FileName"] = FileName, ["EmailUsername"] = EmailUsername, }; MyDbUtils mduForCount = new MyDbUtils(this.DbPath); long resultCount = mduForCount.CountEntries(TABLE_NAME, criteriaX); if (resultCount < 1) { Dictionary <string, string> recordsX = new Dictionary <string, string>() { ["FileName"] = FileName, ["Subject"] = Subject, ["EmailUsername"] = EmailUsername, ["Response"] = Response, ["ResponseDate"] = ResponseDate, ["Phase"] = Phase }; MyDbUtils mdu = new MyDbUtils(this.DbPath); mdu.CreateEntry(TABLE_NAME, recordsX); } else { Dictionary <string, string> recordsX = new Dictionary <string, string>() { ["Subject"] = Subject, ["Response"] = Response, ["ResponseDate"] = ResponseDate, ["Phase"] = Phase }; MyDbUtils mduForUpdate = new MyDbUtils(this.DbPath); mduForUpdate.UpdateEntry(TABLE_NAME, criteriaX, recordsX); } }