Exemplo n.º 1
0
        public List <Article> getArticles(string theme)
        {
            List <DAL_Library.Type> themes = dbAccess.getTypes();

            DAL_Library.Type sTheme = null;
            foreach (DAL_Library.Type item in themes)
            {
                if (item.Type1 == theme)
                {
                    sTheme = item;
                }
            }

            List <Article> respArticles = new List <Article>();

            if (sTheme != null)
            {
                foreach (Article item in dbAccess.getArticles())
                {
                    if (item.Type.Id == sTheme.Id)
                    {
                        respArticles.Add(item);
                    }
                }
            }

            return(respArticles);
        }
Exemplo n.º 2
0
        public void onTypesListChanged(object sender, ListChangedEventArgs e)
        {
            if (!e.ListChangedType.Equals(ListChangedType.ItemDeleted))
            {
                DAL_Library.Type n = typesList.ElementAt <DAL_Library.Type>(e.NewIndex);

                if (e.ListChangedType.Equals(ListChangedType.ItemAdded))
                {
                    db.addTypes(n);
                }
                else if (e.ListChangedType.Equals(ListChangedType.ItemChanged))
                {
                    db.updTypes(n);
                }
            }
        }
Exemplo n.º 3
0
 public void onTypesDelete(object sender, ListChangedEventArgs e)
 {
     DAL_Library.Type n = typesList.ElementAt <DAL_Library.Type>(e.NewIndex);
     db.delTypes(n);
 }
Exemplo n.º 4
0
 public void setThemeStatus(int themeId, Status status)
 {
     DAL_Library.Type theme = dbAccess.getTypes().Where <DAL_Library.Type>(t => t.Id == themeId).First <DAL_Library.Type>();
     theme.Status = status.Id;
     dbAccess.updTypes(theme);
 }