Example #1
0
        /// <summary>
        /// Get ClassificationInfo for Classification name
        /// </summary>
        /// <param name="classificationNids"></param>
        /// <returns></returns>
        public NotesClassificationInfo GetNotesClassificationNidBYName(string classificationName)
        {
            NotesClassificationInfo RetVal     = null;
            DbDataReader            DataReader = null;
            string SqlQuery = string.Empty;

            try
            {
                SqlQuery = this.DBQueries.Notes.GetNotesClassificationBYName(classificationName);

                DataReader = (DbDataReader)this.DBConnection.ExecuteReader(SqlQuery);
                if (DataReader.HasRows)
                {
                    RetVal = new NotesClassificationInfo();
                    while (DataReader.Read())
                    {
                        RetVal.Classification_NId  = (int)DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes_Classification.ClassificationNId];
                        RetVal.Classification_Name = Convert.ToString(DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes_Classification.ClassificationName]);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.ExceptionFacade.ThrowException(ex);
            }
            finally
            {
                if (!DataReader.IsClosed)
                {
                    DataReader.Close();
                }
            }
            return(RetVal);
        }
Example #2
0
        /// <summary>
        ///Update Notes Classification
        /// </summary>
        /// <param name="notesClassInfo"></param>
        /// <returns >Count Of Records Updated</returns>
        public int UpdateNotesClassification(NotesClassificationInfo notesClassInfo)
        {
            int    RetVal   = 0;
            string SqlQuery = string.Empty;

            try
            {
                SqlQuery = DevInfo.Lib.DI_LibDAL.Queries.Notes.Update.UpdateNotesClassification(this.DBQueries.TablesName.NotesClassification, notesClassInfo.Classification_NId, notesClassInfo.Classification_Name);

                RetVal = this.DBConnection.ExecuteNonQuery(SqlQuery);
            }
            catch (Exception ex)
            {
                ExceptionHandler.ExceptionFacade.ThrowException(ex);
            }
            return(RetVal);
        }
Example #3
0
        /// <summary>
        /// Insert Notes Classification by NotesClassificationInfo
        /// </summary>
        /// <param name="notesClassInfo">NotesClassificationInfo Object</param>
        /// <returns >Return Inserted Notes Nid</returns>
        public int InsertNotesClassification(NotesClassificationInfo notesClassInfo)
        {
            int      RetVal = 0;
            DITables TableNames;
            string   LanguageCode        = string.Empty;
            string   DefaultLanguageCode = string.Empty;
            string   ClassName           = string.Empty;
            string   SqlQuery            = string.Empty;

            try
            {
                DefaultLanguageCode = this.DBQueries.LanguageCode;
                //-- Insert Classification for Each Language
                foreach (DataRow Row in this.DBConnection.DILanguages(this.DBQueries.DataPrefix).Rows)
                {
                    LanguageCode = Convert.ToString(Row[Language.LanguageCode]);

                    if (LanguageCode == DefaultLanguageCode.Replace("_", String.Empty))
                    {
                        ClassName = notesClassInfo.Classification_Name;
                    }
                    else
                    {
                        ClassName = Constants.PrefixForNewValue + notesClassInfo.Classification_Name;
                    }

                    TableNames = new DITables(this.DBQueries.DataPrefix, "_" + LanguageCode);

                    SqlQuery = DevInfo.Lib.DI_LibDAL.Queries.Notes.Insert.InsertNotesClassification(TableNames.NotesClassification, ClassName);

                    this.DBConnection.ExecuteNonQuery(SqlQuery);
                }

                RetVal = this.DBConnection.GetNewId();
            }
            catch (Exception ex)
            {
                ExceptionHandler.ExceptionFacade.ThrowException(ex);
            }
            return(RetVal);
        }
        /// <summary>
        /// Get ClassificationInfo for ClassificationNids
        /// </summary>
        /// <param name="classificationNids"></param>
        /// <returns></returns>
        public List<NotesClassificationInfo> GetNotesClassification(string classificationNids)
        {
            List<NotesClassificationInfo> RetVal = null;
            NotesClassificationInfo ClassificationInfo;
            DbDataReader DataReader = null;
            string SqlQuery = string.Empty;
            try
            {
                SqlQuery = this.DBQueries.Notes.GetAllNotesClassification(classificationNids);

                DataReader = (DbDataReader)this.DBConnection.ExecuteReader(SqlQuery);
                if (DataReader.HasRows)
                {
                    RetVal = new List<NotesClassificationInfo>();

                    while (DataReader.Read())
                    {
                        ClassificationInfo = new NotesClassificationInfo();
                        ClassificationInfo.Classification_NId = (int)DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes_Classification.ClassificationNId];
                        ClassificationInfo.Classification_Name = Convert.ToString(DataReader[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Notes_Classification.ClassificationName]);

                        RetVal.Add(ClassificationInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.ExceptionFacade.ThrowException(ex);
            }
            finally
            {
                if (!DataReader.IsClosed)
                    DataReader.Close();
            }

            return RetVal;
        }
        /// <summary>
        ///Update Notes Classification 
        /// </summary>
        /// <param name="notesClassInfo"></param>
        /// <returns >Count Of Records Updated</returns>
        public int UpdateNotesClassification(NotesClassificationInfo notesClassInfo)
        {
            int RetVal = 0;
            string SqlQuery = string.Empty;
            try
            {
                SqlQuery = DevInfo.Lib.DI_LibDAL.Queries.Notes.Update.UpdateNotesClassification(this.DBQueries.TablesName.NotesClassification, notesClassInfo.Classification_NId, notesClassInfo.Classification_Name);

                RetVal = this.DBConnection.ExecuteNonQuery(SqlQuery);

            }
            catch (Exception ex)
            {
                ExceptionHandler.ExceptionFacade.ThrowException(ex);
            }
            return RetVal;
        }
        /// <summary>
        /// Insert Notes Classification by NotesClassificationInfo
        /// </summary>
        /// <param name="notesClassInfo">NotesClassificationInfo Object</param>
        /// <returns >Return Inserted Notes Nid</returns>
        public int InsertNotesClassification(NotesClassificationInfo notesClassInfo)
        {
            int RetVal = 0;
            DITables TableNames;
            string LanguageCode = string.Empty;
            string DefaultLanguageCode = string.Empty;
            string ClassName = string.Empty;
            string SqlQuery = string.Empty;
            try
            {
                DefaultLanguageCode = this.DBQueries.LanguageCode;
                //-- Insert Classification for Each Language
                foreach (DataRow Row in this.DBConnection.DILanguages(this.DBQueries.DataPrefix).Rows)
                {
                    LanguageCode = Convert.ToString(Row[Language.LanguageCode]);

                    if (LanguageCode == DefaultLanguageCode.Replace("_", String.Empty))
                    {
                        ClassName = notesClassInfo.Classification_Name;
                    }
                    else
                    {
                        ClassName = Constants.PrefixForNewValue + notesClassInfo.Classification_Name;
                    }

                    TableNames = new DITables(this.DBQueries.DataPrefix, "_" + LanguageCode);

                    SqlQuery = DevInfo.Lib.DI_LibDAL.Queries.Notes.Insert.InsertNotesClassification(TableNames.NotesClassification, ClassName);

                    this.DBConnection.ExecuteNonQuery(SqlQuery);
                }

                RetVal = this.DBConnection.GetNewId();

            }
            catch (Exception ex)
            {
                ExceptionHandler.ExceptionFacade.ThrowException(ex);
            }
            return RetVal;
        }