Ejemplo n.º 1
0
        public static CategoryRatingGroup GetQuilifiedGroup(long CRID)
        {
            List <CategoryRatingGroup> groups = GetCollectionForCRID(CRID);
            CategoryRatingGroup        group  = groups.SingleOrDefault(g => g.ScoringRangeGroupTypeID == (int)enumScoringRangeGroupType.Qualified);

            return(group);
        }
Ejemplo n.º 2
0
        public static long Add(CategoryRatingGroup crGroup, int userID)
        {
            long crGroupid = -1;

            try
            {
                DbCommand    commandWrapper = GetDbCommand("spr_AddCategoryRatingGroup");
                SqlParameter returnParam    = new SqlParameter("@CategoryRatingGroupID", SqlDbType.BigInt);
                returnParam.Direction = ParameterDirection.Output;
                // get the new CRID of the record
                commandWrapper.Parameters.Add(returnParam);
                commandWrapper.Parameters.Add(new SqlParameter("@CRID", crGroup.CRID));
                commandWrapper.Parameters.Add(new SqlParameter("@ScoringRangeGroupTypeID", crGroup.ScoringRangeGroupTypeID));
                commandWrapper.Parameters.Add(new SqlParameter(" @ScoringRangeGroupTypeName", crGroup.ScoringRangeGroupTypeName));
                commandWrapper.Parameters.Add(new SqlParameter("@RangeMin", crGroup.RangeMin));
                commandWrapper.Parameters.Add(new SqlParameter("@RangeMax", crGroup.RangeMax));
                commandWrapper.Parameters.Add(new SqlParameter("@RangeMax", crGroup.RangeMax));
                commandWrapper.Parameters.Add(new SqlParameter("@QualifyingStatements", crGroup.QualifyingStatements));
                commandWrapper.Parameters.Add(new SqlParameter("@userID", userID));
                ExecuteNonQuery(commandWrapper);
                crGroupid = (long)returnParam.Value;
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
            return(crGroupid);
        }
Ejemplo n.º 3
0
        private static CategoryRatingGroup loadData(DataTable returnTable)
        {
            CategoryRatingGroup currentcrgroup = new CategoryRatingGroup();

            if (returnTable.Rows.Count > 0)
            {
                DataRow returnRow = returnTable.Rows[0];

                currentcrgroup = FillObjectFromRowData(returnRow);
            }
            return(currentcrgroup);
        }
Ejemplo n.º 4
0
        public static void Delete(CategoryRatingGroup crGroup, int userID)
        {
            DbCommand commandWrapper = GetDbCommand("spr_DeleteCategoryRatingGroup");

            try
            {
                commandWrapper.Parameters.Add(new SqlParameter("@CategoryRatingGroupID", crGroup.CategoryRatingGroupID));
                commandWrapper.Parameters.Add(new SqlParameter("@CRID", crGroup.CRID));
                commandWrapper.Parameters.Add(new SqlParameter("@userID", userID));

                ExecuteNonQuery(commandWrapper);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
Ejemplo n.º 5
0
        public static CategoryRatingGroup GetByID(long CategoryRatingGroupID)
        {
            CategoryRatingGroup item = null;

            try
            {
                DataTable dataTable = ExecuteDataTable("spr_GetCategoryRatingGroupByID", CategoryRatingGroupID);
                item = loadData(dataTable);
            }
            catch (Exception ex)
            {
                item = null;
                ExceptionBase.HandleException(ex);
            }

            return(item);
        }
Ejemplo n.º 6
0
 public static void Update(CategoryRatingGroup crGroup, int userID)
 {
     try
     {
         DbCommand commandWrapper = GetDbCommand("spr_UpdateCategoryRatingGroup");
         commandWrapper.Parameters.Add(new SqlParameter("@CategoryRatingGroupID", crGroup.CategoryRatingGroupID));
         commandWrapper.Parameters.Add(new SqlParameter("@CRID", crGroup.CRID));
         commandWrapper.Parameters.Add(new SqlParameter("@ScoringRangeGroupTypeID", crGroup.ScoringRangeGroupTypeID));
         commandWrapper.Parameters.Add(new SqlParameter("@ScoringRangeGroupTypeName", crGroup.ScoringRangeGroupTypeName));
         commandWrapper.Parameters.Add(new SqlParameter("@RangeMin", crGroup.RangeMin));
         commandWrapper.Parameters.Add(new SqlParameter("@RangeMax", crGroup.RangeMax));
         commandWrapper.Parameters.Add(new SqlParameter("@QualifyingStatements", crGroup.QualifyingStatements));
         commandWrapper.Parameters.Add(new SqlParameter("@userID", userID));
         ExecuteNonQuery(commandWrapper);
     }
     catch (Exception ex)
     {
         HandleException(ex);
     }
 }
Ejemplo n.º 7
0
        private static List <CategoryRatingGroup> GetCollection(DataTable table)
        {
            List <CategoryRatingGroup> list = new List <CategoryRatingGroup>();

            try
            {
                if (table != null)
                {
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        CategoryRatingGroup item = FillObjectFromRowData(table.Rows[i]);
                        list.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }

            return(list);
        }
Ejemplo n.º 8
0
        private static CategoryRatingGroup FillObjectFromRowData(DataRow dataRow)
        {
            CategoryRatingGroup crgroup = new CategoryRatingGroup();

            try
            {
                crgroup.CategoryRatingGroupID = (long)dataRow["CategoryRatingGroupID"];
                crgroup.CRID = (long)dataRow["CRID"];
                crgroup.ScoringRangeGroupTypeID   = (int)dataRow["ScoringRangeGroupTypeID"];
                crgroup.ScoringRangeGroupTypeName = (string)dataRow["ScoringRangeGroupTypeName"];
                crgroup.RangeMin = (int)dataRow["RangeMin"];
                crgroup.RangeMax = (int)dataRow["RangeMax"];
                if (dataRow["QualifyingStatements"] != DBNull.Value)
                {
                    crgroup.QualifyingStatements = (string)dataRow["QualifyingStatements"];
                }
            }
            catch (Exception ex)
            {
                crgroup = null;
                ExceptionBase.HandleException(ex);
            }
            return(crgroup);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Determines whether the specified System.Object is equal to the current object.
        /// </summary>
        /// <param name="obj">The System.Object to compare with the current object.</param>
        /// <returns>Returns true if the specified System.Object is equal to the current object; otherwise, false.</returns>
        public override bool Equals(Object obj)
        {
            CategoryRatingGroup CategoryRatingGroupobj = obj as CategoryRatingGroup;

            return((CategoryRatingGroupobj == null) ? false : (this.CategoryRatingGroupID == CategoryRatingGroupobj.CategoryRatingGroupID));
        }