internal void AddEmailToDb(string query, EmailDetails item, Database db) { SQLiteCommand cmd = new SQLiteCommand(query, _conn); OpenConnection(); cmd.CommandType = CommandType.Text; cmd.Parameters.Add(new SQLiteParameter("@Domain", item.Domain)); cmd.Parameters.Add(new SQLiteParameter("@Company", item.Company)); cmd.Parameters.Add(new SQLiteParameter("@Departmnt", item.Departmnt)); cmd.Parameters.Add(new SQLiteParameter("@Email", item.Email)); cmd.Parameters.Add(new SQLiteParameter("@FirstName", item.FirstName)); cmd.Parameters.Add(new SQLiteParameter("@LastName", item.LastName)); cmd.Parameters.Add(new SQLiteParameter("@LinkedIn", item.LinkedIn)); cmd.Parameters.Add(new SQLiteParameter("@Phone", item.Phone)); cmd.Parameters.Add(new SQLiteParameter("@Position", item.Position)); cmd.Parameters.Add(new SQLiteParameter("@Seniority", item.Seniority)); cmd.Parameters.Add(new SQLiteParameter("@Twitter", item.Twitter)); cmd.Parameters.Add(new SQLiteParameter("@UpdateDate", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff"))); cmd.ExecuteNonQuery(); CloseConnection(); }
private static void AddEmailToDb(string domain, string company, EmailDetails item, Database db) { string query = $@"insert into DomainEmails values ( @Domain, @Company, @Departmnt, @Phone, @Seniority, @Twitter , @LinkedIn , @Position , @LastName , @FirstName , @Email, @UpdateDate )"; item.Domain = domain; item.Company = company; db.AddEmailToDb(query, item, db); }