private void InsertUnregisteredUserDetails(DataTable unregistereduserTable) { try { foreach (DataRow row in unregistereduserTable.Rows) { UnRegisteredVolunteer unRegisteredVolunteer = new UnRegisteredVolunteer(); unRegisteredVolunteer.EventId = row["Event ID"].ToString(); if (!row.IsNull("EmployeeID")) { unRegisteredVolunteer.EmployeeID = row["EmployeeID"].ToString(); } if (!row.IsNull("Event Name")) { unRegisteredVolunteer.EventName = row["Event Name"].ToString(); } if (!row.IsNull("Beneficiary Name")) { unRegisteredVolunteer.BeneficaryName = row["Beneficiary Name"].ToString(); } if (!row.IsNull("Base Location")) { unRegisteredVolunteer.Location = row["Base Location"].ToString(); } if (!row.IsNull("Event Date (DD-MM-YY)")) { String[] date = row["Event Date (DD-MM-YY)"].ToString().Split(new[] { '-' }); int day = Convert.ToInt32(date[0]); int month = Convert.ToInt32(date[1]); int a = 20; int year = int.Parse(a.ToString() + date[2].ToString()); DateTime eventDate = new DateTime(year, month, day); unRegisteredVolunteer.EventDate = eventDate; } UnRegisteredVolunteerRepository unRegisteredVolunteerRepository = new UnRegisteredVolunteerRepository(); unRegisteredVolunteerRepository.AddUnRegisteredVolunteer(unRegisteredVolunteer); } outreachMail.SendMailToUnregisteredUser(unregistereduserTable); } catch (Exception ex) { ExceptionLogger logger = new ExceptionLogger() { ControllerName = "ExcelToDB", ActionrName = "InsertUnregisteredUserDetails", ExceptionMessage = ex.Message, ExceptionStackTrace = ex.StackTrace, LogDateTime = DateTime.Now }; ExceptionRepository exceptionRepository = new ExceptionRepository(); exceptionRepository.AddException(logger); } }
public void AddUnRegisteredVolunteer(UnRegisteredVolunteer unRegisteredVolunteer) { IUnRegisteredVolunteerRepository.Insert(unRegisteredVolunteer); IUnRegisteredVolunteerRepository.Save(); }