/// <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; } }
//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(); } }