示例#1
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_add_Click(object sender, EventArgs e)
        {
            Action_Type = false;
            FrmUserEdit  frm    = new FrmUserEdit(Action_Type);
            DialogResult result = frm.ShowDialog();

            if (result == DialogResult.OK)
            {
                Query();
                string MaterialCode = string.Empty;
                QueryMenu(MaterialCode);
                new PubUtils().ShowNoteOKMsg("新增成功!");
            }
        }
示例#2
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_edit_Click(object sender, EventArgs e)
        {
            string UserID       = string.Empty;
            int    iSelectedRow = 0;

            foreach (DataGridViewRow row in dgv_User.Rows)
            {
                if (row.Cells[CHK.Name].EditedFormattedValue.ToString() == "True")
                {
                    UserID = row.Cells["UserID"].EditedFormattedValue.ToString();
                    iSelectedRow++;
                }
            }
            if (iSelectedRow == 0)
            {
                MsgBox.Error("请选择要编辑的行!");
                return;
            }
            else if (iSelectedRow > 1)
            {
                MsgBox.Error("请勿选择多行!");
                return;
            }
            Action_Type = true;
            FrmUserEdit frm = new FrmUserEdit(Action_Type);

            frm._UserID = UserID;
            DialogResult result = frm.ShowDialog();

            if (result == DialogResult.OK)
            {
                Query();
                new PubUtils().ShowNoteOKMsg("修改成功!");
                QueryMenu(UserID);
            }
        }