Inheritance: sp_Contact_CON
Ejemplo n.º 1
0
        public void TestProjectEventContactCreate()
        {
            bool PrimaryContact = true;
            var ProjectEventContact_bll = new sp_ProjectEventContact_BLL();
            var ProjectEventContact_dm = new sp_ProjectEventContact_DM();
            var ProjectEvent_bll = new sp_ProjectEvent_BLL();
            var Contact_bll = new sp_Contact_BLL();
            ProjectEventContact_dm.PrimaryContact = PrimaryContact;

            var allProjectEvents = ProjectEvent_bll.ListEvents();
            Assert.IsTrue(allProjectEvents.Count > 0, "The ListEvents() is broken, or no data in DB");
            ProjectEventContact_dm.EventID = allProjectEvents[0].EventID;

            var allContacts = Contact_bll.ListContacts();
            Assert.IsTrue(allContacts.Count > 0, "The ListContacts() is broken, or no data in DB");
            ProjectEventContact_dm.ContactID = allContacts[0].ContactID;

            ProjectEventContact_bll.InsertProjectEventContactContext(ProjectEventContact_dm);

            var ProjectEventContact_dm_selected = ProjectEventContact_bll.ListEventsContacts(
                                                                ProjectEventContact_dm.EventID,
                                                                ProjectEventContact_dm.ContactID);
            Assert.AreEqual(1, ProjectEventContact_dm_selected.Count);
            Assert.IsTrue(Equals(ProjectEventContact_dm, ProjectEventContact_dm_selected[0]));
        }
Ejemplo n.º 2
0
 public void TestContactDelete()
 {
     DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "Contact.xlsx"));
         foreach (DataRow row in dt.Rows) // Loop over the rows.
         {
             string contactID = row["ContactID"].ToString();
             sp_Contact_DM data = new sp_Contact_DM();
             data.ContactID = new Guid(contactID);
             sp_Contact_BLL contact = new sp_Contact_BLL();
             contact.DeleteContactContext(data.ContactID);
             data = contact.ListContacts(new Guid(contactID));
             Assert.AreEqual(false, data.ActiveFlg, "ActiveFlag not set as expected");
         }
 }
Ejemplo n.º 3
0
 public void TestContactCreate()
 {
     sp_Contact_DM data = new sp_Contact_DM();
     data.ContactID = new Guid();
     string insertFirstName = "A";
     string insertMiddleName = "J";
     string insertLastName = "Riz";
     data.ContactFirstName = insertFirstName;
     data.ContactMiddleName = insertMiddleName;
     data.ContactLastName = insertLastName;
     data.ActiveFlg = true;
     sp_Contact_BLL contact = new sp_Contact_BLL();
     contact.InsertContactContext(ref data);
     Assert.AreEqual(insertFirstName, data.ContactFirstName, "Contact First Name Not Set As Expected");
     Assert.AreEqual(insertMiddleName, data.ContactMiddleName, "Contact Middle Name Not Set As Expected");
     Assert.AreEqual(insertLastName, data.ContactLastName, "Contact Last Name Not Set As Expected");
 }
Ejemplo n.º 4
0
        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");
        }
Ejemplo n.º 5
0
        public void TestContactReadAll()
        {
            //Pull our data from the excel file
            string helperDir = cExcel.GetHelperFilesDir();
            DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(helperDir, "Contact.xlsx"));
            //Pull our data directly from the DB
            var numRows = cExcel.getNumRecordsFromDB("[Vend].[tblContact]");

            //Pull our data from the DB through the BLL
            sp_Contact_BLL contact = new sp_Contact_BLL();
            var allContacts = contact.ListContacts();

            //Test the data from the BLL
            Assert.AreEqual(numRows, allContacts.Count);
        }
Ejemplo n.º 6
0
 public void TestContactRead()
 {
     //Test Our Read
     DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "Contact.xlsx"));
     foreach (DataRow row in dt.Rows) // Loop over the rows.
     {
         string contactID = row["ContactID"].ToString();
         sp_Contact_BLL contact = new sp_Contact_BLL();
         sp_Contact_DM data = contact.ListContacts(new Guid(contactID));
         Assert.AreEqual(row["ContactFirstName"].ToString(), data.ContactFirstName, "Contact First Name Not Set As Expected");
         Assert.AreEqual(row["ContactMiddleName"].ToString(), data.ContactMiddleName, "Contact Middle Name Not Set As Expected");
         Assert.AreEqual(row["ContactLastName"].ToString(), data.ContactLastName, "Contact Last Name Not Set As Expected");
     }
 }
        protected void getContacts()
        {
            sp_VendContact_BLL vendContactBLL = new sp_VendContact_BLL();
            sp_Contact_BLL contactBLL = new sp_Contact_BLL();
            List<sp_VendContact_DM> vendContacts = vendContactBLL.ListVendContacts((Guid)currentUser.ProviderUserKey, null);
            foreach (sp_VendContact_DM vendCont in vendContacts)
            {
                contacts.Add(contactBLL.ListContacts(vendCont.ContactID));

            }

            //Uncomment to see that the combobox loads correctly
            /*sp_Contact_DM newCont = new sp_Contact_DM();
            newCont.ContactID = Guid.NewGuid();
            newCont.ContactFirstName = "Daniel";
            newCont.ContactMiddleName = "Lees";
            newCont.ContactLastName = "Barker";
            newCont.ActiveFlg = true;
            contacts.Add(newCont);*/
        }