Initial population
This commit is contained in:
95
JRCookbookBusiness/IngredientSkipSearchWord.cs
Normal file
95
JRCookbookBusiness/IngredientSkipSearchWord.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JRCookbookBusiness
|
||||
{
|
||||
public class IngredientSkipSearchWord
|
||||
{
|
||||
public Guid? wordID = null;
|
||||
public String word = String.Empty;
|
||||
|
||||
public IngredientSkipSearchWord()
|
||||
{
|
||||
}
|
||||
|
||||
public IngredientSkipSearchWord(Guid wordID)
|
||||
{
|
||||
PopulateByID(wordID);
|
||||
}
|
||||
|
||||
|
||||
public static IngredientSkipSearchWord GetIngredientSkipSearchWordByID(Guid wordID)
|
||||
{
|
||||
return new IngredientSkipSearchWord(wordID);
|
||||
}
|
||||
|
||||
public static List<IngredientSkipSearchWord> GetAllIngredientSkipSearchWords()
|
||||
{
|
||||
DataSet recordSet;
|
||||
var returnValue = new List<IngredientSkipSearchWord>();
|
||||
|
||||
recordSet = clsDatabaseLayer.GetDatabaseLayer().GetAllIngredientSkipSearchWords();
|
||||
|
||||
if (recordSet.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow ldbrwRow in recordSet.Tables[0].Rows)
|
||||
{
|
||||
var newIngredientSkipSearchWord = new IngredientSkipSearchWord();
|
||||
newIngredientSkipSearchWord.PopulateFromDataRow(ldbrwRow);
|
||||
returnValue.Add(newIngredientSkipSearchWord);
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static IngredientSkipSearchWord GetIngredientSkipSearchWordByDataRow(DataRow row)
|
||||
{
|
||||
var newIngredientSkipSearchWord = new IngredientSkipSearchWord();
|
||||
newIngredientSkipSearchWord.PopulateFromDataRow(row);
|
||||
return newIngredientSkipSearchWord;
|
||||
}
|
||||
|
||||
private void PopulateByID(Guid wordID)
|
||||
{
|
||||
DataSet recordSet;
|
||||
|
||||
recordSet = clsDatabaseLayer.GetDatabaseLayer().GetIngredientSkipSearchWordByID(wordID);
|
||||
|
||||
if (recordSet.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
DataRow ldbrwRow;
|
||||
ldbrwRow = recordSet.Tables[0].Rows[0];
|
||||
|
||||
PopulateFromDataRow(ldbrwRow);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void PopulateFromDataRow(DataRow dataRow)
|
||||
{
|
||||
InitializeAllFields();
|
||||
|
||||
if (dataRow.IsNull("wordID"))
|
||||
wordID = null;
|
||||
else
|
||||
wordID = (Guid)dataRow["wordID"];
|
||||
|
||||
if (dataRow.IsNull("word"))
|
||||
word = null;
|
||||
else
|
||||
word= (String)dataRow["word"];
|
||||
}
|
||||
|
||||
private void InitializeAllFields()
|
||||
{
|
||||
wordID = null;
|
||||
word = String.Empty;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user