private void Period_Click(object sender, RoutedEventArgs e) { SG = new SearchGrid_Window(G.Period, null, null, new C_SettingSearchDataGrid(table: G.Period), true); SG.ShowDialog(); AdditionnTable.LoadPeriod(); }
void Act_Click(object sender, RoutedEventArgs e) { var _querry = G.Volume.QUERRY() .SHOW .WHERE .C(C.Volume.Sample, selectionWell.SampleID); _querry.DO(); if (G.Volume.Rows.Count > 0) { SearchGrid_Window sg = new SearchGrid_Window(G.Volume, null, null, new C_SettingSearchDataGrid(DefDeleg: true)); sg.ShowDialog(); if (sg.SelectID > 0) { var table = T.NormDoc.CreateSubTable(); table.QUERRY().SHOW.WHERE.ARC(C.NormDoc.Volume, C.Volume.Sample).EQUI.BV(selectionWell.SampleID).DO(); MyTools.AddRowFromTable(table, new KeyValuePair<int, object>(C.NormDoc.Volume, sg.SelectID)); } LoadAct(); } else { MessageBox.Show("Объёмы не указаны"); } }
private void DG_Show_Edit(object sender, MouseButtonEventArgs e) { if (DG.SelectedIndex > -1) { if (DG.CurrentCell.Column.DisplayIndex == 8) { SG_W = new SearchGrid_Window(AdditionnTable.GetWorkerDT(data.ETypeTemplate.ActSelection), new C_SettingSearchDataGrid(DefDeleg: true, IDSelect: (DG.SelectedItem as NegotiationAssistantSearch).WorkerID)); SG_W.ShowDialog(); if (SG_W.SelectID > 0) { var selectedValue = ((NegotiationAssistantSearch)DG.SelectedValue); selectedValue.WorkerID = SG_W.SelectID; var worker = Helpers.LogicHelper.WorkerLogic.FirstModel(SG_W.SelectID); selectedValue.Add(worker); } DG.Items.Refresh(); } } if (DG.SelectedIndex > -1 && DG.CurrentCell.Column.DisplayIndex != 8) { new SampleAdd_Window((DG.SelectedItem as NegotiationAssistantSearch).ID).ShowDialog(); ShowSelect_Click(null, null); } }
private void LoadAct() { ShowAct.Children.Clear(); ShowAct.RowDefinitions.Clear(); ShowAct.ColumnDefinitions.Clear(); ShowAct.SetRowFromGrid(MyTools.GL_Auto); Button add = new Button { Content = "Добавить акт" }; //var samples = Values.Select(x => Logic.LogicInstances.SampleLogic.FirstOrDefault(x.SampleID)).ToArray();\ var samples = selectionWell.Sample.SelectionWells.ToArray(); add.Click += (sender, e) => { var _querry = G.Volume.QUERRY() .SHOW .WHERE .C(C.Volume.Sample, samples.First().ID); for (int i = 1; i < samples.Length; i++) { _querry.OR.C(C.Volume.Sample, samples[i].ID); } _querry.DO(); SearchGrid_Window sg = new SearchGrid_Window(G.Volume, null, null, new C_SettingSearchDataGrid(DefDeleg: true)); sg.ShowDialog(); if (sg.SelectID > 0) { MyTools.AddRowFromTable(G.NormDoc, new KeyValuePair <int, object>(C.NormDoc.Volume, sg.SelectID)); } LoadAct(); }; ShowAct.SetFromGrid(add); if (samples.Any()) { var querry = G.NormDoc.QUERRY() .SHOW .WHERE .ARC(C.NormDoc.Volume, C.Volume.Sample, C.Sample.YM).EQUI.BV(DateControl_Class.SelectMonth); querry.AND.OB().ARC(C.NormDoc.Volume, C.Volume.Sample).EQUI.BV(samples.First().ID); for (int i = 1; i < samples.Length; i++) { querry.OR.ARC(C.NormDoc.Volume, C.Volume.Sample).EQUI.BV(samples[i].ID); } querry.DO(); List <NormDoc> normDocs = new List <NormDoc>(); int count = G.NormDoc.Rows.Count; for (int i = 0; i < count; i++) { ShowAct.SetRowFromGrid(MyTools.GL_Auto); normDocs.Add(Logic.LogicInstances.NormDocLogic.FirstOrDefault(G.NormDoc.Rows.GetID(i))); ShowAct.SetFromGrid(normDocs.Last().GetEditor(new MyTools.C_SettingFromRowEdit(MyTools.EPosition.Vertical))); } } }
private void EditorSample() { EditNegotiationAssistant.SetRowFromGrid(MyTools.GL_Auto); Sample sample = Helpers.LogicHelper.SampleLogic.FirstModel(negotiationAssistant.SampleID); EditNegotiationAssistant.SetFromGrid(sample.GetEditor(new MyTools.C_SettingFromRowEdit(MyTools.EPosition.Vertical, Scope: true, Color: Brushes.LightSeaGreen), new MyTools.C_DefColumn(C.Sample.Representative, WH, font: font, Click: (sender, e) => { G.Representative.QUERRY().SHOW.WHERE.C(C.Representative.Client, negotiationAssistant.GetIDValue(C.NegotiationAssistant.Objecte, C.Objecte.Client)).DO(); List <C_ColumnFromSearch> column = new List <C_ColumnFromSearch>(); column.Add(new C_ColumnFromSearch(C.Representative.FIO)); column.Add(new C_ColumnFromSearch(C.Representative.Post)); SearchGrid_Window search = new SearchGrid_Window(G.Representative, null, column, new C_SettingSearchDataGrid(DefDeleg: true)); MenuItem miAdd = new MenuItem(); miAdd.Header = "Добавить представителя"; miAdd.Click += (sender1, e1) => { var clientID = negotiationAssistant.Objecte.ClientID; G.Client.QUERRY().SHOW.WHERE.ID(clientID).DO(); var addForm = new Edit_Form(G.Representative, 500, false); addForm.LoadData(); addForm.controls[C.Representative.Client].Default = clientID; addForm.controls[C.Representative.Client].obj.Enabled = false; addForm.ShowDialog(); search.SelectID = addForm.ID; search.Close(); }; search.ThisMenu.Items.Add(miAdd); search.ShowDialog(); if (search.SelectID > 0) { sample.SetValue(C.Sample.Representative, search.SelectID); } }))); G.SelectionWell.QUERRY().SHOW.WHERE.C(C.SelectionWell.Sample, negotiationAssistant.SampleID).DO(); uint[] SelectionWells = new uint[G.SelectionWell.Rows.Count]; for (int i = 0; i < SelectionWells.Length; i++) { SelectionWells[i] = G.SelectionWell.Rows.GetID(i); } foreach (var one in SelectionWells.Select(x => Helpers.LogicHelper.SelectionWellLogic.FirstModel(x))) { EditNegotiationAssistant.SetRowFromGrid(MyTools.GL_Auto); EditNegotiationAssistant.SetFromGrid(one.GetEditor(new MyTools.C_SettingFromRowEdit(MyTools.EPosition.Vertical, Scope: true, Color: Brushes.LightSkyBlue), new MyTools.C_DefColumn(C.SelectionWell.Well, WH, false, font: font), new MyTools.C_DefColumn(C.SelectionWell.Number, WH, data.User <bool>(C.User.CanRedact), font: font), new MyTools.C_DefColumn(C.SelectionWell.DateTime, WH, font: font))); } }
private void DeclairWell_Click(object sender, RoutedEventArgs e) { List <C_ColumnFromSearth> columns = new List <C_ColumnFromSearth> { new C_ColumnFromSearth(C.DeclarationValue.Declaration, C.Declaration.Well, C.Well.Object, C.Objecte.Client, C.Client.INN), new C_ColumnFromSearth(C.DeclarationValue.Declaration, (obj, id) => { return(AllClients.ClientAtWell(id).Detail.FullName); }), new C_ColumnFromSearth(C.DeclarationValue.Declaration, C.Declaration.Well, C.Well.Object, C.Objecte.AdresFact), new C_ColumnFromSearth(C.DeclarationValue.Declaration, C.Declaration.Well, C.Well.TypeWell, C.TypeWell.CurtName), new C_ColumnFromSearth(C.DeclarationValue.Declaration, C.Declaration.Well, C.Well.Number), new C_ColumnFromSearth(C.DeclarationValue.Declaration, (obj, ID) => { return(MyTools.YearMonth_From_YM(obj.TryParseInt())); }, C.Declaration.YM), new C_ColumnFromSearth(C.DeclarationValue.Pollution), new C_ColumnFromSearth(C.DeclarationValue.From), new C_ColumnFromSearth(C.DeclarationValue.To) }; SG = new SearchGrid_Window(G.DeclarationValue, new C_ColumnGetID(C.DeclarationValue.Declaration, C.Declaration.Well), columns, new C_SettingSearchDataGrid(true, true, false, AdderButton: false), true); SG.ShowDialog(); }
protected override void Start() { var temp = new List <Item>(); int count = sheet.LastRowNum; uint ID = 1; for (int Nrow = StartRow; Nrow < sheet.LastRowNum + 1; Nrow++) { _values = new Dictionary <string, string>(); IRow row = sheet.GetRow(Nrow); if (row == null) { break; } foreach (var one in ColumnsBook) { ICell cell = row.GetCell(one.Value); _values.Add(one.Key, cell.ToString().Trim().Trim('\'')); } if (_values.ContainsKey(Columns.volold) || _values.ContainsKey(Columns.volnew)) { _values.Remove(Columns.volume); } temp.Add(new Item(ID, _values)); ID++; } _files = temp.GroupBy(x => x.INN + x.Adres).Select(x => new Item(x.First(), x.Select(y => y.Volume).ToArray(), x.Select(y => y.Acount.Replace("'", string.Empty)).Aggregate((a, b) => $"{a},{b}"))).ToList(); Compare(); ComparisonVolume(); ContextMenu(); DG.MouseDoubleClick += (sender, e) => { if (DG.SelectedIndex == -1) { return; } var select = (DG.Items[DG.SelectedIndex] as Item); if (select.objecte == null && select.client != null) { _sg_W = new SearchGrid_Window(select.client.Objects.ToArray(), new C_SettingSearchDataGrid(DefDeleg: true, DopText: $"{select.Adres.Replace("\n", "")}{(select.sample == null ? "\nНе найден отбор!" : string.Empty)}")); _sg_W.ShowDialog(); if (_sg_W.SelectID > 0) { if (SWs.FirstOrDefault(x => x.ObjectID == _sg_W.SelectID) == null) { if (MessageBox.Show($"Объект: {Helpers.LogicHelper.ObjecteLogic.FirstModel(_sg_W.SelectID).Adres}\nне отбирался {MyTools.YearMonth_From_YM(date)}г\nХотите удалить запись?", "Убрать не отобранный объект?", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { select.client.Objects.First(x => x.ID == _sg_W.SelectID).SetAccounts(select.Acount.Split(',')); _files.Remove(select); ResetDG(); return; } } else { select.SetClient(SWs.First(x => x.ObjectID == _sg_W.SelectID), select.client.Objects.First(x => x.ID == _sg_W.SelectID)); //Волшебная строка закраски ROW (DG.ItemContainerGenerator.ContainerFromIndex(DG.SelectedIndex) as DataGridRow).Background = Brushes.Green; //Волшебная строка закраски ROW } } } else if (select.Volumes == null || select.client == null) { _sg_W = new SearchGrid_Window(_file, new C_SettingSearchDataGrid(DefDeleg: true, DopText: $"Клиент - {select.NameClient}\nАдрес- {select.Adres}\nИНН- {select.INN}")); _sg_W.ShowDialog(); if (_sg_W.SelectID > 0) { Item fil = _file.First(x => x.ID == _sg_W.SelectID); _files[DG.SelectedIndex] = new Item(select, fil.Volumes.Split('+').Select(x => x.TryParseDouble()).ToArray(), fil.Acount); _files[DG.SelectedIndex].SetClient(SWs.FirstOrDefault(x => (string)x.GetValue(C.SelectionWell.Well, C.Well.Object, C.Objecte.Client, C.Client.INN) == _files[DG.SelectedIndex].INN)); Objecte obj = _files[DG.SelectedIndex].objecte; if (obj != null) { _files[DG.SelectedIndex].SetClient(SWs.First(x => x.ObjectID == obj.ID), obj); (DG.ItemContainerGenerator.ContainerFromIndex(DG.SelectedIndex) as DataGridRow).Background = Brushes.Green; } else { (DG.ItemContainerGenerator.ContainerFromIndex(DG.SelectedIndex) as DataGridRow).Background = Brushes.Yellow; } } } }; ResetDG(); }