Exemple #1
0
        public void GetProjectType_Test()
        {
            // ARRANGE
            CreateProjectTypes();
            var projectTypeLogic = new ProjectTypeLogic();

            // ACT
            var projectType = projectTypeLogic.GetProjectType(1);

            // ASSERT
            Assert.IsNotNull(projectType);
        }
Exemple #2
0
 public AddEditProjectType(int projectType_id)
 {
     InitializeComponent();
     if (projectType_id > 0)
     {
         var projectTypeLogic = new ProjectTypeLogic();
         this.ProjectTypeViewModel = new ProjectTypeViewModel(projectTypeLogic.GetProjectType(projectType_id));
         this.txt_Name.Text        = ProjectTypeViewModel.Name;
         this.txt_Description.Text = ProjectTypeViewModel.Description;
         projectTypeLogic.Dispose();
     }
 }
Exemple #3
0
        private void btn_AddProject_Click(object sender, RoutedEventArgs e)
        {
            if (this.SelectedProjectType != null && this.CanCreateProject && !editMode && !string.IsNullOrWhiteSpace(this.tb_projectDesignation.Text))
            {
                var bllProjectTypes = new ProjectTypeLogic();
                var bllProjects     = new ProjectLogic();
                var projectType     = bllProjectTypes.GetProjectType(this.SelectedProjectType.Id);
                var viewModel       = new ProjectCreateViewModel
                {
                    Description = tb_projectDescription.Text,
                    Name        = tb_projectDesignation.Text,
                    ProjectType = projectType
                };

                bllProjects.InsertProject(viewModel);
                bllProjects.Dispose();
                bllProjectTypes.Dispose();
                this.Close();
            }
            else if (this.SelectedProjectType != null && this.CanCreateProject && editMode)
            {
                var bllProjectTypes = new ProjectTypeLogic();
                var bllProjects     = new ProjectLogic();
                var projectType     = bllProjectTypes.GetProjectType(this.SelectedProjectType.Id);
                var viewModel       = new ProjectUpdateViewModel
                {
                    Description = this.tb_projectDescription.Text,
                    Name        = this.tb_projectDesignation.Text
                };

                bllProjects.UpdateProject(viewModel, projectId);
                bllProjects.Dispose();
                bllProjectTypes.Dispose();
                this.Close();
            }
        }