コード例 #1
0
ファイル: ManagerForm.cs プロジェクト: raymon-02/time_manager
 private void editProfileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var editUserForm = new EditUserForm(id, id);
     editUserForm.ShowDialog();
 }
コード例 #2
0
ファイル: AdminForm.cs プロジェクト: raymon-02/time_manager
        private void editButton_Click(object sender, EventArgs e)
        {
            if (dataListView.SelectedItems.Count == 0)
            {
                MessageBox.Show(@"No users selected to edit", @"Wrong selection", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            if (dataListView.SelectedItems.Count > 1)
            {
                MessageBox.Show(@"You must select only one user to edit", @"Wrong selection", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            var login = dataListView.SelectedItems[0].SubItems[0].Text;

            var query = "SELECT id FROM Member WHERE login = '******'";
            var cmd = new NpgsqlCommand(query, npgsqlConnection);
            var dr = cmd.ExecuteReader();
            dr.Read();
            var editId = dr.GetInt32(0);
            dr.Close();

            var editUserForm = new EditUserForm(id, editId);
            editUserForm.ShowDialog();
        }