/// <summary> /// Update Comments in each language /// </summary> /// <param name="commentsInfo"></param> public int UpdateComments(NotesInfo commentsInfo) { int RetVal = 0; string SqlQuery = string.Empty; DITables TableNames; try { SqlQuery = DevInfo.Lib.DI_LibDAL.Queries.Notes.Update.UpdateNotes(this.DBQueries.TablesName.Notes, commentsInfo.Notes, commentsInfo.Classification_NId.ToString(), commentsInfo.Notes_Approved, commentsInfo.Notes_NId); RetVal = this.DBConnection.ExecuteNonQuery(SqlQuery); } catch (Exception ex) { throw new ApplicationException(ex.Message); } return(RetVal); }
/// <summary> /// Get CommentsInfo for CommentsNId /// </summary> /// <param name="notesNid"></param> /// <returns></returns> public NotesInfo GetNotesByNotesNid(string notesNid) { NotesInfo RetVal = null; DbDataReader DataReader = null; string SqlQuery = string.Empty; try { SqlQuery = this.DBQueries.Notes.GetNotes(String.Empty, notesNid, string.Empty, string.Empty, CheckedStatus.False, FieldSelection.Light); DataReader = (DbDataReader)this.DBConnection.ExecuteReader(SqlQuery); if (DataReader.HasRows) { RetVal = new NotesInfo(); while (DataReader.Read()) { RetVal.Notes_NId = (int)DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.NotesNId]; RetVal.Profile_NId = (int)DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.ProfileNId]; RetVal.Classification_NId = (int)DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.ClassificationNId]; RetVal.Notes = Convert.ToString(DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.Note]); RetVal.Notes_DateTime = Convert.ToString(DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.NotesDateTime]); RetVal.Notes_Approved = (int)DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.NotesApproved]; } } } catch (Exception ex) { throw new ApplicationException(ex.Message); } finally { if (!DataReader.IsClosed) { DataReader.Close(); } } return(RetVal); }
/// <summary> /// Insert Commnets For Each Language /// </summary> /// <param name="commentsInfo">Object of CommentsInfo</param> public void InsertNotes(NotesInfo commentsInfo) { string LanguageCode = string.Empty; string DefaultLanguageCode = string.Empty; string Comments = string.Empty; string SqlQuery = string.Empty; string NotesTableName = string.Empty; try { DefaultLanguageCode = this.DBQueries.LanguageCode; foreach (DataRow languageRow in this.DBConnection.DILanguages(this.DBQueries.DataPrefix).Rows) { LanguageCode = languageRow[Language.LanguageCode].ToString(); if (LanguageCode == DefaultLanguageCode.Replace("_", String.Empty)) { Comments = commentsInfo.Notes; } else { Comments = Constants.PrefixForNewValue + commentsInfo.Notes; } NotesTableName = this.DBQueries.TablesName.Notes.Replace(DefaultLanguageCode, "_" + LanguageCode); SqlQuery = DevInfo.Lib.DI_LibDAL.Queries.Notes.Insert.InsertNotes(NotesTableName, Comments, commentsInfo.Classification_NId.ToString(), commentsInfo.Profile_NId.ToString(), commentsInfo.Notes_DateTime, commentsInfo.Notes_Approved); this.DBConnection.ExecuteNonQuery(SqlQuery); } } catch (Exception ex) { throw new ApplicationException(ex.Message); } }
/// <summary> /// Get CommentsInfo for CommentsNId /// </summary> /// <param name="notesNid"></param> /// <returns></returns> public NotesInfo GetNotesByNotesNid(string notesNid) { NotesInfo RetVal=null; DbDataReader DataReader=null; string SqlQuery = string.Empty; try { SqlQuery = this.DBQueries.Notes.GetNotes(String.Empty, notesNid, string.Empty, string.Empty, CheckedStatus.False, FieldSelection.Light); DataReader = (DbDataReader)this.DBConnection.ExecuteReader(SqlQuery); if (DataReader.HasRows) { RetVal = new NotesInfo(); while (DataReader.Read()) { RetVal.Notes_NId = (int)DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.NotesNId]; RetVal.Profile_NId = (int)DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.ProfileNId]; RetVal.Classification_NId = (int)DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.ClassificationNId]; RetVal.Notes = Convert.ToString(DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.Note]); RetVal.Notes_DateTime = Convert.ToString(DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.NotesDateTime]); RetVal.Notes_Approved = (int)DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes.NotesApproved]; } } } catch (Exception ex) { throw new ApplicationException(ex.Message); } finally { if (!DataReader.IsClosed) DataReader.Close(); } return RetVal; }
/// <summary> /// Update Comments in each language /// </summary> /// <param name="commentsInfo"></param> public int UpdateComments(NotesInfo commentsInfo) { int RetVal=0; string SqlQuery = string.Empty; DITables TableNames; try { SqlQuery = DevInfo.Lib.DI_LibDAL.Queries.Notes.Update.UpdateNotes(this.DBQueries.TablesName.Notes, commentsInfo.Notes, commentsInfo.Classification_NId.ToString(), commentsInfo.Notes_Approved, commentsInfo.Notes_NId); RetVal = this.DBConnection.ExecuteNonQuery(SqlQuery); } catch (Exception ex) { throw new ApplicationException(ex.Message); } return RetVal; }
/// <summary> /// Insert Commnets For Each Language /// </summary> /// <param name="commentsInfo">Object of CommentsInfo</param> public void InsertNotes(NotesInfo commentsInfo) { string LanguageCode=string.Empty; string DefaultLanguageCode=string.Empty; string Comments=string.Empty; string SqlQuery = string.Empty; string NotesTableName=string.Empty; try { DefaultLanguageCode = this.DBQueries.LanguageCode; foreach (DataRow languageRow in this.DBConnection.DILanguages(this.DBQueries.DataPrefix).Rows) { LanguageCode = languageRow[Language.LanguageCode].ToString(); if (LanguageCode == DefaultLanguageCode.Replace("_", String.Empty)) { Comments = commentsInfo.Notes; } else { Comments = Constants.PrefixForNewValue + commentsInfo.Notes; } NotesTableName = this.DBQueries.TablesName.Notes.Replace(DefaultLanguageCode, "_" + LanguageCode); SqlQuery = DevInfo.Lib.DI_LibDAL.Queries.Notes.Insert.InsertNotes(NotesTableName, Comments , commentsInfo.Classification_NId.ToString(), commentsInfo.Profile_NId.ToString(), commentsInfo.Notes_DateTime, commentsInfo.Notes_Approved); this.DBConnection.ExecuteNonQuery(SqlQuery); } } catch (Exception ex) { throw new ApplicationException(ex.Message); } }