Пример #1
0
        //根据sql查询收藏信息
        IList<Favorites>GetFavoritesBySql(string sql)
        {
            SqlDataReader reader = DBHelper.ExecuteReader(sql);
            IList<Favorites> Favorites = new List<Favorites>();
            try
            {
                while (reader.Read())
                {
                    Favorites f = new Favorites();
                    f.favoriteId = Convert.ToInt32(reader["favoriteId"]);
                    f.weiboId = Convert.ToInt32(reader["weiboId"]);
                    f.favPersonId = Convert.ToInt32(reader["favPersonId"]);
                    Favorites.Add(f);
                }

            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return Favorites;
        }
Пример #2
0
 internal Factory(Groups groups, Favorites favorites, StoredCredentials credentials,
     PersistenceSecurity persistenceSecurity, DataDispatcher dispatcher)
 {
     this.groups = groups;
     this.favorites = favorites;
     this.credentials = credentials;
     this.persistenceSecurity = persistenceSecurity;
     this.dispatcher = dispatcher;
 }
 public BorderlessGaming(MainWindow window)
 {
     this.window = window;
     _favorites = new Favorites(Path.Combine(DataPath, FavoritesFile));
     _hiddenProcesses = new HiddenProcesses(Path.Combine(DataPath, HiddenFile));
     _processDetails = new ProcessDetailsList();
     windows = new Windows();
     AutoHandleFavorites = true;
 }
Пример #4
0
 public string GetDateWith(Favorites fav)
 {
     return string.Format("now={0}\r\nfavFruit={1}\r\nfavNumber={2}\r\nisMale={3}",
                   DateTime.Now,
                   fav.favFruit,
                   fav.favNumber,
                   fav.isMale
     );
 }
Пример #5
0
        public MenuResult CreateMenu(AuthIdentity identity, Menu menu, params Guid[] recipeIds)
        {
            using (var session = GetSession())
            {
                menu.Title = menu.Title.Trim();
                var ret = new MenuResult();

                using (var transaction = session.BeginTransaction())
                {
                    Models.Menus dbMenu;
                    var          dupes = session.QueryOver <Models.Menus>()
                                         .Where(p => p.UserId == identity.UserId)
                                         .Where(p => p.Title == menu.Title)
                                         .ToRowCountQuery()
                                         .RowCount();

                    if (dupes > 0)
                    {
                        throw new MenuAlreadyExistsException();
                    }

                    session.Save(dbMenu = new Models.Menus
                    {
                        UserId      = identity.UserId,
                        Title       = menu.Title,
                        CreatedDate = DateTime.Now,
                    });

                    foreach (var rid in recipeIds.NeverNull())
                    {
                        var fav = new Favorites
                        {
                            UserId = identity.UserId,
                            Recipe = new Models.Recipes()
                            {
                                RecipeId = rid
                            },
                            Menu = dbMenu
                        };

                        session.Save(fav);
                    }

                    transaction.Commit();

                    ret.MenuCreated = true;
                    ret.NewMenuId   = dbMenu.MenuId;
                }

                return(ret);
            }
        }
Пример #6
0
        public async void Initialize()
        {
            this.AuthorizedEmployee = SessionService.Instance.AuthorizedEmployee;

            Favorite favorite = new Favorite();

            this.Favorites = await favorite.GetFavoritesAsync();

            this.Date      = new Card();
            this.Date.Date = this.Date.Date.Date;
            this.Favorite  = new Favorite();

            Card card = new Card();

            this.AllCards = await card.GetCardsAsync();

            this.AllCards = AllCards.OrderBy(ac => ac.Date).ToList();

            var FavoriteCheckCards = new List <Card>();


            for (var i = 0; i < AllCards.Count; i++)
            {
                card = AllCards.ElementAt(i);
                //card.Id == Favorites.CardId && this.AuthorizedEmployee.Id == Favorites.EmployeeId
                if (Favorites.Any(f => f.CardId == card.Id && f.EmployeeId == this.AuthorizedEmployee.Id))
                {
                    //List<int> intList = new List<int>;

                    card          = AllCards.ElementAt(i);
                    card.Favorite = true;

                    FavoriteCheckCards.Add(card);

                    //this.AllCards.RemoveAt(i);
                    //this.Cards.Insert(i, card);
                    //this.Cards.Insert(i, new Card() { Id = card.Id, CD = card.CD, Text = card.Text, Date = card.Date, FromId = card.FromId, ToId = card.ToId, Title = card.Title, Reply = card.Reply, Favorite = card.Favorite, PickUp = card.PickUp });
                    //this.Cards.Add(card);
                    //this.AllCards.Insert(i, new Card() { Id = card.Id, CD = card.CD, Text = card.Text, Date = card.Date, FromId = card.FromId, ToId = card.ToId, Title = card.Title, Reply = card.Reply, Favorite = card.Favorite, PickUp = card.PickUp });
                    //this.Cards.Add(new Card() { Id = card.Id, CD = card.CD, Text = card.Text, Date = card.Date, FromId = card.FromId, ToId = card.ToId, Title=card.Title, Reply=card.Reply, Favorite=card.Favorite, PickUp=card.PickUp});
                }
                else
                {
                    FavoriteCheckCards.Add(card);
                }
            }


            this.Cards = FavoriteCheckCards;
            this.Cards = Cards.OrderBy(ac => ac.Date).ToList();
            //this.AuthorizedEmployee = SessionService.Instance.AuthorizedEmployee;
        }
Пример #7
0
        /// <summary>
        /// 收藏夹商品列表
        /// </summary>
        public ActionResult AjaxFavoriteProductList()
        {
            int page = WebHelper.GetQueryInt("page");//当前页数

            PageModel pageModel = new PageModel(5, page, Favorites.GetFavoriteProductCount(WorkContext.Uid));
            AjaxFavoriteProductListModel model = new AjaxFavoriteProductListModel()
            {
                ProductList = CommonHelper.DataTableToList(Favorites.GetFavoriteProductList(pageModel.PageSize, pageModel.PageNumber, WorkContext.Uid)),
                PageModel   = pageModel
            };

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Пример #8
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc      = new HXSCEntities();
            Favorites    Favorites = hxsc.Favorites.FirstOrDefault(o => o.FavoritesId == faboritesid);

            if (Favorites == null)
            {
                SetError("此收藏不存在");
            }
            Favorites.State = 0;
            hxsc.SaveChanges();
            return(true);
        }
Пример #9
0
 public static void LoadFavorites()
 {
     if (File.Exists(favoritesPath))
     {
         string text = System.IO.File.ReadAllText(favoritesPath);
         favorites = JSON.Load(text).Make <Favorites>();
     }
     else
     {
         favorites         = new Favorites();
         favorites.songIDs = new List <string>();
     }
 }
Пример #10
0
        public UserBaseLinqToSQLComponent(string connectionString, int currentDDBVersion, bool forbidMigration = false)
        {
            context      = new DyanamicDBContext(connectionString, currentDDBVersion, forbidMigration);
            Favorites    = new Favorites(context);
            History      = new History(context);
            TileRegister = new TileRegister(context);

            //Data Source=isostore:ddb.sdf
            var    connectionFields = connectionString.Split(';').ToDictionary(x => x.Split('=').First(), x => x.Split('=').Last());
            string dataSource       = connectionFields["Data Source"];

            FileName = dataSource.Replace("isostore:", "");
        }
Пример #11
0
 public IList <Favorites> AddToIlist(IList <Favorites> list, TbkUatmFavoritesGetResponse rsp)
 {
     for (int row = 0; row < rsp.Results.Count; row++)
     {
         Favorites favorites = new Favorites();
         favorites.FavoritesId    = rsp.Results[row].FavoritesId;
         favorites.FavoritesTitle = rsp.Results[row].FavoritesTitle;
         favorites.Type           = rsp.Results[row].Type;
         favorites.TotalResults   = rsp.TotalResults;
         list.Add(favorites);
     }
     return(list);
 }
Пример #12
0
        /// <summary>
        /// 收藏夹商品列表
        /// </summary>
        public ActionResult AjaxFavoriteProductList()
        {
            int page = WebHelper.GetQueryInt("page");//当前页数

            PageModel pageModel = new PageModel(5, page, Favorites.GetFavoriteProductCount(WorkContext.Uid));
            AjaxFavoriteProductListModel model = new AjaxFavoriteProductListModel()
            {
                ProductList = CommonHelper.DataTableToList(Favorites.GetFavoriteProductList(pageModel.PageSize, pageModel.PageNumber, WorkContext.Uid)),
                PageModel   = pageModel
            };

            return(Content(JsonConvert.SerializeObject(model)));
        }
Пример #13
0
        public async Task AddItemAsync()
        {
            var newItem = new Favorite()
            {
                HostName   = this.HostName,
                PortNumber = this.PortNumber
            };

            Favorites.Add(newItem);

            var  repo   = new FavoritesRepository();
            bool saveOk = await repo.SaveAsync(Favorites.ToList());
        }
Пример #14
0
        public ActionResult Create([Bind(Include = "favoriteID,favoriteID,ID,DateCreated,enabled")] Favorites favorites)
        {
            if (ModelState.IsValid)
            {
                db.Favorites.Add(favorites);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.favoriteID = new SelectList(db.Member, "ID", "FirstName1", favorites.ID);
            ViewBag.ID         = new SelectList(db.Member, "ID", "FirstName1", favorites.ID);
            return(View(favorites));
        }
Пример #15
0
        protected override void Context()
        {
            _eventPublisher     = A.Fake <IEventPublisher>();
            _favoriteRepository = A.Fake <IFavoriteRepository>();
            _entityPathResolver = A.Fake <IEntityPathResolver>();
            _serializationTask  = A.Fake <ISerializationTask>();
            _dialogCreator      = A.Fake <IDialogCreator>();

            sut = new FavoriteTask(_favoriteRepository, _entityPathResolver, _eventPublisher, _dialogCreator, _serializationTask);

            _favorites = new Favorites();
            A.CallTo(() => _favoriteRepository.Favorites).Returns(_favorites);
        }
Пример #16
0
        public void RemoveFavorite(Game game)
        {
            lock (Favorites) {
                var favorite = Favorites.FirstOrDefault(f => f.Matches(game));
                if (favorite == null)
                {
                    return;
                }
                Favorites.Remove(favorite);
            }

            SaveSettings();
        }
        private void deleteFavorite(object sender, TappedRoutedEventArgs e)
        {
            MenuFlyoutItem fly         = sender as MenuFlyoutItem;
            Favorites      favSelected = fly.DataContext as Favorites;

            int contactid = favSelected.Id;

            if (favSelected != null)
            {
                favoritesListViewModel.DeleteContact(contactid);
                this.LV1.ItemsSource = favoritesListViewModel.bindingFavListItems;
            }
        }
Пример #18
0
        public FavoritesViewModel(INetworkService networkService, IMessenger messengerService,
                                  IFavoritesService favoritesService, ITileService tileService, IDialogService dialogService)
        {
            _networkService   = networkService;
            _messengerService = messengerService;
            _favoritesService = favoritesService;
            _settingsService  = SimpleIoc.Default.GetInstance <SettingsService>();
            _tileService      = tileService;
            _dialogService    = dialogService;

            Favorites.Add(GroupedFavoritePlaces);
            Favorites.Add(GroupedFavoriteRoutes);
        }
Пример #19
0
        public async Task <IActionResult> AddToFavorites(string id)
        {
            var request = await _discovery.Events.GetEventDetailsAsync(new GetRequest(id));

            Favorites newFavorite = new Favorites()
            {
                EventId   = id, EventName = request.Name,
                StartDate = request.Dates.Start.DateTime, Venue = request._embedded.Venues[0].Name
            };

            _context.Favorites.Add(newFavorite);
            _context.SaveChanges();
            return(View(request));
        }
Пример #20
0
        /// <summary>
        /// 删除收藏夹中的商品
        /// </summary>
        public ActionResult DelFavoriteProduct()
        {
            int  pid    = WebHelper.GetQueryInt("pid");//商品id
            bool result = Favorites.DeleteFavoriteProductByUidAndPid(WorkContext.Uid, pid);

            if (result)//删除成功
            {
                return(AjaxResult("success", pid.ToString()));
            }
            else//删除失败
            {
                return(AjaxResult("error", "删除失败"));
            }
        }
Пример #21
0
        public static bool DeleteFavoris(Favorites favorites)
        {
            using (var connection = DataBase.GetConnection())
            {
                connection.Open();
                SqlCommand command = connection.CreateCommand();
                command.CommandText = REQ_DELETE_FAVORIS;

                command.Parameters.AddWithValue($"@{FIELD_IDUSER}", favorites.IdUser);
                command.Parameters.AddWithValue($"@{FIELD_IDPLACE}", favorites.IdPlace);

                return(command.ExecuteNonQuery() == 1);
            }
        }
Пример #22
0
 public string ToLine()
 {
     return(string.Join("\t",
                        Filename,
                        Url,
                        ID.ToString(),
                        Title,
                        Description,
                        Author,
                        Featured.ToString(),
                        Uses.ToString(),
                        Favorites.ToString(),
                        Code.ToString()));
 }
Пример #23
0
        public IActionResult AddComment(string id, string comment)
        {
            string    uid   = User.FindFirstValue(ClaimTypes.NameIdentifier);
            Favorites found = _context.Favorites.FirstOrDefault(x => (x.ApiId == id) && (x.UserId == uid));

            found.CommentSection = comment;
            FavoritesListVM favoritesListVM = new FavoritesListVM();

            favoritesListVM.ListOfFavoriteStartUps.Add(found);
            _context.Entry(found).State = EntityState.Modified;
            _context.Update(found);
            _context.SaveChanges();
            return(RedirectToAction("Favorites", favoritesListVM));
        }
Пример #24
0
        public IActionResult Favorite(int starreview, string comment, int roomid, string checkin, string checkout)
        {
            var entry = new Favorites
            {
                Status = 1,
                RoomId = roomid,
                UserId = 1
            };

            _context.Favorites.Add(entry);
            _context.SaveChanges();

            return(RedirectToAction("Room", "Home", new { checkin = checkin, checkout = checkout, roomid }));
        }
Пример #25
0
        public string RemoveFromFavorites(string id)
        {
            Favorites favorite = _context.Favorites.FirstOrDefault(c => c.ContractId.ToString() == id);

            _context.Favorites.Remove(favorite);

            _context.SaveChanges();

            return(JsonConvert.SerializeObject(true,
                                               new JsonSerializerSettings()
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            }));
        }
Пример #26
0
        public void AddToFavorites(Favorites myFave) //IN PROGRESS
        {
            string           query = "SELECT * FROM Favorites";
            List <Favorites> list  = conn.Query <Favorites>(query).ToList();

            foreach (Favorites item in list)
            {
                if (item.qID == myFave.qID && item.userID == myFave.userID)
                {
                    return;
                }
            }
            conn.Insert <Favorites>(myFave);
        }
Пример #27
0
 public string Delete(string userId, string hotelId)
 {
     try
     {
         Favorites favorite = dbContext.Favorites.FirstOrDefault(favorite => favorite.UserId.Equals(userId) && favorite.HotelId.Equals(hotelId));
         dbContext.Favorites.Remove(favorite);
         dbContext.SaveChangesAsync();
         return(JsonConvert.SerializeObject("Favorite hotel deleted"));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(ex.InnerException.Message));
     }
 }
        public static void testGetAllFavorites()
        {
            FavoritesDaoCollectionImpl favoritesDao = new FavoritesDaoCollectionImpl();
            Favorites    favorites = favoritesDao.getAllFavorites(1);
            List <Movie> movieList = favorites.MovieList;

            Console.WriteLine("{0,-20}{1,-15}{2}", "Title", "Active", "Budget");
            for (int i = 0; i < movieList.Count; i++)
            {
                Console.WriteLine("{0,-20}{1,-15}{2}",
                                  movieList[i].Title, movieList[i].Active == true ? "Yes" : "No", movieList[i].Budget);
            }
            Console.WriteLine("\n{0,-20}{1,-8}Total : {2}", "", "", favorites.Total);
        }
Пример #29
0
        public void AddToFavorites(Favorites myFave)
        {
            string           query = "SELECT * FROM Favorites";
            List <Favorites> list  = conn.Query <Favorites>(query).ToList();

            foreach (Favorites item in list)
            {
                if (item.id == myFave.id && item.userid == myFave.userid)
                {
                    return;
                }
            }
            conn.Insert <Favorites>(myFave);
        }
Пример #30
0
        public FavoriteServer UpdateFavorite(Server server)
        {
            FavoriteServer fav;

            lock (Favorites)
                fav = Favorites.FirstOrDefault(f => f.Matches(server));
            if (fav != null)
            {
                fav.Update(server);
                return(fav);
            }

            return(null);
        }
Пример #31
0
        public ActionResult Add(int favoriteMemberID)
        {
            Favorites f = new Favorites();

            f.FavoriteMemberID = favoriteMemberID;
            f.DateCreated      = DateTime.Now;
            f.MemberID         = (int)config.LoggedInMember.ID;
            f.Enabled          = true;

            db.Favorites.Add(f);
            db.SaveChanges();

            return(RedirectToAction("Details", "Members", new { id = (long)favoriteMemberID }));
        }
Пример #32
0
        // GET: Favorites/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Favorites favorites = db.Favorites.Find(id);

            if (favorites == null)
            {
                return(HttpNotFound());
            }
            return(View(favorites));
        }
Пример #33
0
        private void addResult(Result result)
        {
            bool founded = false;

            lock (Results.Locker)
            {
                int index = Results.IndexOf(result);
                if (index >= 0)
                {
                    founded         = true;
                    result.Selected = Results[index].Selected;
                    Results[index]  = result;
                }
            }
            lock (Favorites.Locker)
            {
                int index = Favorites.IndexOf(result);
                if (index >= 0)
                {
                    founded          = true;
                    result.Selected  = Favorites[index].Selected;
                    Favorites[index] = result;
                }
            }
            lock (Favorites2.Locker)
            {
                int index = Favorites2.IndexOf(result);
                if (index >= 0)
                {
                    founded           = true;
                    result.Selected   = Favorites2[index].Selected;
                    Favorites2[index] = result;
                }
            }
            lock (BlockedResults.Locker)
            {
                int index = BlockedResults.IndexOf(result);
                if (index >= 0)
                {
                    founded               = true;
                    result.Selected       = BlockedResults[index].Selected;
                    BlockedResults[index] = result;
                }
            }
            if (!founded)
            {
                Results.Add(result);
            }
        }
Пример #34
0
        /// <summary>
        /// Alle Tonspuren laden.
        /// </summary>
        protected void LoadAudio()
        {
            // Load the names
            var audioNames = Accessor.GetAudioNames();

            // See if something changed
            var changed = (audioNames.Length != m_AudioMap.Count);

            // Check in detail
            if (!changed)
            {
                foreach (var item in m_AudioMap)
                {
                    if (StringComparer.InvariantCultureIgnoreCase.Equals(item.Key, audioNames[item.Value]))
                    {
                        // Something changed
                        changed = true;

                        // No need to check any more
                        break;
                    }
                }
            }

            // Must reload
            if (changed)
            {
                // Reset map
                m_AudioMap.Clear();

                // Process all names
                foreach (var audioName in audioNames)
                {
                    m_AudioMap[audioName] = m_AudioMap.Count;
                }
            }

            // Reset lists
            Favorites.ClearAudioAndService();

            // Process all names
            foreach (var audioName in audioNames)
            {
                Favorites.AddAudio(audioName, false);
            }

            // Finished
            Favorites.FillAudioList();
        }
Пример #35
0
 public PocketRetrieveItem(string ConsumerKey, string AccessToken, States State = States.Unread, Favorites Favorite = Favorites.Both, string Tag = null, ContentTypes ContentType = ContentTypes.All, Sorts Sort = Sorts.NoSort, DetailTypes DetailType = DetailTypes.NoType, string Search = null, string Domain = null, string Since = null, int Count = -1, int Offset = -1)
 {
     _consumerKey = ConsumerKey;
     _accessToken = AccessToken;
     _state = State;
     _favorite = Favorite;
     _tag = Tag;
     _contentType = ContentType;
     _sort = Sort;
     _detailType = DetailType;
     _search = Search;
     _domain = Domain;
     _since = Since;
     _count = Count;
     _offset = Offset;
 }
Пример #36
0
 public void AddUserFavorite(string userCode, string type, string pageName, string pageUrl, string pageImage, bool hasPermission)
 {
     if (TheFavoritesMgr.CheckFavoritesUniqueExist(userCode, type, pageName))
     {
         TheFavoritesMgr.DeleteFavorites(userCode, type, pageName);
     }
     if (hasPermission)
     {
         Favorites fav = new Favorites();
         fav.User = TheUserMgr.LoadUser(userCode);
         fav.Type = type;
         fav.PageName = pageName;
         fav.PageUrl = pageUrl;
         fav.PageImage = pageImage;
         TheFavoritesMgr.CreateFavorites(fav);
     }
 }
 public void AddUserFavorite(string userCode, string type, string pageName, bool hasPermission)
 {
     try
     {
         if (TheFavoritesMgr.CheckFavoritesUniqueExist(userCode, type, pageName))
         {
             TheFavoritesMgr.DeleteFavorites(userCode, type, pageName);
         }
         if (hasPermission)
         {
             Favorites fav = new Favorites();
             fav.User = TheUserMgr.LoadUser(userCode);
             fav.Type = type;
             fav.PageName = pageName;
             fav.PageUrl = DateTime.Now.ToString();
             TheFavoritesMgr.CreateFavorites(fav);
         }
     }
     catch (Exception) { }
 }
Пример #38
0
 public ModelConstants(IniFile.Section iniSection)
 {
     this.series = iniSection.Name.Substring(iniSection.Name.Length - 1);
       this.avbtChannelLength = iniSection.GetInt("map-AirA");
       this.dvbtChannelLength = iniSection.GetInt("map-AirD");
       this.dvbsChannelLength = iniSection.GetInt("map-SateD");
       this.hdplusChannelLength = iniSection.GetInt("map-AstraHDPlusD");
       this.cyfraPlusChannelSize = iniSection.GetInt("map-CyfraPlusD");
       this.ptcLength = iniSection.GetInt("PTC");
       this.dvbsSatelliteLength = iniSection.GetInt("SatDataBase.dat");
       this.dvbsTransponderLength = iniSection.GetInt("TransponderDataBase.dat");
       this.avbtFineTuneLength = iniSection.GetInt("FineTune");
       this.dvbtFineTuneLength = iniSection.GetInt("FineTune_Digital");
       this.serviceProviderLength = iniSection.GetInt("ServiceProvider", 108);
       int numFavorites = iniSection.GetInt("Favorites");
       int mask = 0;
       for (int i = 0; i < numFavorites; i++)
     mask = (mask << 1) | 1;
       this.supportedFavorites = (Favorites)mask;
       this.SortedFavorites = (FavoritesIndexMode)iniSection.GetInt("SortedFavorites");
 }
Пример #39
0
 public virtual void DeleteFavorites(Favorites entity)
 {
     entityDao.DeleteFavorites(entity);
 }
Пример #40
0
 public virtual void CreateFavorites(Favorites entity)
 {
     entityDao.CreateFavorites(entity);
 }
Пример #41
0
        public MenuResult CreateMenu(AuthIdentity identity, Menu menu, params Guid[] recipeIds)
        {
            using (var session = this.GetSession())
            {
                menu.Title = menu.Title.Trim();
                var ret = new MenuResult();

                using (var transaction = session.BeginTransaction())
                {
                    Menus menus;
                    var dupes = session
                        .QueryOver<Menus>()
                        .Where(p => p.UserId == identity.UserId)
                        .Where(p => p.Title == menu.Title)
                        .ToRowCountQuery()
                        .RowCount();

                    if (dupes > 0)
                    {
                        throw new MenuAlreadyExistsException();
                    }

                    session.Save(menus = new Menus
                    {
                        UserId = identity.UserId,
                        Title = menu.Title,
                        CreatedDate = DateTime.Now,
                    });

                    foreach (var rid in recipeIds.NeverNull())
                    {
                        var fav = new Favorites
                        {
                            UserId = identity.UserId,
                            Recipe = new Models.Recipes() { RecipeId = rid },
                            Menu = menus
                        };

                        session.Save(fav);
                    }

                    transaction.Commit();

                    ret.MenuCreated = true;
                    ret.NewMenuId = menus.MenuId;
                }

                return ret;
            }
        }
 internal FavoritesBatchActions(Favorites favorites, EntitiesCache<DbFavorite> cache, DataDispatcher dispatcher)
 {
     this.favorites = favorites;
     this.cache = cache;
     this.dispatcher = dispatcher;
 }
 internal ConnectionHistory(Favorites favorites, DataDispatcher dispatcher)
 {
     this.favorites = favorites;
     this.dispatcher = dispatcher;
 }
Пример #44
0
 public Favorites.Create.Result[] Create(Favorites.Create.Command command)
 {
     return _ApiEndpoints._Client.GetResult<Favorites.Create.Command, Favorites.Create.Result[]>(command);
 }
Пример #45
0
 //插入 收藏记录
 public bool save(Favorites f)
 {
     string sql = "insert into t_Favorites(weiboId,favPersonId,createTime) values(" + f.weiboId + "," + f.favPersonId + ",'" + f.createTime+ "')";
     int flag = DBHelper.ExecuteSQL(sql);
     if (flag == 1)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
 /// <summary>
 ///     remove the menu, resize the window, remove border, and maximize
 /// </summary>
 public void RemoveBorder(ProcessDetails pd, Favorites.Favorite favDetails = null)
 {
     Manipulation.MakeWindowBorderless(pd, window, pd.WindowHandle, new Rectangle(), favDetails ?? _favorites.FromProcessDetails(pd));
 }
Пример #47
0
        public MenuResult UpdateMenu(
            AuthIdentity identity,
            Guid? menuId,
            Guid[] recipesAdd,
            Guid[] recipesRemove,
            MenuMove[] recipesMove,
            bool clear,
            string newName = null)
        {
            var menuResult = new MenuResult();
            menuResult.MenuUpdated = true; // TODO: Verify actual changes were made before setting MenuUpdated to true

            using (var session = this.GetSession())
            {
                using (var transaction = session.BeginTransaction())
                {
                    Menus dbMenu = null;
                    IList<Favorites> dbRecipes;
                    if (menuId.HasValue)
                    {
                        dbMenu = session
                            .QueryOver<Menus>()
                            .Fetch(prop => prop.Recipes).Eager
                            .Where(p => p.MenuId == menuId)
                            .SingleOrDefault();

                        if (dbMenu == null)
                        {
                            throw new MenuNotFoundException();
                        }

                        if (dbMenu.UserId != identity.UserId)
                        {
                            throw new UserDoesNotOwnMenuException();
                        }

                        if (!string.IsNullOrWhiteSpace(newName))
                        {
                            dbMenu.Title = newName.Trim();
                        }

                        dbRecipes = dbMenu.Recipes;
                    }
                    else
                    {
                        dbRecipes = session
                            .QueryOver<Favorites>()
                            .Where(p => p.UserId == identity.UserId)
                            .Where(p => p.Menu == null)
                            .List();
                    }

                    if (recipesAdd.Any())
                    {
                        var existing = from r in dbRecipes
                                       select r.Recipe.RecipeId;
                        recipesAdd = recipesAdd.Except(existing).ToArray();

                        foreach (var rid in recipesAdd)
                        {
                            var fav = new Favorites
                            {
                                UserId = identity.UserId,
                                Recipe = new Recipes { RecipeId = rid },
                                Menu = dbMenu
                            };

                            session.Save(fav);
                        }
                    }

                    if (recipesRemove.Any())
                    {
                        var toDelete = from r in dbRecipes
                                       where recipesRemove.Contains(r.Recipe.RecipeId)
                                       select r;
                        toDelete.ForEach(session.Delete);
                    }

                    if (clear)
                    {
                        dbRecipes.ForEach(session.Delete);
                    }

                    if (recipesMove.Any())
                    {
                        foreach (var moveAction in recipesMove)
                        {
                            Menus dbTarget = null;
                            if (moveAction.TargetMenu.HasValue)
                            {
                                dbTarget = session
                                    .QueryOver<Menus>()
                                    .Where(p => p.MenuId == moveAction.TargetMenu.Value)
                                    .Where(p => p.UserId == identity.UserId)
                                    .SingleOrDefault();

                                if (dbTarget == null)
                                {
                                    throw new MenuNotFoundException(moveAction.TargetMenu.Value);
                                }
                            }

                            var rToMove = moveAction.MoveAll
                               ? dbRecipes
                               : dbRecipes.Where(r => moveAction.RecipesToMove.Contains(r.Recipe.RecipeId));

                            rToMove.ForEach(a => a.Menu = dbTarget);
                        }
                    }

                    transaction.Commit();
                }
            }

            return menuResult;
        }
Пример #48
0
 public Favorites.List.Result[] List(Favorites.List.Command command)
 {
     return _ApiEndpoints._Client.GetResult<Favorites.List.Command, Favorites.List.Result[]>(command);
 }
 public virtual void UpdateFavorites(Favorites entity)
 {
     Update(entity);
 }
Пример #50
0
        /// <summary>
        ///     remove the menu, resize the window, remove border, and maximize
        /// </summary>
        public void RemoveBorder_ToSpecificScreen(IntPtr hWnd, Screen screen, Favorites.Favorite favDetails = null, Boolean overrideTimeout = false)
        {
            if (favDetails != null && favDetails.DelayBorderless == true && overrideTimeout == false)
            {
                //Wait 10 seconds before removing the border.
                Task task = new Task(() => RemoveBorder_ToSpecificScreen(hWnd, screen, favDetails, true));
                task.Wait(TimeSpan.FromSeconds(10));
            }

            var pd = _processDetails.FromHandle(hWnd);
            Manipulation.MakeWindowBorderless(pd, window, hWnd, screen.Bounds, favDetails ?? _favorites.FromProcessDetails(pd));
        }
Пример #51
0
 public virtual void UpdateFavorites(Favorites entity)
 {
     entityDao.UpdateFavorites(entity);
 }
Пример #52
0
        private void UpdateFavoritesEditor(Favorites favorites)
        {
            this.repositoryItemCheckedComboBoxEdit1.Items.Clear();
              this.repositoryItemCheckedComboBoxEdit2.Items.Clear();
              byte mask = 0x01;
              string regex = "[";
              int favCount = 0;
              for (int bit=0; bit<5; bit++, mask<<=1)
              {
            if (((int) favorites & mask) != 0)
            {
              char c = (char) ('A' + bit);
              this.repositoryItemCheckedComboBoxEdit1.Items.Add(c);
              this.repositoryItemCheckedComboBoxEdit2.Items.Add(c);
              regex += c;
              ++favCount;
            }
              }
              regex += "]*";
              this.repositoryItemCheckedComboBoxEdit1.Mask.EditMask = regex;
              this.repositoryItemCheckedComboBoxEdit2.Mask.EditMask = regex;

              while (this.tabSubList.TabPages.Count > favCount + 1)
            this.tabSubList.TabPages.RemoveAt(this.tabSubList.TabPages.Count-1);
              while (this.tabSubList.TabPages.Count < favCount + 1)
              {
            var page = this.tabSubList.TabPages.Add();
            page.Text = "Fav " + (char)('A' + this.tabSubList.TabPages.Count - 2);
              }
              if (!this.dataRoot.SortedFavorites || this.subListIndex >= favCount)
              {
            this.tabSubList.SelectedTabPageIndex = 0;
            this.subListIndex = 0;
              }
              this.grpSubList.Visible = this.dataRoot.SortedFavorites;
              this.mnuFavList.Enabled = this.dataRoot.SortedFavorites;
              this.colOutFav.OptionsColumn.AllowEdit = !this.dataRoot.SortedFavorites;
              this.colFavorites.OptionsColumn.AllowEdit = !this.dataRoot.SortedFavorites;
        }
 public virtual void DeleteFavorites(Favorites entity)
 {
     Delete(entity);
 }
Пример #54
0
        public void SetFavorites(List<ChannelInfo> list, Favorites favorites, bool set)
        {
            bool sortedFav = this.DataRoot.SortedFavorites;
              int favIndex = 0;
              if (sortedFav)
              {
            for (int mask = (int) favorites; (mask & 1) == 0; mask >>= 1)
              ++favIndex;
              }

              if (set)
              {
            int maxPosition = 0;
            if (sortedFav)
            {
              foreach (var channel in this.ChannelList.Channels)
            maxPosition = Math.Max(maxPosition, channel.FavIndex[favIndex]);
            }

            foreach (var channel in list)
            {
              if (sortedFav && channel.FavIndex[favIndex] == -1)
            channel.FavIndex[favIndex] = ++maxPosition;
              channel.Favorites |= favorites;
            }
              }
              else
              {
            foreach (var channel in list)
            {
              if (sortedFav && channel.FavIndex[favIndex] != -1)
              {
            channel.FavIndex[favIndex] = -1;
            // TODO close gap by pulling down higher numbers
              }
              channel.Favorites &= ~favorites;
            }
              }
        }
Пример #55
0
 /// <summary>
 ///     remove the menu, resize the window, remove border, and maximize
 /// </summary>
 public void RemoveBorder(ProcessDetails pd, Favorites.Favorite favDetails = null, Boolean overrideTimeout = false)
 {
     if(favDetails != null && favDetails.DelayBorderless == true && overrideTimeout == false)
     {
         //Wait 10 seconds before removing the border.
         Task task = new Task(() => RemoveBorder(pd, favDetails, true));
         task.Wait(TimeSpan.FromSeconds(10));
     }
     Manipulation.MakeWindowBorderless(pd, window, pd.WindowHandle, new Rectangle(), favDetails ?? _favorites.FromProcessDetails(pd));
 }
Пример #56
0
 public void AssignStores(DataDispatcher dispatcher, Favorites favorites)
 {
     this.dispatcher = dispatcher;
     this.favorites = favorites;
 }
 /// <summary>
 ///     remove the menu, resize the window, remove border, and maximize
 /// </summary>
 public void RemoveBorder_ToSpecificRect(IntPtr hWnd, Rectangle targetFrame, Favorites.Favorite favDetails = null)
 {
     var pd = _processDetails.FromHandle(hWnd);
     Manipulation.MakeWindowBorderless(pd, window, hWnd, targetFrame, favDetails ?? _favorites.FromProcessDetails(pd));
 }
 /// <summary>
 ///     remove the menu, resize the window, remove border, and maximize
 /// </summary>
 public void RemoveBorder_ToSpecificScreen(IntPtr hWnd, Screen screen, Favorites.Favorite favDetails = null)
 {
     var pd = _processDetails.FromHandle(hWnd);
     Manipulation.MakeWindowBorderless(pd, window, hWnd, screen.Bounds, favDetails ?? _favorites.FromProcessDetails(pd));
 }
Пример #59
0
 public static string GetFavString(Favorites favorites)
 {
     string sep = "";
       string text = "";
       foreach (Favorites favMask in Enum.GetValues(typeof(Favorites)))
       {
     if ((favorites & favMask) != 0)
     {
       text += sep + favMask.ToString();
       sep = ",";
     }
       }
       return text;
 }
Пример #60
0
 public Favorites.Destroy.Result[] Destroy(Favorites.Destroy.Command command)
 {
     return _ApiEndpoints._Client.GetResult<Favorites.Destroy.Command, Favorites.Destroy.Result[]>(command);
 }