//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 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); } }
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 EntryBasic(SqlEntry e) { SqlItem = e; SqlSingleText st = Procedures.SingleTexts[e.SqlSingleText]; //SqlColorable c = Procedures.Colorables[e.SqlColorable]; //SqlSingleText SqlSingleTextObject = st; Text = st.Text; }
public EntryMultyText(SqlEntry e) { SqlItem = e; SqlSingleText st = Procedures.SingleTexts[e.SqlSingleText]; SqlMultyText mt = Procedures.MultyTexts[e.SqlMultyText]; //SqlSingleText SqlSingleTextObject = st; Text = st.Text; //IMultiTextStorage SqlMultyTextObject = mt; Texts = new Dictionary <string, string>(); Texts = JsonConvert.DeserializeObject <Dictionary <string, string> >(mt.TextsJson); }
//Ctor public EntryBasic(string text) { //ISingleTextStorage - Data Text = text; //ISingleTextStorage - SQL SqlSingleTextObject = new SqlSingleText() { Text = text }; Procedures.Insert(SqlSingleTextObject); //Set SQLEntry SqlItem = new SqlEntry(); //SqlItem.SqlColorable = SqlColorableObject.Id; SqlItem.SqlSingleText = SqlSingleTextObject.Id; SqlItem.EntryType = EntryType; Procedures.Insert(SqlItem); }
public EntryMultyText(params string[] texts) { //Input check //We expect input like "key1", "value1", "key2", "value2", ... //So, even number of strings must be provided as params if (texts.Length % 2 > 0) { throw new System.Exception("Input an even number of strings in key-value fashion"); } //IMultyTextStorage - Data Texts = new Dictionary <string, string>(); for (int i = 0; i < texts.Length; i += 2) { Texts.Add(texts[i], texts[i + 1]); } //IMultyTextStorage - SQL SqlMultyTextObject = new SqlMultyText(); SqlMultyTextObject.TextsJson = JsonConvert.SerializeObject(Texts); Procedures.Insert(SqlMultyTextObject); string txt = (texts.Length > 0) ? texts[1] : ""; //ISingleTextStorage - Data Text = txt; //ISingleTextStorage - SQL SqlSingleTextObject = new SqlSingleText() { Text = txt }; Procedures.Insert(SqlSingleTextObject); //Set SQLEntry SqlItem = new SqlEntry(); SqlItem.SqlMultyText = SqlMultyTextObject.Id; SqlItem.SqlSingleText = SqlSingleTextObject.Id; SqlItem.EntryType = EntryType; Procedures.Insert(SqlItem); }