예제 #1
0
        private static List <ItemFieldValue> LoadListFromReader(IDataReader reader)
        {
            List <ItemFieldValue> valueList = new List <ItemFieldValue>();

            try
            {
                while (reader.Read())
                {
                    ItemFieldValue value = new ItemFieldValue();
                    value.valueGuid   = new Guid(reader["ValueGuid"].ToString());
                    value.siteGuid    = new Guid(reader["SiteGuid"].ToString());
                    value.featureGuid = new Guid(reader["FeatureGuid"].ToString());
                    value.moduleGuid  = new Guid(reader["ModuleGuid"].ToString());
                    value.itemGuid    = new Guid(reader["ItemGuid"].ToString());
                    value.fieldGuid   = new Guid(reader["FieldGuid"].ToString());
                    value.fieldValue  = reader["FieldValue"].ToString();
                    valueList.Add(value);
                }
            }
            finally
            {
                reader.Close();
            }

            return(valueList);
        }
예제 #2
0
        private static List <ItemFieldValue> LoadListFromReader(IDataReader reader, bool getTotalRows = false)
        {
            List <ItemFieldValue> valueList = new List <ItemFieldValue>();

            try
            {
                while (reader.Read())
                {
                    ItemFieldValue value = new ItemFieldValue();
                    value.ValueGuid   = new Guid(reader["ValueGuid"].ToString());
                    value.SiteGuid    = new Guid(reader["SiteGuid"].ToString());
                    value.FeatureGuid = new Guid(reader["FeatureGuid"].ToString());
                    value.ModuleGuid  = new Guid(reader["ModuleGuid"].ToString());
                    value.ItemGuid    = new Guid(reader["ItemGuid"].ToString());
                    value.FieldGuid   = new Guid(reader["FieldGuid"].ToString());
                    value.FieldValue  = reader["FieldValue"].ToString();

                    // Not all methods will use TotalRows but there is no sense in having an extra method to load the reader
                    // so, we'll catch the error and do nothing with it because we are expecting it
                    // the if statement should keep any problems at bay but we still use try/catch in case someone inadvertently
                    // set getTotalRows = true
                    if (getTotalRows)
                    {
                        try
                        {
                            if (reader["TotalRows"] != DBNull.Value)
                            {
                                _totalRows = Convert.ToInt32(reader["TotalRows"]);
                            }
                        }
                        catch (System.IndexOutOfRangeException ex)
                        {
                        }
                    }

                    valueList.Add(value);
                }
            }
            finally
            {
                reader.Close();
            }

            return(valueList);
        }
예제 #3
0
 /// <summary>
 /// Compares 2 instances of value.
 /// </summary>
 public static int CompareByFieldValue(ItemFieldValue value1, ItemFieldValue value2)
 {
     return(value1.FieldValue.CompareTo(value2.FieldValue));
 }