private void CopyRowDeclair(TabItem TI, Declaration row) { if (TI.ContextMenu == null) { TI.ContextMenu = new ContextMenu(); } MenuItem Copy = new MenuItem(); TI.ContextMenu.Items.Add(Copy); Copy.Header = "Копировать декларацию"; Copy.Click += (sender, e) => { selectThisTC = ThisTC.SelectedIndex; try { uint NewIDDec = MyTools.CopyElements(row, new KeyValuePair <int, object>(C.Declaration.YM, DateControl_Class.SelectMonth)); foreach (var one in row.DeclarationValues) { MyTools.CopyElements(one, new KeyValuePair <int, object>(C.DeclarationValue.Declaration, NewIDDec)); } } catch { MessageBox.Show("Не удалось скопировать запись!"); return; } DrawClient(); DrawObject(); ThisTC.SelectedIndex = selectThisTC; }; }
private void CopyRow(TabItem TI, MyTools.C_A_BaseFromAllDB row, params KeyValuePair <int, object>[] values) { if (TI.ContextMenu == null) { TI.ContextMenu = new ContextMenu(); } MenuItem Copy = new MenuItem(); TI.ContextMenu.Items.Add(Copy); Copy.Header = "Копировать"; Copy.Click += (sender, e) => { selectThisTC = ThisTC.SelectedIndex; try { MyTools.CopyElements(row, values); } catch { MessageBox.Show("Не удалось скопировать запись!"); return; } DrawClient(); DrawObject(); ThisTC.SelectedIndex = selectThisTC; }; }