/// <summary> /// Scripter : YONGTOK KIM /// Scripted Date : 30 Nov 2010 /// Show detail information of the Unit /// </summary> private void ShowOfficeInformation() { if (lbxOfficeName.SelectedIndex > -1) { officeCode = null; GetOffice go = new GetOffice(); officeCode = lbxOfficeName.SelectedValue.ToString(); var office = go.GetOfficesByOfficeCode(officeCode); if (office != null) { OFFICE o = office.First(); txtOfficeName.Text = o.OfficeName; txbOfficeCode.Text = o.OFFICECODE; txtBuildingName.Text = o.BuildingName; txtBuildingNo.Text = o.BuildingNo; txtRoomNo.Text = o.RoomNo; GetUnit gu = new GetUnit(); var unit = gu.GetUnitsByUIC(o.UIC); if (unit != null) { Unit u = unit.First(); int hyphenIndex = u.UnitPhone.IndexOf("-"); txbUnitName.Text = u.UnitName; txbUIC.Text = u.UIC; txbUnitPhonePrefix.Text = u.UnitPhone.Substring(0, hyphenIndex + 1); txbUnitPhoneNumber.Text = u.UnitPhone.Substring(hyphenIndex + 1); txbUnitAPO.Text = u.APO; txbUnitAP.Text = u.AP; GetInstallation gi = new GetInstallation(); var installation = gi.GetInstallationByIC(u.INSTALLATIONCODE); if (installation != null) { cbxInstallationName.Text = installation.INSTALLATIONNAME; txbInstallationCode.Text = installation.INSTALLATIONCODE; txbArea.Text = installation.AREA; txbCity.Text = installation.City; } } changeInstallation = true; } else { MessageBox.Show(string.Format("{0} is not exist!!", lbxOfficeName.SelectedValue.ToString())); } go.officeSearchResult = false; } }
//Search all of the offices private void AllOfOfficesSearch() { LabelForegroundToBlack(); GetOffice go = new GetOffice(); var offices = go.GetAllOfOffices(); if (offices != null) ShowOfficeNameToListBox(offices); }
//Search the Office by Installation (When change cbxInstallationName) private void OfficeSearchByInstallation() { if (!changeInstallation) { lbxOfficeName.ItemsSource = null; LabelForegroundToBlack(); GetOffice go = new GetOffice(); List<OFFICE> offices = null; offices = go.GetOfficesByInstallationCode(cbxInstallationName.SelectedValue.ToString()); if (offices != null) ShowOfficeNameToListBox(offices); } }
//Search the Offices private void OfficeSearch() { lbxOfficeName.ItemsSource = null; LabelForegroundToBlack(); GetOffice go = new GetOffice(); List<OFFICE> offices = null; if (!string.IsNullOrEmpty(txtSONameSearch.Text)) { if (rdbSOSearchByUnit.IsChecked == true) { offices = go.GetOfficesByUnitName(txtSONameSearch.Text); } else { offices = go.GetOfficesByName(txtSONameSearch.Text); } if (offices != null) ShowOfficeNameToListBox(offices); } }
//Search the offices by the Unit private void OfficeSearchByUIC(string uic) { GetOffice go = new GetOffice(); var offices = go.GetOfficesByUIC(txbUIC.Text); if (offices != null) ShowOfficeNameToListBox(offices); }
//Change background and foreground color when mouse double click the label private void MouseDoubleClicked(object sender) { LabelForegroundToBlack(); ((Label)sender).Background = Brushes.Yellow; ((Label)sender).Foreground = Brushes.Red; lbxOfficeName.ItemsSource = null; GetOffice go = new GetOffice(); List<OFFICE> offices = null; if (((Label)sender).Content.ToString() != "#") offices = go.GetOfficesByName(((Label)sender).Content.ToString()); else offices = go.GetAllOfOffices(); if (offices != null) { ShowOfficeNameToListBox(offices); } }
//Set the Value of the Office, Unit, and Installation private void SendDataToPersonalInformationRegisterForm() { GetOffice go = new GetOffice(); GetUnit gu = new GetUnit(); GetInstallation gi = new GetInstallation(); if (!string.IsNullOrEmpty(officeCode)) { fsOffice = go.GetOfficesByOfficeCode(officeCode).First(); fsUnit = gu.GetUnitsByUIC(fsOffice.UIC).First(); fsInstallation = gi.GetInstallationByIC(fsUnit.INSTALLATIONCODE); } else { MessageBox.Show("Office code is not exitst"); return; } if (fsOffice == null) { MessageBox.Show("No Office Information"); return; } else if (fsUnit == null) { MessageBox.Show("No Unit Information"); return; } else if (fsInstallation == null) { MessageBox.Show("No Installation Information"); return; } else { DialogResult = true; this.Close(); } }