Inheritance: sp_Project_CON
Example #1
0
        public void TestProjectCreate()
        {
            string ProjectName = "TestProject";
            string ProjectDesc = "We Rock!";
            bool ActiveFlg = true;
            var Project_bll = new sp_Project_BLL();
            var Project_dm = new sp_Project_DM();
            var VendAdress_bll = new sp_VendAddress_BLL();
            Project_dm.ProjectName = ProjectName;
            Project_dm.ProjectDesc = ProjectDesc;
            var allAddresses = VendAdress_bll.ListAddresses();
            Assert.IsTrue(allAddresses.Count > 0, "The ListAddresses() is broken, or no data in DB");
            Project_dm.AddrID = allAddresses[0].AddrID;
            Project_dm.ActiveFlg = ActiveFlg;
            var ProjectID = Project_bll.InsertProjectContext(ref Project_dm).ProjectID;
            Project_dm.ProjectID = ProjectID;

            var Project_dm_selected = Project_bll.ListProjects(ProjectID);
            Assert.IsTrue(Equals(Project_dm, Project_dm_selected));
        }
Example #2
0
        public void TestProjectDelete()
        {
            var Project_bll = new sp_Project_BLL();
            var allProjects = Project_bll.ListProjects();
            Assert.IsTrue(allProjects.Count > 0, "The ListProjects() is broken, or no data in DB");
            var currProject = allProjects[0];
            //TODO: change activeflg to bool not bool?
            var notActive = currProject.ActiveFlg != true;
            var i = 1;
            while (notActive)
            {
                currProject = allProjects[i];
                notActive = currProject.ActiveFlg != true;
            }
            Project_bll.DeleteProjectContext(currProject);
            var selectedProject = Project_bll.ListProjects(currProject.ProjectID);

            //TODO: change activeflg to bool not bool?
            Assert.IsNotNull(selectedProject.ActiveFlg);
            Assert.IsFalse(selectedProject.ActiveFlg == true);
            Assert.IsTrue(selectedProject.ActiveFlg == false);
        }
Example #3
0
        public void TestProjectEventCreate()
        {
            DateTime StartDate = new DateTime(2014, 05, 01, 10, 0, 0);
            DateTime EndDate = new DateTime(2014, 05, 02, 11, 0, 0);
            var ProjectEvent_bll = new sp_ProjectEvent_BLL();
            var ProjectEvent_dm = new sp_ProjectEvent_DM();
            var Project_bll = new sp_Project_BLL();
            var VendAdress_bll = new sp_VendAddress_BLL();
            ProjectEvent_dm.StartDateTime = StartDate;
            ProjectEvent_dm.EndDateTime = EndDate;

            var allProjects = Project_bll.ListProjects();
            Assert.IsTrue(allProjects.Count > 0, "The ListProjects() is broken, or no data in DB");
            ProjectEvent_dm.ProjectID = allProjects[0].ProjectID;

            var allAddresses = VendAdress_bll.ListAddresses();
            Assert.IsTrue(allAddresses.Count > 0, "The ListAddresses() is broken, or no data in DB");
            ProjectEvent_dm.AddrID = allAddresses[0].AddrID;
            //var ProjectID = ProjectEvent_bll.InsertEventContext(ref ProjectEvent_dm).ProjectID;
            //ProjectEvent_dm.ProjectID = ProjectID;

            //var ProjectEvent_dm_selected = ProjectEvent_bll.ListEvents(ProjectID);
            //Assert.IsTrue(Equals(ProjectEvent_dm, ProjectEvent_dm_selected));
        }
        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);
        }
Example #5
0
        public void TestProjectRead()
        {
            //Pull our data from the excel file
            string helperDir = cExcel.GetHelperFilesDir();
            DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(helperDir, "Project.xlsx"));
            var excelDMs = DMsFrom(dt);
            //Pull our data directly from the DB
            var numRows = cExcel.getNumRecordsFromDB("[Vend].[tblProject]");

            //Pull our data from the DB through the BLL
            var Project_bll = new sp_Project_BLL();
            var allProjects = Project_bll.ListProjects();

            //Test the data from the BLL
            Assert.AreEqual(numRows, allProjects.Count);
            foreach (var testProject in excelDMs)
            {
                var selectedProject = Project_bll.ListProjects(testProject.ProjectID);
                Assert.IsTrue(Equals(testProject, selectedProject));
            }
        }
Example #6
0
        public void TestProjectUpdate()
        {
            var Project_bll = new sp_Project_BLL();
            var allProjects = Project_bll.ListProjects();
            Assert.IsTrue(allProjects.Count > 0, "The ListProjects() is broken, or no data in DB");
            var firstProject = allProjects[0];
            var newProjectName = "Updated Project Name";
            firstProject.ProjectName = newProjectName;
            Project_bll.UpdateProjectContext(firstProject);
            var selectedProject = Project_bll.ListProjects(firstProject.ProjectID);

            Assert.IsTrue(Equals(firstProject, selectedProject));
            Assert.AreEqual(newProjectName, selectedProject.ProjectName);
        }