Exemplo n.º 1
0
 public Consumed(WcfConsumed consumed,WcfLogin login)
 {
     this.ConsumedId = 0;
     this.Favorite = null;
     this.ConsumeTime = consumed.ConsumeTime;
     this.FavoriteId = DietCalendar.GetFavoriteId(DietCalendar.GetLoginId(new Login(login)), consumed.Favorite.FavoriteName);
 }
 public static bool AddFavorite(Favorite favorite)
 {
     lock (dcc)
     {
         if (!FavoriteExist(favorite))
         {
             try
             {
                 dcc.Favorites.Add(favorite);
                 dcc.SaveChanges();
                 return true;
             }
             catch (Exception) { }
         }
         return false; 
     }
 }
 public static bool FavoriteExist(Favorite favorite)
 {
     var query = from favorite1 in dcc.Favorites where favorite1.LoginId == favorite.LoginId & favorite1.FavoriteName == favorite.FavoriteName select favorite.FavoriteId;
     if (query.Count() > 0)
     {
         return true;
     }
     return false;
 }
 private static List<FavoriteComponent> DownloadFavoriteComponents(Favorite favorite)
 {
     return (from component in dcc.FavoriteCompontents where component.FavoriteId == favorite.FavoriteId select component).ToList();
 }
Exemplo n.º 5
0
 public WcfFavorite(Favorite favorite)
 {
     this.FavoriteName = favorite.FavoriteName;
     FavoriteCompontents = new List<WcfFavoriteComponent>();
     foreach (var favcomp in favorite.FavoriteCompontents)
     {
         this.FavoriteCompontents.Add(new WcfFavoriteComponent(favcomp));
     }
 }