private void UpdateToEmails(List<EmailAddressBO> objEmailAddress, string toType, int requestID) { StringBuilder strToEmail = new StringBuilder(); EmailTo objEmailTo = new EmailTo(); EmailDA objEmailDA = new EmailDA(); for (int idx = 0; idx < objEmailAddress.Count; idx++) { strToEmail.Append(objEmailAddress[idx].EmailAddress + ","); } objEmailTo.EmailRequestID = requestID; objEmailTo.ToEmails = strToEmail.ToString(); objEmailTo.ToType = toType; objEmailDA.SaveToEmail(objEmailTo); }
public void SaveToEmail(EmailTo objEmailTo) { try { using (MySqlConnection sqlCon = new MySqlConnection(Constant.EBirdConnectionString)) { MySqlCommand sqlCmd = new MySqlCommand(DBEmailQuery.sqlEmailToInsert, sqlCon); sqlCon.Open(); sqlCmd.CommandType = CommandType.Text; sqlCmd.Parameters.Add(new MySqlParameter("@emailRequestID", objEmailTo.EmailRequestID)); sqlCmd.Parameters.Add(new MySqlParameter("@ToType", objEmailTo.ToType)); sqlCmd.Parameters.Add(new MySqlParameter("@ToEmails", objEmailTo.ToEmails)); sqlCmd.ExecuteNonQuery(); sqlCon.Close(); } } catch (Exception ex) { throw; } }