Beispiel #1
0
        public IList <AttributeInfo> GetAttributes(AttributeUseageMode attributeUseageMode)
        {
            IList <AttributeInfo> list = new List <AttributeInfo>();
            string    text             = (attributeUseageMode != AttributeUseageMode.Choose) ? "UsageMode <> 2" : "UsageMode = 2";
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand("SELECT * FROM Hishop_Attributes WHERE " + text + " ORDER BY DisplaySequence Desc SELECT * FROM Hishop_AttributeValues WHERE AttributeId IN (SELECT AttributeId FROM Hishop_Attributes Where  " + text + " ) ORDER BY DisplaySequence Desc");

            using (DataSet dataSet = base.database.ExecuteDataSet(sqlStringCommand))
            {
                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    AttributeInfo attributeInfo = new AttributeInfo();
                    attributeInfo.AttributeId       = (int)row["AttributeId"];
                    attributeInfo.AttributeName     = (string)row["AttributeName"];
                    attributeInfo.DisplaySequence   = (int)row["DisplaySequence"];
                    attributeInfo.TypeId            = (int)row["TypeId"];
                    attributeInfo.UsageMode         = (AttributeUseageMode)(int)row["UsageMode"];
                    attributeInfo.UseAttributeImage = (bool)row["UseAttributeImage"];
                    if (dataSet.Tables[1].Rows.Count > 0)
                    {
                        DataRow[] array  = dataSet.Tables[1].Select("AttributeId=" + attributeInfo.AttributeId.ToString());
                        DataRow[] array2 = array;
                        foreach (DataRow dataRow2 in array2)
                        {
                            AttributeValueInfo attributeValueInfo = new AttributeValueInfo();
                            attributeValueInfo.ValueId     = (int)dataRow2["ValueId"];
                            attributeValueInfo.AttributeId = attributeInfo.AttributeId;
                            attributeValueInfo.ValueStr    = (string)dataRow2["ValueStr"];
                            attributeInfo.AttributeValues.Add(attributeValueInfo);
                        }
                    }
                    list.Add(attributeInfo);
                }
            }
            return(list);
        }
Beispiel #2
0
        public IList <AttributeInfo> GetAttributes(int typeId, AttributeUseageMode attributeUseageMode)
        {
            IList <AttributeInfo> list = new List <AttributeInfo>();
            string text;

            if (attributeUseageMode == AttributeUseageMode.Choose)
            {
                text = "UsageMode = 2";
            }
            else
            {
                text = "UsageMode <> 2";
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(string.Concat(new string[]
            {
                "SELECT * FROM Ecshop_Attributes WHERE TypeId = @TypeId AND ",
                text,
                " ORDER BY DisplaySequence Desc SELECT * FROM Ecshop_AttributeValues WHERE AttributeId IN (SELECT AttributeId FROM Ecshop_Attributes WHERE TypeId = @TypeId AND  ",
                text,
                " ) ORDER BY DisplaySequence Desc"
            }));

            this.database.AddInParameter(sqlStringCommand, "TypeId", DbType.Int32, typeId);
            using (DataSet dataSet = this.database.ExecuteDataSet(sqlStringCommand))
            {
                foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                {
                    AttributeInfo attributeInfo = new AttributeInfo();
                    attributeInfo.AttributeId       = (int)dataRow["AttributeId"];
                    attributeInfo.AttributeName     = (string)dataRow["AttributeName"];
                    attributeInfo.DisplaySequence   = (int)dataRow["DisplaySequence"];
                    attributeInfo.TypeId            = (int)dataRow["TypeId"];
                    attributeInfo.UsageMode         = (AttributeUseageMode)((int)dataRow["UsageMode"]);
                    attributeInfo.UseAttributeImage = (bool)dataRow["UseAttributeImage"];
                    if (dataSet.Tables[1].Rows.Count > 0)
                    {
                        DataRow[] array  = dataSet.Tables[1].Select("AttributeId=" + attributeInfo.AttributeId.ToString());
                        DataRow[] array2 = array;
                        for (int i = 0; i < array2.Length; i++)
                        {
                            DataRow            dataRow2           = array2[i];
                            AttributeValueInfo attributeValueInfo = new AttributeValueInfo();
                            attributeValueInfo.ValueId     = (int)dataRow2["ValueId"];
                            attributeValueInfo.AttributeId = attributeInfo.AttributeId;
                            if (dataRow2["ImageUrl"] != DBNull.Value)
                            {
                                attributeValueInfo.ImageUrl = (string)dataRow2["ImageUrl"];
                            }
                            attributeValueInfo.ValueStr = (string)dataRow2["ValueStr"];
                            attributeInfo.AttributeValues.Add(attributeValueInfo);
                        }
                    }
                    list.Add(attributeInfo);
                }
            }
            return(list);
        }
Beispiel #3
0
        public IList <AttributeInfo> GetAttributes(int typeId, AttributeUseageMode attributeUseageMode)
        {
            string str;
            IList <AttributeInfo> list = new List <AttributeInfo>();

            if (attributeUseageMode == AttributeUseageMode.Choose)
            {
                str = "UsageMode = 2";
            }
            else
            {
                str = "UsageMode <> 2";
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_Attributes WHERE TypeId = @TypeId AND " + str + " ORDER BY DisplaySequence Desc SELECT * FROM Hishop_AttributeValues WHERE AttributeId IN (SELECT AttributeId FROM Hishop_Attributes WHERE TypeId = @TypeId AND  " + str + " ) ORDER BY DisplaySequence Desc");

            this.database.AddInParameter(sqlStringCommand, "TypeId", DbType.Int32, typeId);
            using (DataSet set = this.database.ExecuteDataSet(sqlStringCommand))
            {
                foreach (DataRow row in set.Tables[0].Rows)
                {
                    AttributeInfo item = new AttributeInfo {
                        AttributeId       = (int)row["AttributeId"],
                        AttributeName     = (string)row["AttributeName"],
                        DisplaySequence   = (int)row["DisplaySequence"],
                        TypeId            = (int)row["TypeId"],
                        UsageMode         = (AttributeUseageMode)((int)row["UsageMode"]),
                        UseAttributeImage = (bool)row["UseAttributeImage"]
                    };
                    if (set.Tables[1].Rows.Count > 0)
                    {
                        DataRow[] rowArray = set.Tables[1].Select("AttributeId=" + item.AttributeId.ToString());
                        foreach (DataRow row2 in rowArray)
                        {
                            AttributeValueInfo info2 = new AttributeValueInfo {
                                ValueId     = (int)row2["ValueId"],
                                AttributeId = item.AttributeId
                            };
                            if (row2["ImageUrl"] != DBNull.Value)
                            {
                                info2.ImageUrl = (string)row2["ImageUrl"];
                            }
                            info2.ValueStr = (string)row2["ValueStr"];
                            item.AttributeValues.Add(info2);
                        }
                    }
                    list.Add(item);
                }
            }
            return(list);
        }
Beispiel #4
0
 public static IList <AttributeInfo> GetAttributes(int typeId, AttributeUseageMode attributeUseageMode)
 {
     return(new AttributeDao().GetAttributes(typeId, attributeUseageMode));
 }
 public static IList <AttributeInfo> GetAttributes(AttributeUseageMode attributeUseageMode)
 {
     return(new AttributeDao().GetAttributes(attributeUseageMode));
 }
Beispiel #6
0
 public static IList <AttributeInfo> GetAttributes(int typeId, AttributeUseageMode attributeUseageMode)
 {
     return(ProductProvider.Instance().GetAttributes(typeId, attributeUseageMode));
 }
Beispiel #7
0
 public IList<AttributeInfo> GetAttributes(int typeId, AttributeUseageMode attributeUseageMode)
 {
     string str;
     IList<AttributeInfo> list = new List<AttributeInfo>();
     if (attributeUseageMode == AttributeUseageMode.Choose)
     {
         str = "UsageMode = 2";
     }
     else
     {
         str = "UsageMode <> 2";
     }
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_Attributes WHERE TypeId = @TypeId AND " + str + " ORDER BY DisplaySequence Desc SELECT * FROM Hishop_AttributeValues WHERE AttributeId IN (SELECT AttributeId FROM Hishop_Attributes WHERE TypeId = @TypeId AND  " + str + " ) ORDER BY DisplaySequence Desc");
     this.database.AddInParameter(sqlStringCommand, "TypeId", DbType.Int32, typeId);
     using (DataSet set = this.database.ExecuteDataSet(sqlStringCommand))
     {
         foreach (DataRow row in set.Tables[0].Rows)
         {
             AttributeInfo item = new AttributeInfo {
                 AttributeId = (int) row["AttributeId"],
                 AttributeName = (string) row["AttributeName"],
                 DisplaySequence = (int) row["DisplaySequence"],
                 TypeId = (int) row["TypeId"],
                 UsageMode = (AttributeUseageMode) ((int) row["UsageMode"]),
                 UseAttributeImage = (bool) row["UseAttributeImage"]
             };
             if (set.Tables[1].Rows.Count > 0)
             {
                 DataRow[] rowArray = set.Tables[1].Select("AttributeId=" + item.AttributeId.ToString());
                 foreach (DataRow row2 in rowArray)
                 {
                     AttributeValueInfo info2 = new AttributeValueInfo {
                         ValueId = (int) row2["ValueId"],
                         AttributeId = item.AttributeId
                     };
                     if (row2["ImageUrl"] != DBNull.Value)
                     {
                         info2.ImageUrl = (string) row2["ImageUrl"];
                     }
                     info2.ValueStr = (string) row2["ValueStr"];
                     item.AttributeValues.Add(info2);
                 }
             }
             list.Add(item);
         }
     }
     return list;
 }
Beispiel #8
0
 public static IList<AttributeInfo> GetAttributes(int typeId, AttributeUseageMode attributeUseageMode)
 {
     return ProductProvider.Instance().GetAttributes(typeId, attributeUseageMode);
 }
Beispiel #9
0
 public abstract IList <AttributeInfo> GetAttributes(int typeId, AttributeUseageMode attributeUseageMode);
 public static IList<AttributeInfo> GetAttributes(int typeId, AttributeUseageMode attributeUseageMode)
 {
     return new AttributeDao().GetAttributes(typeId, attributeUseageMode);
 }
Beispiel #11
0
 public abstract IList<AttributeInfo> GetAttributes(int typeId, AttributeUseageMode attributeUseageMode);
Beispiel #12
0
 public abstract IList <AttributeInfo> GetAttributes(AttributeUseageMode attributeUseageMode);