Пример #1
0
        private void ClientsObjects_Click(object sender, RoutedEventArgs e)
        {
            var objs = AllClients.GetClients(AllClients.GetObjects(false).ToList(), false);

            SG = new SearchGrid_Window(objs, new C_SettingSearchDataGrid
                                           (ThisDelegate: MouseDoubleClick,
                                           ColorConditions: new ColorCondition
                                               (column.DateClose,
                                               ((text) => { return(text.TryParseInt() > 0 && text.TryParseInt() <= DateControl_Class.SelectMonth); }),
                                               Brushes.Red)
                                           , DopText: $"Последний номер папки: {objs.Max(x=>x.NumberFolder)}"));
            MenuItem MiAdd = new MenuItem();

            MiAdd.Header = "Добавить";
            MiAdd.Click += (senderAdd, eAdd) =>
            {
                try
                { SG.SelectID = MyTools.AddRowFromTable(G.Client, new KeyValuePair <int, object>(C.Client.INN, "000"), new KeyValuePair <int, object>(C.Client.YMFrom, DateControl_Class.SelectMonth - 1)); }
                catch
                {
                    MessageBox.Show("В базе существует пустой клиент с ИНН \"000\"");
                    return;
                }
                MouseDoubleClick(null, null);
                SG.ReSet(AllClients.GetClients(AllClients.GetObjects(true).ToList(), true));
            };
            SG.ThisMenu.Items.Add(MiAdd);
            Button btShowAll = new Button {
                Content = "Показать все"
            };

            btShowAll.Click += (senderS, eS) =>
            {
                SG.ReSet(AllClients.GetClients(AllClients.GetObjects(true).ToList(), true));
                btShowAll.IsEnabled = false;
            };
            SG.ThisMenu.Items.Add(btShowAll);
            this.SelectWindowSearth(SG);
        }