public void DeleteContactEmailContext(sp_ContactEmail_DM contactemail) { using (VolTeerEntities context = new VolTeerEntities()) { var ContactEmailtoRemove = (from n in context.tblContactEmails where n.ContactID == contactemail.ContactID & n.EmailID == contactemail.EmailID select n).FirstOrDefault(); context.tblContactEmails.Remove(ContactEmailtoRemove); context.SaveChanges(); } }
public void InsertContactEmailContext(sp_ContactEmail_DM contactemail) { using (VolTeerEntities context = new VolTeerEntities()) { var NewContactEmail = new tblContactEmail { ContactID = contactemail.ContactID, EmailID = contactemail.EmailID, PrimaryEmail = contactemail.PrimaryEmail }; context.tblContactEmails.Add(NewContactEmail); context.SaveChanges(); } }
public void TestContactEmailDelete() { DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "ContactEmail.xlsx")); foreach (DataRow row in dt.Rows) // Loop over the rows. { Guid contactID = new Guid(row["ContactID"].ToString()); int emailID = Convert.ToInt32(row["EmailID"]); sp_ContactEmail_DM data = new sp_ContactEmail_DM(); data.EmailID = emailID; data.ContactID = contactID; sp_VendContactEmail_BLL contact = new sp_VendContactEmail_BLL(); contact.DeleteContactContext(data); var newdata = contact.ListContacts(contactID, emailID); } }
public void TestContactEmailCreate() { //Insert a Contact First sp_Contact_DM contact_dm = new sp_Contact_DM(); contact_dm.ContactID = new Guid(); sp_Contact_BLL contact_bll = new sp_Contact_BLL(); contact_bll.InsertContactContext(ref contact_dm); //Insert an ContactEmail sp_ContactEmail_DM data = new sp_ContactEmail_DM(); data.ContactID = contact_dm.ContactID; data.EmailID = 1; data.PrimaryEmail = true; sp_ContactEmail_BLL vendor = new sp_ContactEmail_BLL(); vendor.InsertContactEmailContext(data); var newdata = vendor.ListContactEmails(data.ContactID, data.EmailID); Assert.AreEqual(data.ContactID, newdata.ContactID, "Contact ID Not Set As Expected"); Assert.AreEqual(data.EmailID, newdata.EmailID, "Email ID Not Set As Expected"); Assert.AreEqual(data.PrimaryEmail, newdata.PrimaryEmail, "PrimaryEmail Not Set As Expected"); }
public void TestContactEmailUpdate() { //Test Our Read DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "ContactEmail.xlsx")); foreach (DataRow row in dt.Rows) // Loop over the rows. { bool primaryEmail = true; int emailID = Convert.ToInt32(row["EmailID"]); Guid contactID = new Guid( row["ContactID"].ToString()); sp_ContactEmail_DM data = new sp_ContactEmail_DM(); data.ContactID = contactID; data.EmailID = emailID; data.PrimaryEmail = primaryEmail; sp_ContactEmail_BLL contact = new sp_ContactEmail_BLL(); contact.UpdateContactEmailContext(data); var newdata = contact.ListContactEmails(contactID, emailID); Assert.AreEqual(primaryEmail, newdata.PrimaryEmail, "PrimaryEmail Not Set As Expected"); Assert.AreEqual(emailID, newdata.EmailID, "EmailID Not Set As Expected"); Assert.AreEqual(contactID, newdata.ContactID, "ContactIDe Not Set As Expected"); } }
public void UpdateContactContext(sp_ContactEmail_DM _cVendContact) { DAL.UpdateContactEmailContext(_cVendContact); }
public void InsertContactContext(sp_ContactEmail_DM _cVendContact) { DAL.InsertContactEmailContext(_cVendContact); }
public void DeleteContactContext(sp_ContactEmail_DM _cVendContact) { DAL.DeleteContactEmailContext(_cVendContact); }
public void UpdateContactEmailContext(sp_ContactEmail_DM contactemail) { using (VolTeerEntities context = new VolTeerEntities()) { var ExistingContactEmail = context.tblContactEmails.Find(contactemail.ContactID, contactemail.EmailID); if (ExistingContactEmail != null) { ExistingContactEmail.PrimaryEmail = contactemail.PrimaryEmail; context.SaveChanges(); } } }
public void UpdateContactEmailContext(sp_ContactEmail_DM contactemail) { DAL.UpdateContactEmailContext(contactemail); }
public void InsertContactEmailContext(sp_ContactEmail_DM contactemail) { DAL.InsertContactEmailContext(contactemail); }
public void DeleteContactEmailContext(sp_ContactEmail_DM contactemail) { DAL.DeleteContactEmailContext(contactemail); }