コード例 #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dgvProgramList.Rows.Count > 0)
            {
                if (dgvProgramList.SelectedRows.Count == 1)
                {
                    int selectIndex = dgvProgramList.CurrentRow.Index;
                    var programID   = dgvProgramList.Rows[selectIndex].Cells[0].Value;

                    var p = ProgramsHelper.GetById(Convert.ToInt32(programID));

                    txtProgramName.Text = Convert.ToString(p.Name);
                    EnableComponent();
                }
            }
            else
            {
                MessageBox.Show("Program listesi boş!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            epProgram.Clear();
            bool check = SessionsHelper.ControlValidate(txtProgramName, "Lütfen Program  İsmini Giriniz.", epProgram);

            if (check)
            {
                int selectIndex = dgvProgramList.CurrentRow.Index;
                var programID   = dgvProgramList.Rows[selectIndex].Cells[0].Value;

                var p = ProgramsHelper.GetById(Convert.ToInt32(programID));
                p.Name = txtProgramName.Text.Trim();

                ProgramsHelper.Update(p);

                MessageBox.Show("Program güncelleme başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClearForm();
                FillGrid();
                DisableComponent();
            }
        }