public static List <RecipeItem> Create(RecipeCounter counter, RecipeItem item, List <object[]> dataSet) { List <RecipeItem> items = new List <RecipeItem>(); foreach (var row in dataSet) { var recItem = Create(counter, row); recItem.Parent = item; items.Add(recItem); } return(items); }
public static RecipeItem Create(RecipeCounter counter, object[] row) { int i = 0; RecipeItem recipeItem = new RecipeItem(counter); Item item = new Item { Id = row[i++].ConvertTo <int>(), Name = row[i++].ConvertTo <string>(), SellPrice = row[i++].ConvertTo <int>(), BuyPrice = row[i++].ConvertTo <int>(), SellOffers = row[i++].ConvertTo <int>(), BuyOrders = row[i++].ConvertTo <int>(), Timestamp = row[i++].ConvertTo <DateTime>(), RarityId = row[i++].ConvertTo <int>(), RarityName = row[i++].ConvertTo <string>(), CategoryId = row[i++].ConvertTo <int>(), CategoryName = row[i++].ConvertTo <string>(), TypeId = row[i++].ConvertTo <int>(), TypeName = row[i++].ConvertTo <string>() }; if (DBNull.Value == row[i]) { item.RecipeId = 0; } else { item.RecipeId = row[i].ConvertTo <int>(); } i++; recipeItem.Number = row[i++].ConvertTo <int>(); recipeItem.Id = row[i++].ConvertTo <int>(); recipeItem.FactionNumber = row[i++].ConvertTo <int>(); item.FactionNumber = recipeItem.FactionNumber; item.Faction = row[i].ConvertTo <string>(); recipeItem.Item = item; return(recipeItem); }
public static RecipeItem Create(object[] row) { int i = 0; RecipeItem recipeItem = new RecipeItem(); Item item = new Item { Id = Convert.ToInt32(row[i++]), Name = Convert.ToString(row[i++]), SellPrice = Convert.ToInt32(row[i++]), BuyPrice = Convert.ToInt32(row[i++]), SellOffers = Convert.ToInt32(row[i++]), BuyOrders = Convert.ToInt32(row[i++]), Timestamp = Convert.ToDateTime(row[i++]), RarityId = Convert.ToInt32(row[i++]), RarityName = Convert.ToString(row[i++]), CategoryId = Convert.ToInt32(row[i++]), CategoryName = Convert.ToString(row[i++]), TypeId = Convert.ToInt32(row[i++]), TypeName = Convert.ToString(row[i++]) }; if (DBNull.Value == row[i]) { item.RecipeId = 0; } else { item.RecipeId = Convert.ToInt32(row[i]); } i++; recipeItem.Number = Convert.ToInt32(row[i++]); recipeItem.Id = Convert.ToInt32(row[i]); recipeItem.Item = item; return(recipeItem); }