private void LoadData() { PersonnelBindingSource.DataSource = PersonnelManagement.GetA(PersonnelNo); EducationObjBindingSource.DataSource = StaticClass.ListEducation(PersonnelNo); EligibilityBindingSource.DataSource = EligibilityManagement.GetAll(PersonnelNo); ExperiencyBindingSource.DataSource = ExperienceManagement.GetAll(PersonnelNo); VoluntaryBindingSource.DataSource = VoluntaryManagement.GetAll(PersonnelNo); TrainingBindingSource.DataSource = TrainingManagement.GetAll(PersonnelNo); SpousBindingSource.DataSource = SpouseManagement.GetA(PersonnelNo); SkillBindingSource.DataSource = SkillManagement.GetAll(PersonnelNo); OrganizationBindingSource.DataSource = OrganizationManagement.GetAll(PersonnelNo); DistinctionBindingSource.DataSource = DistinctionManagement.GetAll(PersonnelNo); QuestionBindingSource.DataSource = QuestionManagement.GetAll(PersonnelNo); ReferenceBindingSource.DataSource = ReferencesManagement.GetAll(PersonnelNo); DetailBindingSource.DataSource = Details.GetAll(PersonnelNo); if (SpousBindingSource?.Current == null) { return; } ChildrenObjBindingSource.DataSource = StaticClass.ListChildren(((Spous)SpousBindingSource.Current).SpouseNo); reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); reportViewer1.ZoomMode = ZoomMode.Percent; reportViewer1.ZoomPercent = 100; this.reportViewer1.RefreshReport(); }
private void DeleteSpouse() { var dResult = MessageBox.Show(@"Delete Spouse's current record?", @"Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (dResult == DialogResult.Yes) { if (SpouseManagement.Delete(((Spous)spousBindingSource.Current).SpouseNo)) { MessageBox.Show(@"Record was deleted successfully.", @"Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); spousBindingSource.RemoveCurrent(); } else { MessageBox.Show(@"Error on delete operation.", @"Delete", MessageBoxButtons.OK, MessageBoxIcon.Error); spousDataGridView.Focus(); } } }
private void LoadInitPersonnelRelatedRecord() { Cursor.Current = Cursors.WaitCursor; var pNo = ((Personnel)personnelBindingSource.Current).PersonnelNo; if (pNo > 0) { eligibilityBindingSource.DataSource = EligibilityManagement.GetAll(pNo); experiencyBindingSource.DataSource = ExperienceManagement.GetAll(pNo); voluntaryBindingSource.DataSource = VoluntaryManagement.GetAll(pNo); trainingBindingSource.DataSource = TrainingManagement.GetAll(pNo); educationObjBindingSource.DataSource = StaticClass.ListEducation(pNo); spousBindingSource.DataSource = SpouseManagement.GetAll(pNo); skillBindingSource.DataSource = SkillManagement.GetAll(pNo); organizationBindingSource.DataSource = OrganizationManagement.GetAll(pNo); distinctionBindingSource.DataSource = DistinctionManagement.GetAll(pNo); questionBindingSource.DataSource = QuestionManagement.GetAll(pNo); referenceBindingSource.DataSource = ReferencesManagement.GetAll(pNo); detailBindingSource.DataSource = Details.GetAll(pNo); } Cursor.Current = Cursors.Default; }
private void saveSpouse() { var listChildren = new List <Children>(); if ((childrenBindingSource != null) && (childrenDataGridView != null)) { foreach (Children item in childrenBindingSource) { var c = new Children { ChildrenNo = item.ChildrenNo, ChildrenLastName = item.ChildrenLastName, ChildrenFirstName = item.ChildrenFirstName, ChildrenMiddleName = item.ChildrenMiddleName, ChildrenBirthDate = item.ChildrenBirthDate, SpouseNo = item.SpouseNo }; listChildren.Add(c); } } if (spousBindingSource != null) { Validate(); ((Spous)spousBindingSource.Current).PersonnelNo = PersonnelNo; spousBindingSource.EndEdit(); var iResult = SpouseManagement.Save((Spous)spousBindingSource.Current); if (iResult > 0) { var iCount = 0; foreach (var item in listChildren) { var c = new Children { ChildrenNo = item.ChildrenNo, ChildrenLastName = item.ChildrenLastName, ChildrenFirstName = item.ChildrenFirstName, ChildrenMiddleName = item.ChildrenMiddleName, ChildrenBirthDate = item.ChildrenBirthDate, modifieddate = DateTime.Now, SpouseNo = iResult }; if (ChildrenManagement.Save(c) > 0) { iCount += 1; } } if (listChildren.Count == iCount) { MessageBox.Show(@"Record was successfully saved.", @"Save", MessageBoxButtons.OK, MessageBoxIcon.Information); spouseSurNameTextBox.Focus(); } else { MessageBox.Show(@"There was problem on the children record on saving.", @"Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show(@"Error occurred in saving.", @"Save", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }