/// <summary>Called before a Common_Friend is updated.</summary>
 /// <param name="instance">The instance.</param>
 partial void UpdateCommon_Friend(Common_Friend instance);
 /// <summary>Called before a Common_Friend is deleted.</summary>
 /// <param name="instance">The instance.</param>
 partial void DeleteCommon_Friend(Common_Friend instance);
 /// <summary>Called before a Common_Friend is inserted.</summary>
 /// <param name="instance">The instance.</param>
 partial void InsertCommon_Friend(Common_Friend instance);
示例#4
0
 public bool CheckIsFriend(Common_Friend friend)
 {
     using (BlogDataDataContext BDContext = new BlogDataDataContext())
     {
         var friends = BDContext.Common_Friends.Where(f => f.Frd_UserId == friend.Frd_UserId && f.Frd_FriendUserId == friend.Frd_FriendUserId);
         if (friends.Count() > 0)
         {
             return true;
         }
         return false;
     }
 }
示例#5
0
 public bool Update(Common_Friend friend)
 {
     using (BlogDataDataContext BDContext = new BlogDataDataContext())
     {
         try
         {
             //这里应该有更好的方法!知道的说一下哈~
             Common_Friend friendTmp = BDContext.Common_Friends.Select(f => f).Single(f => f.Frd_Id == friend.Frd_Id);
             friendTmp = friend;
             BDContext.SubmitChanges();
             return true;
         }
         catch (InvalidOperationException)
         {
             return false;
         }
         catch (ChangeConflictException)
         {
             return false;
         }
     }
 }
示例#6
0
 public bool Insert(Common_Friend friend)
 {
     if (CheckIsFriend(friend))
     {
         return false;
     }
     using (BlogDataDataContext BDContext = new BlogDataDataContext())
     {
         try
         {
             BDContext.Common_Friends.InsertOnSubmit(friend);
             BDContext.SubmitChanges();
             return true;
         }
         catch (ChangeConflictException)
         {
             return false;
         }
     }
 }
示例#7
0
        public override void DataBind()
        {
            if (blogContext.ID != -1)
            {
                Common_Friend CF = new Common_Friend();
                CF.Frd_CreateTime = DateTime.Now;
                CF.Frd_FriendUserId = BWeblog_User.GetUserIDByFiiD(blogContext.ID);
                
                //myself:不用强制类型转换
                CF.Frd_TxzUID = blogContext.Owner.User_TxzId.Value;
                CF.Frd_UserId = blogContext.BlogUserId;

                BCommon_Friend.Insert(CF);
                HttpContext.Current.Response.Redirect("/" + blogContext.Owner.User_DomainName + "/Manage/Friend.aspx");
            }

            if (blogContext.Action == "All")
            {
                HttpContext.Current.Session["SearchKey"] = null; //清楚信息
            }

            if (HttpContext.Current.Session["SearchKey"] != null)
            {
                View_WeblogUserXSJBXX v = (View_WeblogUserXSJBXX)HttpContext.Current.Session["SearchKey"];
                RepeaterPaged1.Length = 30;
                RepeaterPaged1.UrlFormat = "/Manage/AddFriend.aspx?mfiid=" + blogContext.MFiiD.ToString() + "&";
                int Count = 0;
                RepeaterPaged1.DataSource = BView_WeblogUserXSJBXX.SearchByAll(blogContext.PageIndex, 30, out Count, v.XB, v.User_QQ, v.User_NickName, v.User_Name, v.XH, v.YXSH, v.ZYH);
                RepeaterPaged1.Count = Count;
                RepeaterPaged1.DataBind();
            }
            else
            {
                RepeaterPaged1.Length = 30;
                RepeaterPaged1.UrlFormat = "/Manage/AddFriend.aspx?mfiid=" + blogContext.MFiiD.ToString() + "&";
                int Count = 1;
                RepeaterPaged1.DataSource = BWeblog_User.GetAllPaged(blogContext.PageIndex, 30, out Count);
                RepeaterPaged1.Count = Count;
                RepeaterPaged1.DataBind();
            }
            base.DataBind();
        }