Пример #1
0
 /// <summary>
 /// 收藏作品
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnFav_Click(object sender, EventArgs e)
 {
     if (BtnUnFav.CommandArgument != null)
     {
         long userId = long.Parse(BtnUnFav.CommandArgument);
         using (ChannelFactory <IServiceUser> cfUser = new ChannelFactory <IServiceUser>("ServiceUser"))
         {
             IServiceUser user      = cfUser.CreateChannel();
             Favorites    favorites = new Favorites
             {
                 UserID   = userId,
                 ItemID   = WorksId,
                 DomainID = 5,
                 FavDate  = DateTime.Now,
                 Flag     = 1
             };
             user.AddFav(favorites);
             Common.Common.ShowMessage(this, GetType(), "收藏成功");
             BtnFav.Visible   = false;
             BtnUnFav.Visible = true;
         }
     }
     else
     {
         Common.Common.ShowMessage(this, GetType(), "请先登录");
     }
 }