예제 #1
0
        private void btnAddUser_Click(object sender, EventArgs e)
        {
            this.flag = "1";
            //获取所选机构
            bool result = GetOwnOrg();

            if (!result)
            {
                return;
            }

            //初始化AddUser
            AddUser addUser = new AddUser();

            addUser.Owner = this;
            addUser.Init();

            addUser.ShowDialog(this);
        }
예제 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //判断选中几行 只修改第一行
            try
            {
                this.flag = "2";
                int count = 0;
                for (int i = 0; i < this.dgvUserInfo.Rows.Count; i++)
                {
                    if (this.dgvUserInfo.Rows[i].Cells[this.dgvUserInfo.Columns["SelectCheck"].Index].EditedFormattedValue.ToString() == "True")
                    {
                        count++;
                        this.userID = this.dgvUserInfo.Rows[i].Cells["id"].Value.ToString();

                        AddUser addUser = new AddUser();
                        addUser.Owner = this;
                        addUser.Init();
                        addUser.ShowDialog(this);
                        return;
                    }
                }
                if (count == 0)
                {
                    MessageBox.Show("请选择要修改的行!");
                    return;
                }
                else if (count > 1)
                {
                    MessageBox.Show("请选择一行修改记录!");
                    return;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }