private void toolStripMenuItem1_Click(object sender, EventArgs e) { object o = TagOfSelected; DataProvider.GroupTreeNode other; if (o == null) { MessageBox.Show("Нечего непемещать!"); } else { if (o is DataProvider.GroupTreeNode) { if ((other = FormSelectOneGroup.getNode()) != null) { if (!Program.DataProvider.willMakeCycle((o as DataProvider.GroupTreeNode).ID, other.ID)) { Program.DataProvider.updateGroupParentId((o as DataProvider.GroupTreeNode).ID, other.ID); } else { MessageBox.Show("Такое перемещение запрещено из-за образования цикла в дереве!"); } } else { Program.DataProvider.updateGroupParentId((o as DataProvider.GroupTreeNode).ID, -1); } } else if (o is Int32) { MeasureData md = Program.DataProvider.getMeasureDataByID((int)o); if (md != null) { if ((other = FormSelectOneGroup.getNode()) != null) { md.GroupID = other.ID; } else { md.GroupID = -1; } Program.DataProvider.updateMeasureData(md); } } this.ShowMeasures = this.ShowMeasures; } }
private void buttonSave_Click(object sender, EventArgs e) { if (measureData != null) { DataProvider.GroupTreeNode node = FormSelectOneGroup.getNode(); if (node != null) { measureData.GroupID = node.ID; } measureData.ID = Program.DataProvider.insertMeasureData(measureData); } }
private void buttonSave_Click(object sender, EventArgs e) { longitude = textBox6.Text; latitude = textBox7.Text; if (saved) { Data.quality = comboBox1.SelectedIndex; Data.lng = longitude; Data.ltt = latitude; Data.Description = textBox8.Text; Program.DataProvider.updateMeasureData(Data); } else { if (MessageBox.Show("Сохранить измерение\r\n'" + Data.ToString() + "'?", "Сохранение", MessageBoxButtons.YesNo) == DialogResult.Yes) { DataProvider.GroupTreeNode node = FormSelectOneGroup.getNode(); if (node != null) { Data.GroupID = node.ID; } else { Data.GroupID = -1; } try { measureData.quality = comboBox1.SelectedIndex; measureData.Description = textBox8.Text; measureData.lng = longitude; measureData.ltt = latitude; int id = Program.DataProvider.insertMeasureData(measureData); saved = true; measureData = Program.DataProvider.getMeasureDataByID(id); RePlot(); Text = measureData.ToString(); } catch (Exception ex) { Error.Log(ex); MessageBox.Show("Ошибка сохранения:\r\n" + ex.Message); } } } }
private void FormViewMeasure_FormClosing(object sender, FormClosingEventArgs e) { Data.DefaultMask = comboBoxMask.SelectedItem as Mask; if (!saved) { if (MessageBox.Show("Вы просматривали несохранённое измерение. Сохранить?", "Сохранение?", MessageBoxButtons.YesNo) == DialogResult.Yes) { DataProvider.GroupTreeNode node = FormSelectOneGroup.getNode(); if (node != null) { Data.GroupID = node.ID; } Program.DataProvider.insertMeasureData(measureData); } } else { Program.DataProvider.updateMeasureData(Data); } }