public Edit(SpecialSqlController.Tables table) : base() { InitializeComponent(); Table = table; Actions(); Personalization(); }
protected virtual void Hiding(DataGridView view, SpecialSqlController.Tables table, int count) { if (RowTest(view)) { DialogResult result = MessageBox.Show("Поддтвердите действие удаления указаного количества строк: " + count.ToString(), "Удалить?", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { bool done = true; for (int i = 1; i <= count && done; i++) { string id = view[0, view.SelectedRows[count - i].Index].Value.ToString(); done = done && Controller.DeleteToHistory(table, Convert.ToInt32(id)); } if (done) { Actions(); } else { Error("Ошибка удаления"); } } } }
protected virtual void Hiding(DataGridView view, SpecialSqlController.Tables table, AdditionalDelete additional = null, bool delete = true) { if (RowTest(view)) { string id = GetId(view); DialogResult result = MessageBox.Show("Поддтвердите действие удаления " + (view[1, view.SelectedRows[0].Index] as DataGridViewCell).Value.ToString(), "Удалить?", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { bool done = false; if (delete) { done = (additional != null ? additional(new[] { id }) : true) && Controller.DeleteToHistory(table, Convert.ToInt32(id)); } else { done = (additional != null ? additional(new[] { id }) : false); } if (done) { Actions(); } else { Error("Ошибка удаления"); } } } }
protected virtual void GetData(SpecialSqlController.Tables table, Additional additional = null) { DataList = Controller.GetAllFromWithNames(table, "Enable=1"); if (additional != null) { additional(ref DataList); } }
protected void GetData(SpecialSqlController.Tables table, CreateRow create) { DataList.Clear(); List <Dictionary <string, string> > dataList = Controller.GetAllFromWithNames(table, "Enable=1"); foreach (var d in dataList) { Dictionary <string, string> r = create(d); if (r.Count > 0) { DataList.Add(r); } } }