private void btnSubmitBookCondition_Click(object sender, EventArgs e) { // UpdateGrid(); if (txtExplanation.Text == "") { lblExplanations.Visible = true; } if (dataGridStorageOfBooks == null || dataGridStorageOfBooks.SelectedRows.Count != 1) { MessageBox.Show("لطفا خط رکورد مربوط به کتاب مورد نظر را انتخاب کنید", "خطا"); } else if (rdBtnGoodBooks.Checked && txtExplanation.Text != "") { string Selected = ""; Guid codeBook = new Guid(); foreach (DataGridViewRow item in dataGridStorageOfBooks.SelectedRows) { Selected = item.Cells[6].Value.ToString(); } codeBook = Guid.Parse(Selected); booksRepo.ChangeBookCondition(codeBook, 0, txtExplanation.Text); MessageBox.Show("وضعیت کتاب با موفقیت ثبت شد", "Success"); } else if (rdBtnMissedBooks.Checked && txtExplanation.Text != "") { string Selected = ""; Guid codeBook = new Guid(); foreach (DataGridViewRow item in dataGridStorageOfBooks.SelectedRows) { Selected = item.Cells[6].Value.ToString(); } codeBook = Guid.Parse(Selected); booksRepo.ChangeBookCondition(codeBook, 1, txtExplanation.Text); MessageBox.Show("وضعیت کتاب با موفقیت ثبت شد", "Success"); } else if (rdBtnTornBooks.Checked && txtExplanation.Text != "") { string Selected = ""; Guid codeBook = new Guid(); foreach (DataGridViewRow item in dataGridStorageOfBooks.SelectedRows) { Selected = item.Cells[6].Value.ToString(); } codeBook = Guid.Parse(Selected); booksRepo.ChangeBookCondition(codeBook, 2, txtExplanation.Text); MessageBox.Show("وضعیت کتاب با موفقیت ثبت شد", "Success"); } else if (rdBtnOldBooks.Checked && txtExplanation.Text != "") { string Selected = ""; Guid codeBook = new Guid(); foreach (DataGridViewRow item in dataGridStorageOfBooks.SelectedRows) { Selected = item.Cells[6].Value.ToString(); } codeBook = Guid.Parse(Selected); booksRepo.ChangeBookCondition(codeBook, 3, txtExplanation.Text); MessageBox.Show("وضعیت کتاب با موفقیت ثبت شد", "Success"); } }