public frmProjectDetail(int ID, string Title, string Decription, string Lectureid) { InitializeComponent(); this.cID.DataPropertyName = nameof(Student.S_ID); this.cName.DataPropertyName = nameof(Student.S_name); this.cFullname.DataPropertyName = nameof(Student.S_fullname); this.cMajor.DataPropertyName = nameof(Student.S_major); this.cGender.DataPropertyName = nameof(Student.S_gender); this.cBirthday.DataPropertyName = nameof(Student.S_birthday); this.cPhone.DataPropertyName = nameof(Student.S_phone); this.cEmail.DataPropertyName = nameof(Student.S_email); id = ID; _title = Title; _description = Decription; _lectureid = Lectureid; lblProjectID.Text = id.ToString(); lblProjecttitle.Text = _title; lblProjectDescription.Text = _description; lblLectureID.Text = _lectureid; this.cmbStudentName.DataSource = StudentController.getStudentDetail(); this.cmbStudentName.DisplayMember = "S_fullname"; this.cmbStudentName.ValueMember = "S_ID"; BindingSource source = new BindingSource(); source.DataSource = ProjectManagementController.getAllStudentbyIDproject(id); this.dgvProjectDetail.DataSource = source; }
public void DeleteUserTest() { var controller = new ProjectManagementController(); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); string result = controller.Delete(3); Assert.AreEqual("Record deleted Successfully", result); }
public void GetProjectTest() { var controller = new ProjectManagementController(); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); var response = controller.Get(1); Assert.AreEqual(response.ProjectID, 1); Assert.AreEqual("Test Project", response.ProjectDesc); }
public void GetAllProjectsTest() { var controller = new ProjectManagementController(); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); var response = controller.Get(); Assert.IsNotEmpty(response); }
public void UpdateProjectTest() { var controller = new ProjectManagementController(); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); var project = controller.Get(1); project.Priority = 10; string result = controller.Put(project); Assert.AreEqual("Record updated Successfully", result); }
public void AddProjectTest() { var controller = new ProjectManagementController(); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); Project project = new Project(); project.ProjectDesc = "NUnit Project"; project.Priority = 10; project.ProjectID = 3; project.StartDate = Convert.ToDateTime("2018-06-01"); project.EndDate = Convert.ToDateTime("2018-06-30"); string result = controller.Post(project); Assert.AreEqual("Record added Successfully", result); }
private void btnDelete_Click(object sender, EventArgs e) { if (this.dgvProjectDetail.SelectedRows.Count <= 0) { return; } string idstudent = this.dgvProjectDetail.SelectedRows[0].Cells[0].Value.ToString().Trim(); if (ProjectManagementController.DeleteProjectStudent(id, idstudent) == false) { MessageBox.Show("Cannot delete project!!!"); } else { MessageBox.Show("Delete success!!!", "Note", MessageBoxButtons.OK); BindingSource source = new BindingSource(); source.DataSource = ProjectManagementController.getAllStudentbyIDproject(id); this.dgvProjectDetail.DataSource = source; } }
private void btnAdd_Click(object sender, EventArgs e) { ProjectManagement student = new ProjectManagement(); student.S_ID = this.cmbStudentName.SelectedValue.ToString(); student.P_ID = id; if (ProjectManagementController.addProjectStudent(student) == false) { MessageBox.Show("Error in adding a new student!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Add success!!!", "Note", MessageBoxButtons.OK, MessageBoxIcon.Information); } BindingSource source = new BindingSource(); source.DataSource = ProjectManagementController.getAllStudentbyIDproject(id); this.dgvProjectDetail.DataSource = source; }