Inheritance: sp_VendorProjContact_CON
コード例 #1
0
 public void TestVendorProjContactInsert()
 {
     //Test Our Read
     sp_VendorProjContact_DM data = new sp_VendorProjContact_DM();
     data.VendorID = new Guid();
     bool insertPrimaryContact = true;
     data.PrimaryContact = insertPrimaryContact;
     sp_VendorProjContact_BLL contact = new sp_VendorProjContact_BLL();
     contact.InsertContactContext(data);
     Assert.AreEqual(insertPrimaryContact, data.PrimaryContact, "Primary Contact Not Set As Expected");
 }
コード例 #2
0
 public void TestVendorProjContactDelete()
 {
     DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "tblVendorProjContact.xlsx"));
     foreach (DataRow row in dt.Rows) // Loop over the rows.
     {
         Guid VendorID = new Guid(row["VendorID"].ToString());
         Guid ProjectID = new Guid(row["ProjectID"].ToString());
         Guid ContactID = new Guid(row["ContactID"].ToString());
         sp_VendorProjContact_DM data = new sp_VendorProjContact_DM();
         sp_VendorProjContact_BLL vend = new sp_VendorProjContact_BLL();
         data.VendorID = VendorID;
         data.ProjectID = ProjectID;
         data.ContactID = ContactID;
         vend.DeleteContactContext(data);
         data = vend.ListContact(VendorID, ProjectID, ContactID);
         Assert.AreEqual(false, data.PrimaryContact, "PrimaryContact not set as expected");
     }
 }
コード例 #3
0
        public void TestVendorProjContactRead()
        {
            //Test Our Read
            DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "tblVendorProjContact.xlsx"));
            foreach (DataRow row in dt.Rows) // Loop over the rows.
            {
                string vendorID = row["VendorID"].ToString();
                string projectID = row["ProjectID"].ToString();
                string contactID = row["ContactID"].ToString();
                sp_VendorProjContact_BLL contact = new sp_VendorProjContact_BLL();
                sp_VendorProjContact_DM data = contact.ListContact(new Guid(vendorID), new Guid(projectID), new Guid(contactID));
                Assert.AreEqual(Convert.ToBoolean(row["PrimaryContact"]), data.PrimaryContact, "Primary Contact Not Set As Expected");

            }
        }
コード例 #4
0
        protected void saveForm()
        {
            sp_Project_DM projectDM = new sp_Project_DM();
            sp_VendorProjContact_DM vpContactDM = new sp_VendorProjContact_DM();

            vpContactDM.VendorID = (Guid)currentUser.ProviderUserKey;
            Guid projectID = Guid.NewGuid();

            vpContactDM.ProjectID = projectID;

            int contectIndex = rCBContact.SelectedIndex;
            if (rCBContact.SelectedIndex != 0)
            {
                vpContactDM.ContactID = contacts.ElementAt(rCBContact.SelectedIndex - 1).ContactID;

                //we can't set a contact as primary if there isn't a contact selected
                vpContactDM.PrimaryContact = cbPrimaryContact.Checked;
            }

            if (rCBAddress.SelectedIndex != 0)
            {
                projectDM.AddrID = addresses.ElementAt(rCBAddress.SelectedIndex - 1).AddrID;
            }
            projectDM.ProjectID = projectID;
            projectDM.ProjectName = rTBProjName.Text;
            projectDM.ProjectDesc = rTBProjDesc.Text;
            projectDM.ActiveFlg = false;

            sp_Project_BLL projectBLL = new sp_Project_BLL();
            sp_VendorProjContact_BLL vpContactBLL = new sp_VendorProjContact_BLL();

            //Why is it by ref? That's weird.
            projectBLL.InsertProjectContext(ref projectDM);
            vpContactBLL.InsertContactContext(vpContactDM);
        }