private void GetSelectedTest(int numberOfMethod) { int[] selectedRowHandles = this.gridView1.GetSelectedRows(); if (selectedRowHandles.Length == 1) { TestsInOrderClient test = gridView1.GetRow(selectedRowHandles[0]) as TestsInOrderClient; if (test == null) { MessageBox.Show("Selected test is null"); } else { selectedTest = test; } if (numberOfMethod == 1) { EditTestEvent(this, EventArgs.Empty); } else { DeleteTestEvent(this, EventArgs.Empty); } } else if (selectedRowHandles.Length == 0) { MessageBox.Show("Choose test"); } }
public void ClearAllData() { test = new TestsInOrderClient(); textEditIDTest.Text = ""; testNameLookUpEdit.lookUpEditTestName.EditValue = 0; dateEditDateStart.Text = ""; textEditResult.Text = ""; testStatusLookUpEdit.lookUpEditTestStatus.EditValue = 0; specimentsCheckedComboBoxEdit.checkedComboBoxEditSpeciment.EditValue = 0; buttonOK.Text = "Add"; }
public bool ValidateTest(TestsInOrderClient testForCheck) { List <ValidationResult> results = new List <ValidationResult>(); ValidationContext context = new ValidationContext(testForCheck); bool flag = Validator.TryValidateObject(testForCheck, context, results, true); if (!flag) { foreach (ValidationResult error in results) { MessageBox.Show(error.ErrorMessage); } } else { MessageBox.Show("All data test is OK"); } return(flag); }
void setTest(TestsInOrderClient test) { if (test != null) { textEditIDTest.Text = Convert.ToString(test.ID_TestOrder); if (test.Test != null) { DataTestName = test.Test; } dateEditDateStart.Text = Convert.ToString(test.DateStart); textEditResult.Text = test.Result; if (test.specimentsInOrderList != null) { DataSpeciments = test.specimentsInOrderList; } if (test.TestStatus != null) { DataTestStatus = test.TestStatus; } } }
private void AddOrUpdateTestEventHandler(object sender, EventArgs args) { TestsInOrderClient tempTest = this.testSearchView.TestDetailData.Test; foreach (var item in tempTest.specimentsInOrderList) { MessageBox.Show("In Presenter " + item.ToString()); } bool flag = ValidateTest(tempTest); if (flag) { if (!EditClicked) { this.testModel.TestList.Add(tempTest); this.testSearchView.TestDetailData.ClearAllData(); } else { if (this.testSearchView.selectedTest.ID_TestOrder <= 0) { this.testModel.Test = this.testSearchView.selectedTest; } for (int i = 0; i < this.testModel.TestList.Count; i++) { if (this.testModel.TestList[i].Equals(this.testSearchView.selectedTest)) { this.testModel.TestList[i] = tempTest; } } this.testSearchView.TestDetailData.ClearAllData(); EditClicked = false; } } }
public TestDetail() { InitializeComponent(); test = new TestsInOrderClient(); }