示例#1
0
        /// <summary>
        /// 编辑事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonEdit_Click(object sender, EventArgs e)
        {
            if (DataGridViewX1.SelectedRows.Count == 1)
            {
                //CustomDesktopAlert.H2(DataGridViewX1.SelectedRows[0].Cells["部门编号"].Value.ToString());
                int selectedRowId         = int.Parse(DataGridViewX1.SelectedRows[0].Cells["部门编号"].Value.ToString());
                FrmOrganizationDetail frm = new FrmOrganizationDetail
                {
                    Deptid        = selectedRowId,
                    StartPosition = FormStartPosition.CenterParent
                };

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    RefreshGridView();

                    RefreshTreeView();
                }
            }
            else if (DataGridViewX1.SelectedRows.Count > 1)
            {
                CustomDesktopAlert.H2("只能选择一行编辑");
            }
            else
            {
                CustomDesktopAlert.H2("请先选择要编辑的行");
            }
        }
示例#2
0
        private void ButtonInsert_Click(object sender, EventArgs e)
        {
            FrmOrganizationDetail frm = new FrmOrganizationDetail
            {
                Deptid        = -1,
                StartPosition = FormStartPosition.CenterParent
            };

            if (frm.ShowDialog() == DialogResult.OK)
            {
                RefreshGridView();

                RefreshTreeView();
            }
        }