private void LoadConstantsFromDb() { cbxJob.DisplayMemberPath = "Serial_Customer_Machine"; cbxJob.SelectedValuePath = "Serial_Customer_Machine"; cbxTimeCode.DisplayMemberPath = "Code_Description"; cbxTimeCode.SelectedValuePath = "Code_Description"; cbxSection.DisplayMemberPath = "SectionNumber_SectionDescription"; cbxSection.SelectedValuePath = "SectionNumber_SectionDescription"; foreach (TimesheetCode timesheetCode in queries.TimesheetCodeAll()) { cbxTimeCode.Items.Add(timesheetCode); } foreach (string str in queries.TaskTypes()) { cbxTaskType.Items.Add(str); } foreach (Project project in queries.ProjectAll()) { if ((functions.IntToBool(project.IsOpen) ? true : functions.IntToBool(project.IsWarrantyOpen))) { cbxJob.Items.Add(project); } } sectionsAll = queries.Sections(); myConnection.Close(); }
private void UpdateSections(Project project) { cbxSection.Items.Clear(); lblSectionDescription.Content = ""; if (project == null || cbxTaskType.SelectedItem == null || project.Number_Serial == "" ? false : !(cbxTaskType.SelectedItem.ToString() == "")) { TaskType selectedItem = cbxTaskType.SelectedItem as TaskType; if (!functions.IntToBool(project.IsOpen)) { foreach (Section section in queries.Sections(project.Number_WarrantyNetwork, selectedItem.Id)) { cbxSection.Items.Add(section); } } else { foreach (Section section1 in queries.Sections(project.Number_Network, selectedItem.Id)) { cbxSection.Items.Add(section1); } } } }
public void RefreshListBox_Sections(Project project) { List <Section> sections = queries.Sections(project.Number_Network); reducedSections = new List <Section>(); foreach (Section section in sections) { if (!reducedSections.Any <Section>((Section X) => X.Number_Section == section.Number_Section)) { reducedSections.Add(section); } } lbxSections.ItemsSource = reducedSections; }