public List <doctcmapping> getTCMapping() { doctcmapping doctcmappingrec; List <doctcmapping> DoctcMappings = new List <doctcmapping>(); try { SqlConnection conn = new SqlConnection(Login.connString); string query = "select distinct a.DocumentID,b.DocumentName from TCMapping a,Document b where a.DocumentID=b.DocumentID"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { doctcmappingrec = new doctcmapping(); doctcmappingrec.DocumentID = reader.GetString(0); doctcmappingrec.DocumentName = reader.GetString(1); //doctcmappingrec.ReferenceTC = reader.GetString(2); //doctcmappingrec.RowID = reader.GetInt32(2); //doctcmappingrec.ParagraphID = reader.GetInt32(3); //doctcmappingrec.Heading = reader.IsDBNull(4) ? "" : reader.GetString(4); //doctcmappingrec.Detail = reader.IsDBNull(5) ? "" : reader.GetString(5); DoctcMappings.Add(doctcmappingrec); } conn.Close(); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(DoctcMappings); }
public List <doctcmapping> getdocTCList(string docid) { doctcmapping TcSel; List <doctcmapping> TCList = new List <doctcmapping>(); try { SqlConnection conn = new SqlConnection(Login.connString); string query = "select c.RowID,c.ParagraphID,c.ParagraphHeading,c.Detail from TermsAndCondition c,TCMapping d where " + " c.RowID = d.ReferenceTC and d.DocumentID = '" + docid + "' order by c.ParagraphID asc"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { TcSel = new doctcmapping(); TcSel.RowID = reader.GetInt32(0); TcSel.ParagraphID = reader.GetInt32(1); TcSel.Heading = reader.IsDBNull(2) ? "" : reader.GetString(2); TcSel.Detail = reader.IsDBNull(3) ? "" : reader.GetString(3); TCList.Add(TcSel); } conn.Close(); } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(TCList); }
public Boolean validateDocument(doctcmapping doc) { Boolean status = true; try { if (doc.DocumentID.Trim().Length == 0 || doc.DocumentID == null) { return(false); } //if (doc.RowID == 0) //{ // return false; //} //if (doc.SeniorEmployeeID.Trim().Length == 0 || doc.SeniorEmployeeID == null || // doc.EmployeeID.Trim() == doc.SeniorEmployeeID.Trim()) //{ // return false; //} } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(status); }
public Boolean insertDocTCMapping(doctcmapping doc) { Boolean status = true; string utString = ""; try { DateTime cdt = DateTime.Now; string updateSQL = "insert into TCMapping (DocumentID,ReferenceTC)" + "values (" + "'" + doc.DocumentID + "'," + "'" + doc.RowID + "')"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("insert", "TCMapping", "", updateSQL) + Main.QueryDelimiter; if (!UpdateTable.UT(utString)) { status = false; } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); status = false; } return(status); }
public Boolean updateDocTCMapping(string rowid, doctcmapping prevdoc) { Boolean status = true; string utString = ""; try { string updateSQL = "update TCMapping set ReferenceTC='" + rowid + "'" + " where DocumentID='" + prevdoc.DocumentID + "'"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("update", "TCMapping", "", updateSQL) + Main.QueryDelimiter; if (!UpdateTable.UT(utString)) { status = false; } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); status = false; } return(status); }
public Boolean UpdateTCMapping(List <doctcmapping> TCMList, doctcmapping tc) { Boolean status = true; string utString = ""; try { string updateSQL = "Delete from TCMapping where DocumentID = '" + tc.DocumentID + "'"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("delete", "TCMapping", "", updateSQL) + Main.QueryDelimiter; foreach (doctcmapping tcm in TCMList) { updateSQL = "insert into TCMapping " + "(DocumentID,ReferenceTC) " + "values ('" + tcm.DocumentID + "'," + "'" + tcm.ReferenceTC + "')"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("insert", "TCMapping", "", updateSQL) + Main.QueryDelimiter; } if (!UpdateTable.UT(utString)) { status = false; } } catch (Exception ex) { status = false; } return(status); }
public DataGridView getTclistGrid(string docid) { DataGridView empGgrid = new DataGridView(); try { DataGridViewCheckBoxColumn colChk = new DataGridViewCheckBoxColumn(); colChk.Width = 50; colChk.Name = "Select"; colChk.HeaderText = "Select"; colChk.ReadOnly = false; DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle1.BackColor = System.Drawing.Color.LightSeaGreen; dataGridViewCellStyle1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; empGgrid.EnableHeadersVisualStyles = false; empGgrid.AllowUserToAddRows = false; empGgrid.AllowUserToDeleteRows = false; empGgrid.BackgroundColor = System.Drawing.SystemColors.GradientActiveCaption; empGgrid.BorderStyle = System.Windows.Forms.BorderStyle.None; empGgrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; empGgrid.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; empGgrid.ColumnHeadersHeight = 27; empGgrid.RowHeadersVisible = false; empGgrid.Columns.Add(colChk); DocTcMappingDB DoctcDB = new DocTcMappingDB(); List <doctcmapping> empSElList = DoctcDB.getTCList(docid); doctcmapping obj = new doctcmapping(); var prop = obj.GetType().GetProperties(); foreach (var v in prop) { empGgrid.Columns.Add(v.Name, v.Name); } //empGgrid.DataSource = empSElList; foreach (doctcmapping tcsel in empSElList) { empGgrid.Rows.Add(); empGgrid.Rows[empGgrid.Rows.Count - 1].Cells["RowID"].Value = tcsel.RowID; empGgrid.Rows[empGgrid.Rows.Count - 1].Cells["ParagraphID"].Value = tcsel.ParagraphID; empGgrid.Rows[empGgrid.Rows.Count - 1].Cells["Heading"].Value = tcsel.Heading; empGgrid.Rows[empGgrid.Rows.Count - 1].Cells["Detail"].Value = tcsel.Detail; empGgrid.Rows[empGgrid.Rows.Count - 1].Height = 60; } } catch (Exception ex) { } return(empGgrid); }