// Fill the Rank Combo Box When select a service private void ChangeRankComboBox(string typeService) { DeserializeXml dx = new DeserializeXml(); var rsServices = dx.DeserializeRank().RankOptions.Where(rs => rs.Service == typeService); cbxRank.ItemsSource = rsServices; cbxRank.DisplayMemberPath = "RankGrade"; cbxRank.SelectedValuePath = "RankID"; cbxRank.SelectedIndex = 0; }
private void InitializeComboBox() { DeserializeXml dx = new DeserializeXml(); OtherOptions otherOptions = dx.DeserializeOtherOptions(); CountriesNameOptions cnOptions = dx.DeserializeCountry(); RankServiceOptions rsOptions = dx.DeserializeRank(); PersonalInfoOptions piOptions = dx.DeserialzeObject(); InstallationNameOptions inOptions = dx.DeserializeInstallation(); Operators = dx.DeserializePersons(); EmailList = otherOptions.EmailServerOptions; ; cbxService.ItemsSource = rsOptions.RankOptions.Select(ro => ro.Service).Distinct(); cbxTypeOfPID.ItemsSource = piOptions.IDTypeOptions; cbxTypeOfPID.DisplayMemberPath = "IDType"; cbxTypeOfPID.SelectedValuePath = "Value"; cbxNationality.ItemsSource = cnOptions.CountriesOptions; cbxNationality.DisplayMemberPath = "Name"; cbxNationality.SelectedValuePath = "Code"; cbxGender.ItemsSource = piOptions.GenderOptions; cbxGender.DisplayMemberPath = "Gender"; cbxGender.SelectedValuePath = "Value"; //cbxService.ItemsSource = rsOptions.RankOptions.Select(ro => ro.Service).Distinct(); cbxOperatorType.ItemsSource = otherOptions.OperatorOptions; cbxOperatorType.DisplayMemberPath = "Operator"; cbxOperatorType.SelectedValuePath = "Value"; cbxEmailServer.ItemsSource = otherOptions.EmailServerOptions; cbxEmailServer.DisplayMemberPath = "EmailServer"; cbxEmailServer.SelectedValuePath = "Value"; cbxMobilePhoneArea.ItemsSource = piOptions.MobilePhoneCodes; cbxMobilePhoneArea.DisplayMemberPath = "MobilePhone"; cbxMobilePhoneArea.SelectedValuePath = "Value"; cbxOfficePhoneArea.ItemsSource = piOptions.PhoneAreaCodes; cbxOfficePhoneArea.DisplayMemberPath = "PhoneArea"; cbxOfficePhoneArea.SelectedValuePath = "Value"; //cbxFaxArea.ItemsSource = piOptions.PhoneAreaCodes; //cbxFaxArea.DisplayMemberPath = "PhoneArea"; //cbxFaxArea.SelectedValuePath = "Value"; cbxInstallation.ItemsSource = inOptions.InstallationOptions.OrderBy(i => i.InstallationName); cbxInstallation.DisplayMemberPath = "InstallationName"; cbxInstallation.SelectedValuePath = "InstallationCode"; // Set the Default value of the combo box cbxService.SelectedValue = "KSG"; cbxNationality.SelectedValue = "KR"; cbxGender.SelectedIndex = 0; cbxOperatorType.SelectedIndex = 1; cbxEmailServer.SelectedIndex = 7; cbxMobilePhoneArea.SelectedIndex = 0; cbxOfficePhoneArea.SelectedIndex = 0; cbxTypeOfPID.SelectedIndex = 0; //cbxFaxArea.SelectedIndex = 0; cbxInstallation.SelectedIndex = 11; dpkDateOfBirth.DisplayDate = DateTime.Now.AddYears(-25); imgDBIDSOperator.Source = ShowPhoto(@"XMLData\Photos.png"); GetOffices(); }