public CategoryBasic(SqlCategory cat) { SqlItem = cat; SqlSingleText st = Procedures.SingleTexts[cat.SqlSingleText]; //SqlColorable c = Procedures.Colorables[cat.SqlColorable]; SqlIconable i = Procedures.Iconables[cat.SqlIconable]; //SqlSingleText SqlSingleTextObject = st; Text = st.Text; //IIconable SqlIconableObject = i; ImageSource = i.ImageSource; Entries = new List <EntryBase>(); foreach (SqlEntryStorage s in Procedures.EntryStorages.Values) { if (s.CategoryId != SqlItem.Id) { continue; } SqlEntry sqle = Procedures.Entries[s.EntryId]; EntryBase entry = GetEntry(sqle); Entries.Add(entry); } }
//Ctor public CategoryBasic(string text, string iconName = null) { //ISingleTextStorage - Data Text = text; //ISingleTextStorage - SQL SqlSingleTextObject = new SqlSingleText() { Text = text }; Procedures.Insert(SqlSingleTextObject); //IIconable ImageSource = iconName; SqlIconableObject = new SqlIconable(); SqlIconableObject.ImageSource = iconName; Procedures.Insert(SqlIconableObject); //IEntryStorage Entries = new List <EntryBase>(); //Set SQLCategory SqlItem = new SqlCategory(); //SqlItem.SqlColorable = SqlColorableObject.Id; SqlItem.SqlSingleText = SqlSingleTextObject.Id; SqlItem.SqlIconable = SqlIconableObject.Id; SqlItem.CategoryType = CategoryType; Procedures.Insert(SqlItem); }
public CategoryBase GetCategory(SqlCategory sqlc) { CategoryBase cat = null; cat = CategoryFactory.GetCategory(sqlc); return(cat); }
public ListBasic(SqlList list) { SqlItem = list; SqlSingleText st = Procedures.SingleTexts[list.SqlSingleText]; SqlIconable i = Procedures.Iconables[list.SqlIconable]; //SqlSingleText SqlSingleTextObject = st; Text = st.Text; //IIconable SqlIconableObject = i; ImageSource = i.ImageSource; //ICategryStorage Categories = new List <CategoryBase>(); foreach (SqlCategoryStorage s in Procedures.CategoryStorages.Values) { if (s.ListId != SqlItem.Id) { continue; } SqlCategory sqlc = Procedures.Categories[s.CategoryId]; CategoryBase cat = GetCategory(sqlc); Categories.Add(cat); } }
public static CategoryBase GetCategory(SqlCategory sqlc) { foreach (KeyValuePair <string, Func <SqlCategory, CategoryBase> > kvp in REGISTER) { if (kvp.Key == sqlc.CategoryType) { return(kvp.Value(sqlc)); } } return(null); }
public static CategoryBasic GetCategoryBasic(SqlCategory sqlc) { return(new CategoryBasic(sqlc)); }