private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } try { if (e.ColumnIndex == 3) { clearDocumentData(); btnDocument.Enabled = false; prevdoc = new doctcmapping(); int rowID = e.RowIndex; btnSave.Text = "Update"; pnlDocumentInner.Visible = true; pnlDocumentOuter.Visible = true; pnlDocumentList.Visible = false; prevdoc.DocumentID = grdList.Rows[e.RowIndex].Cells[0].Value.ToString(); txtDocument.Text = grdList.Rows[e.RowIndex].Cells[0].Value.ToString(); //string[] termncond = grdList.Rows[e.RowIndex].Cells[2].Value.ToString().Split('-'); creategrid(); //txtTc.Text = grdList.Rows[e.RowIndex].Cells[2].Value.ToString(); disableBottomButtons(); } } catch (Exception) { } }
public void clearDocumentData() { try { //cmbDocumentStatus.SelectedIndex = 0; txtDocument.Text = ""; //txtTc.Text = ""; prevdoc = new doctcmapping(); tclist.Rows.Clear(); } catch (Exception) { } }
private Boolean createAndUpdateTermsAndConditions(DocTcMappingDB tcm) { Boolean status = true; try { DocTcMappingDB tcdb = new DocTcMappingDB(); doctcmapping tc = new doctcmapping(); int count = 0; List <doctcmapping> TCMDetails = new List <doctcmapping>(); foreach (DataGridViewRow row in tclist.Rows) { try { tc = new doctcmapping(); tc.DocumentID = txtDocument.Text; tc.ReferenceTC = row.Cells["RowID"].Value.ToString(); TCMDetails.Add(tc); count++; } catch (Exception ex) { MessageBox.Show("createAndUpdateTermsAndConditions() : Error creating Terms and Conditions mapping"); status = false; } } if (count == 0) { MessageBox.Show("No item selected"); status = false; } else { if (!tcdb.UpdateTCMapping(TCMDetails, tc)) { MessageBox.Show("createAndUpdateTermsAndConditions() : Failed to update Terms and Conditions mapping. Please check the values"); status = false; } } } catch (Exception) { MessageBox.Show("createAndUpdateTermsAndConditions() : Error updating Terms and Conditions."); status = false; } return(status); }