private void InitializeComboBox()
        {
            DeserializeXml dx = new DeserializeXml();
            var sortInstallation = dx.DeserializeInstallation().InstallationOptions.OrderBy(si => si.InstallationName);

            cbxInstallationName.ItemsSource = sortInstallation;
            cbxInstallationName.DisplayMemberPath = "InstallationName";
            cbxInstallationName.SelectedValuePath = "InstallationCode";

            cbxInstallationName.SelectedIndex = 0;
            rdbSOSearchByName.IsChecked = true;
        }
Пример #2
0
        private void GetTrainees(List<PersonAndDbidsOperators.Person> operators)
        {
            TraineeByDate = new List<Trainee>();
            Trainee trainee;
            DeserializeXml dx = new DeserializeXml();

            foreach (PersonAndDbidsOperators.Person person in operators)
            {
                DateTime dateOfBirth;
                if (!string.IsNullOrEmpty(person.DateOfBirth))
                    dateOfBirth = DateTime.Parse(person.DateOfBirth);
                else
                    dateOfBirth = DateTime.Now;

                DateTime regDate = DateTime.Parse(person.RegDate);
                DateTime lastTrainedDate = DateTime.Parse(person.LastTrainedDate);
                Byte[] buffer = null;
                ImageConverter ic = new ImageConverter();
                buffer = ic.FromFileToByte(person.Photo);
                var installation = dx.DeserializeInstallation().InstallationOptions.Where(i => i.InstallationCode.Equals(person.Installation)).Select(i => i.InstallationName).First();

                trainee = new Trainee
                {
                    PID = person.PID,
                    LastName = person.LastName,
                    HomePhone = person.HomePhone,
                    MobilePhone = person.MobilePhone,
                    FirstName = person.FirstName,
                    MiddleName = person.MiddleName,
                    DateOfBirth = dateOfBirth,
                    Gender = person.Gender,
                    OfficePhone = person.OfficePhone,
                    Fax = person.Fax,
                    Photo = buffer,
                    Email = person.Email,
                    RankID = int.Parse(person.RankID),
                    OfficeCode = person.OfficeCode,
                    TypeOfPID = person.TypeOfPID,
                    RegDate = regDate,
                    JobTitle = person.JobTitle,
                    PersonRemarks = person.PersonRemarks,
                    OperatorType = person.OperatorType,
                    Installation = person.Installation,
                    InstallationName = installation.ToString(),
                    LastTrainedDate = lastTrainedDate,
                    Nationality = person.Nationality
                };
                TraineeByDate.Add(trainee);
            }
        }
        //Get the information of the installation and put it into the TextBlock
        private void GetInstallationInformation(string installatioName)
        {
            DeserializeXml dx = new DeserializeXml();
            var installtion = dx.DeserializeInstallation().InstallationOptions.Where(i => i.InstallationCode == installatioName);

            foreach (InstallationNameOptions.InstallationNameOption inst in installtion)
            {
                txbInstallationCode.Text = inst.InstallationCode;
                txbArea.Text = inst.Area;
                txbCity.Text = inst.City;
            }
        }
        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();
        }