/* private void CancelAdd(object sender, RoutedEventArgs e) * { * this.Close(); * } */ private void U1_ChangeInfo(object sender, SelectionChangedEventArgs e) { if (cbIDu1.SelectedIndex != -1) { if (ActiveUser.UserType == 1) { //string str = cbIDu1.SelectedItem.ToString().Remove(0, 38); List <string> lst = DataWork.GetCollection(Convert.ToInt32(cbIDu1.SelectedItem.ToString().Remove(0, 38))); tbProjectName.Text = lst[0]; projectName = lst[0]; cDate.SelectedDate = Convert.ToDateTime(lst[1]); tbSum.Text = lst[2]; if (lst[3] == "UAH") { cbCurrency.SelectedIndex = 0; } else if (lst[3] == "USD") { cbCurrency.SelectedIndex = 1; } else { cbCurrency.SelectedIndex = 2; } tbMarks.Text = lst[4]; tbNotes.Text = lst[5]; } else { List <string> lst = DataWork.GetCollection(Convert.ToInt32(cbIDu1.SelectedItem.ToString().Remove(0, 38))); tbSum.Text = lst[2]; tbProjectName.Text = lst[0]; projectName = lst[0]; cDate.SelectedDate = Convert.ToDateTime(lst[1]); if (lst[3] == "UAH") { cbCurrency.SelectedIndex = 0; } else if (lst[3] == "USD") { cbCurrency.SelectedIndex = 1; } else { cbCurrency.SelectedIndex = 2; } tbMarks.Text = lst[4]; tbNotes.Text = lst[5]; tbRKO.Text = lst[6]; tbRates.Text = lst[7]; tbReceiver.Text = lst[8]; tbWhoReceived.Text = lst[9]; tbBank.Text = lst[10]; } } }
private void ShowMeBriefReport() { ClearWorkSpace(); tbTotalMinus.Text = ""; tbTotalPlus.Text = ""; tbTotalShort.Text = ""; dgDistributionPercents.ItemsSource = null; dgPlus.ItemsSource = null; dgMinus.ItemsSource = null; WindowMode = (int)Mods.Brief; //cbProjectName.FontSize = 19; //Подготовка среды lst.Clear(); cbProjectName.Items.Clear(); //ComboBoxItem tmp = new ComboBoxItem(); //tmp.Content = "Введите проект"; cbProjectName.Items.Insert(0, "Введите проект"); if (ActiveUser.UserType == 4) { lst = DataWork.GetCollection("project_name_user4"); } else { lst = DataWork.GetCollection("name_of_project"); } //lst.Insert(0, tmp); foreach (ComboBoxItem cbi in lst) { cbProjectName.Items.Add(cbi); } cbProjectName.SelectedIndex = 0; //Отображение cbMarks_Report.Visibility = Visibility.Visible; cbCurrency_Report.Visibility = Visibility.Visible; gBriefReport.Visibility = Visibility.Visible; cStartDate.Visibility = Visibility.Visible; cFinishDate.Visibility = Visibility.Visible; cbProjectName.Visibility = Visibility.Visible; cbAlltime.Visibility = Visibility.Visible; if ((ActiveUser.UserType == 1) || (ActiveUser.UserType == 22)) { dgDistributionPercents.Visibility = Visibility.Hidden; } else { Thickness marginThickness = gSum.Margin; gSum.Width = 371; gSum.HorizontalAlignment = HorizontalAlignment.Right; marginThickness.Right = 10; marginThickness.Bottom = 0; } }
void update_comboboxes(int type) { if (type != 1) { List <ComboBoxItem> lst1 = new List <ComboBoxItem>(); lst1.Clear(); cbReceiver.Items.Clear(); lst1 = DataWork.GetCollection("receiver"); //var sortedList = lst1.OrderBy(x => x); foreach (ComboBoxItem cbi in lst1) { if (!cbReceiver.Items.Contains(cbi.Content) & cbi.Content.ToString() != "") { cbReceiver.Items.Add(cbi.Content); } } /* cbReceiver.Items.SortDescriptions.Add( * new SortDescription("Content", ListSortDirection.Ascending));*/ cbReceiver.Items.Add("Новый"); tbReceiver.Visibility = Visibility.Hidden; List <ComboBoxItem> lst2 = new List <ComboBoxItem>(); lst2.Clear(); сbWhoReceived.Items.Clear(); lst2 = DataWork.GetCollection("who_received"); foreach (ComboBoxItem cbi in lst2) { if (!сbWhoReceived.Items.Contains(cbi.Content) & cbi.Content.ToString() != "") { сbWhoReceived.Items.Add(cbi.Content); } } /*сbWhoReceived.Items.SortDescriptions.Add( * new SortDescription("Items", ListSortDirection.Ascending)); * lst2.Sort();*/ сbWhoReceived.Items.Add("Новый"); } List <ComboBoxItem> lst = new List <ComboBoxItem>(); lst.Clear(); cbProjectName.Items.Clear(); lst = DataWork.GetCollection("name_of_project"); foreach (ComboBoxItem cbi in lst) { cbProjectName.Items.Add(cbi); } //lst.Sort(); }