Exemple #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     var form = new MenuForm(Rows.Where(r => String.IsNullOrEmpty(r.RootId)));
     if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
     {
         form.Row.Id = GetMaxId().ToString();
         Rows.Add(form.Row);
     }
     RefreshGrid();
 }
Exemple #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (this.dataGridView1.SelectedRows.Count > 0)
     {
         var id = this.dataGridView1.SelectedRows[0].Cells["Id"].Value.ToString();
         var row = Rows.FirstOrDefault(r => r.Id == id);
         if (row != null)
         {
             var form = new MenuForm(Rows.Where(r => String.IsNullOrEmpty(r.RootId)), row);
             if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
             {
                 row.Title = form.Row.Title;
                 row.MenuType = form.Row.MenuType;
                 row.Key = form.Row.Key;
                 row.Url = form.Row.Url;
                 row.RootId = form.Row.RootId;
             }
             RefreshGrid();
         }
     }
 }