private void ListTermsAndConditions() { try { grdList.Rows.Clear(); rowid = new List <int>(); TermsAndConditionsDB tcdb = new TermsAndConditionsDB(); List <termsandconditions> TCond = tcdb.getTermsAndConditionsfordoc(txtDocument.Text); int i = 0; foreach (termsandconditions tc in TCond) { grdList.Rows.Add(); rowid.Add(tc.RowID); grdList.Rows[grdList.RowCount - 1].Cells["LineNo"].Value = i + 1; grdList.Rows[grdList.RowCount - 1].Cells["gRowID"].Value = tc.RowID; grdList.Rows[grdList.RowCount - 1].Cells["ParagraphID"].Value = tc.ParagraphID; grdList.Rows[grdList.RowCount - 1].Cells["ParagraphHeading"].Value = tc.ParagraphHeading; grdList.Rows[grdList.RowCount - 1].Cells["Details"].Value = tc.Details; i++; } } catch (Exception ex) { MessageBox.Show("Error in Terms and Condition Listing"); } try { enableBottomButtons(); pnlList.Visible = true; btnNew.Visible = false; } catch (Exception ex) { } }
private Boolean createAndUpdateTermsAndConditions() { Boolean status = true; try { TermsAndConditionsDB tcdb = new TermsAndConditionsDB(); termsandconditions tc = new termsandconditions(); List <termsandconditions> TCDetails = new List <termsandconditions>(); for (int i = 0; i < grdList.Rows.Count; i++) { try { tc = new termsandconditions(); tc.RowID = Convert.ToInt32(grdList.Rows[i].Cells["gRowID"].Value); tc.documentID = txtDocument.Text; tc.ParagraphID = Convert.ToInt32(grdList.Rows[i].Cells["ParagraphID"].Value); tc.ParagraphHeading = grdList.Rows[i].Cells["ParagraphHeading"].Value.ToString().Trim(); tc.Details = grdList.Rows[i].Cells["Details"].Value.ToString().Trim(); TCDetails.Add(tc); } catch (Exception ex) { MessageBox.Show("createAndUpdateTermsAndConditions() : Error creating Terms and Conditions"); status = false; } } if (!verifyAndReworkTermsAndConditionsGridRows()) { MessageBox.Show("Terms and Conditions failed to save."); status = false; } else { if (!tcdb.UpdateTermsAndConditions(TCDetails, rowid)) { MessageBox.Show("createAndUpdateTermsAndConditions() : Failed to update Terms and Conditions. Please check the values"); status = false; } } } catch (Exception) { MessageBox.Show("createAndUpdateTermsAndConditions() : Error updating Terms and Conditions."); status = false; } return(status); }
protected string getTCString(string TC) { string TCString = ""; string s; string[] str = TC.Trim().Split(new string[] { ";" }, StringSplitOptions.None); for (int i = 0; i < str.Length - 1; i++) { try { TCString = TCString + TermsAndConditionsDB.getTCDetailsNew(Convert.ToInt32(str[i])); } catch (Exception ex) { } } return(TCString); }
protected string getTCString(string TC) { string TCString = ""; string s; string[] str = TC.Trim().Split(new string[] { ";" }, StringSplitOptions.None); for (int i = 0; i < str.Length - 1; i++) { try { TCString = TCString + TermsAndConditionsDB.getTCDetailsNew(Convert.ToInt32(str[i])); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error-" + ex.ToString()); } } return(TCString); }
protected string getTCString(string TC, string documentID) { string TCString = ""; string s; string[] str = TC.Trim().Split(new string[] { ";" }, StringSplitOptions.None); for (int i = 0; i < str.Length - 1; i++) { try { TCString = TCString + TermsAndConditionsDB.getTCDetailsNew(Convert.ToInt32(str[i]), documentID); } catch (Exception ex) { MessageBox.Show("Failed to Save 6 : " + ex.ToString()); } } return(TCString); }
private void grdList_CellContentClick_1(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0) { return; } string columnName = grdList.Columns[e.ColumnIndex].Name; try { if (columnName.Equals("Delete")) { //delete row DialogResult dialog = MessageBox.Show("Are you sure to Delete the row ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { delRowID = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["gRowID"].Value); TermsAndConditionsDB tcdb = new TermsAndConditionsDB(); if (tcdb.DeleteTermsAndConditionsrow(delRowID)) { grdList.Rows.RemoveAt(e.RowIndex); rowid.RemoveAt(rowid.IndexOf(delRowID)); MessageBox.Show("Terms and condition Row Deleted"); } else { MessageBox.Show("ERROR!! Deleting Terms and condition Row, \n Please check if this Terms and Condition item is mapped with any Document!!!"); return; } } verifyAndReworkTermsAndConditionsGridRows(); } } catch (Exception) { } } catch (Exception ex) { } }
private void ListTermsAndConditions(string did) { try { ListViewTC.Items.Clear(); TCmappingDB tcmdb = new TCmappingDB(); List <tcmapping> TCMList = tcmdb.getTCMappingList(did); string[] str = new string[TCMList.Count]; int i = 0; TermsAndConditionsDB tcdb = new TermsAndConditionsDB(); List <termsandconditions> TCList = tcdb.getTermsAndConditions(); foreach (tcmapping tcm in TCMList) { str[i] = Convert.ToString(tcm.ReferenceTC); string s = str[i]; i++; } foreach (termsandconditions tcond in TCList) { ListViewItem item1 = new ListViewItem(); for (int j = 0; j < str.Length; j++) { if (str[j].Equals(tcond.ParagraphID.ToString())) { item1.Checked = true; break; } else { item1.Checked = false; } } item1.SubItems.Add(tcond.ParagraphID.ToString()); item1.SubItems.Add(tcond.ParagraphHeading); item1.SubItems.Add(tcond.Details); ListViewTC.Items.Add(item1); } } catch (Exception ex) { MessageBox.Show("Error in Terms and Condition mapping Listing"); } try { enableButtons(); pnlList.Visible = true; if (getuserPrivilegeStatus() == 1) { btnSave.Visible = false; } else { btnSave.Visible = true; } } catch (Exception ex) { } }