InsertContactContext() public method

public InsertContactContext ( sp_VendorProjContact_DM InputContact ) : System.Guid
InputContact VolTeer.DomainModels.VT.Vend.sp_VendorProjContact_DM
return System.Guid
示例#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");
 }
        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);
        }