Beispiel #1
0
 /// <summary>
 /// Add Grid.
 /// </summary>
 private void AddBtn_Click(object sender, EventArgs e)
 {
     try {
         var dialog = new SaveGridForm(EnmSaveBehavior.Add, new IDValuePair <Int32, String>(0, String.Empty));
         if (dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             BindGridTreeView();
             SelectTreeNodeByText(dialog.Grid.Value);
             DeleteBtn.Enabled = EditBtn.Enabled = GridTreeView.Nodes.Count > 0 && GridTreeView.SelectedNode != null;
         }
     } catch (Exception err) {
         Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.GridManagerForm.AddBtn.Click", err.Message, err.StackTrace);
         MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Edit Grid.
        /// </summary>
        private void EditBtn_Click(object sender, EventArgs e)
        {
            try {
                var node = GridTreeView.SelectedNode;
                if (node == null)
                {
                    MessageBox.Show("请选择需要修改的网格", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                var dialog = new SaveGridForm(EnmSaveBehavior.Edit, (IDValuePair <Int32, String>)node.Tag);
                if (dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    BindGridTreeView();
                    SelectTreeNodeByID(dialog.Grid.ID);
                }
            } catch (Exception err) {
                Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.GridManagerForm.AddBtn.Click", err.Message, err.StackTrace);
                MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }