Пример #1
0
        //查看评论
        public bool lookComment(Mail m, Comment c)
        {
            //改变标志位
            string sql2 = string.Format("Update FFTX_Photo_Comment set comment_look_flag = 1 where comment_id = {0}", c.Comment_Id);
            int    r2   = SqlDB.ExecuteNonQuery(sql2);

            //success
            if (r2 == 1)
            {
                //更新站内信条数
                string sql = string.Format("Update FFTX_Mail set comment_num = {0} where user_id = {1}", m.Comment_Num, m.User_Id);
                int    r   = SqlDB.ExecuteNonQuery(sql);
                if (r == 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 添加好友 好友所在组 人员数+1
        /// </summary>
        /// <param name="f">包含User Id, Follow_Id, Group_Id, Follow_id_Remark</param>
        /// <returns>成功返回1  已成为好友返回2 失败返回0</returns>
        public int addFriend(Friend f)
        {
            //添加之前先查询是否已经成为好友
            if (hasBeenFriend(f))
            {
                return(2);
            }
            else
            {   // 没有成为好友  再添加好友
                string sql = string.Format("INSERT INTO FFTX_Friend (user_id,follow_id,group_id,follow_id_remark) VALUES ('{0}','{1}','{2}','{3}')",
                                           f.User_Id, f.Follow_Id, f.Group_Id, f.Follow_Id_Remark);
                int result = SqlDB.ExecuteNonQuery(sql);

                //用户关注和 粉丝数的变更
                //加完好友  好友所在组数+1
                if (result == 1 && new GroupSql().plusOneInGroupNum(f) && new UserSql().changeUserFans(f.Follow_Id, "plus") && new UserSql().changeUserFollow(f.User_Id, "plus"))
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
        }
Пример #3
0
        public bool changeUserFollow(string user_id, string operate)
        {
            string sql = null;

            if (operate.Equals("plus"))
            {
                sql = string.Format("Update FFTX_User set user_follow = (user_follow+1) where user_id = {0}", user_id);
            }
            else if (operate.Equals("dec"))
            {
                sql = string.Format("Update FFTX_User set user_fans = (user_fans+1) where user_id = {0}", user_id);
            }
            else
            {
                return(false);
            }

            int result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
        public int changeHeadImg(User u)
        {
            string sql    = string.Format("Update FFTX_User set user_headimg = '{0}' where user_id = {1}", u.User_HeadImg, u.User_Id);
            int    result = SqlDB.ExecuteNonQuery(sql);

            return(result);
        }
Пример #5
0
 /// <summary>
 /// 添加用户分组信息 ( 用户创建了一个分组)
 /// </summary>
 /// <param name="group">需要有 User_id和Group_name </param>
 /// <returns>添加成功返回true</returns>
 public bool addGroupFriendInfo(Group group)
 {
     //添加之前先查询是否有同名分组
     if (searchGroupFriendInfo(group))
     {
         //查找到分组 直接返回
         return(true);
     }
     else
     {
         //没有查找到 添加分组
         string sql    = string.Format("Insert Into FFTX_Group_to_Friend(user_id,group_id,group_name) VALUES('{0}',{1},'{2}')", group.User_Id, group.Group_Id, group.Group_Name);
         int    result = SqlDB.ExecuteNonQuery(sql);
         //是否成功
         if (result == 1)
         {
             //获取用户分组信息
             if (searchGroupFriendInfo(group))
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
 }
Пример #6
0
        //主动封号
        public bool blockUser(AdminOperate ao)
        {
            bool result = false;
            User u      = new User();

            u.User_Id = ao.User_Id;
            //判断用户是否存在
            if (new UserSql().isExistUser(u))
            {
                //改用户状态
                string sql = string.Format("Update FFTX_User set user_state = 0 where user_id = {0}", ao.User_Id);
                int    r   = SqlDB.ExecuteNonQuery(sql);
                //执行失败
                if (r != 1)
                {
                    return(false);
                }

                //添加一条 处理数据
                string sql2 = string.Format("INSERT INTO FFTX_Admin_Operate (admin_id,user_id,operate_time,operate_reason) VALUES ('{0}','{1}','{2}','{3}')",
                                            ao.Admin_Id, ao.User_Id, ao.Operate_Time, ao.Operate_Reason);
                r = SqlDB.ExecuteNonQuery(sql2);
                //添加数据失败
                if (r != 1)
                {
                    return(false);
                }

                return(true);
            }

            return(result);
        }
Пример #7
0
        //创建相册
        public int addAlbum(Album album)
        {
            string sql = string.Format("INSERT INTO FFTX_Album (user_id,album_name,album_describe,album_power) VALUES ('{0}','{1}','{2}','{3}')",
                                       album.User_Id, album.Album_Name, album.Album_Describe, album.Album_Power);

            int result = SqlDB.ExecuteNonQuery(sql);

            return(result);
        }
Пример #8
0
        //重命名相册
        public bool renameAlbum(Album album)
        {
            string sql = string.Format("Update FFTX_Album set album_name = '{0}' where album_id = {1}", album.Album_Name, album.Album_Id);
            int    r   = SqlDB.ExecuteNonQuery(sql);

            //执行失败
            if (r != 1)
            {
                return(false);
            }
            return(true);
        }
Пример #9
0
        //清空信息
        public bool emptyMail(Mail m)
        {
            string sql = string.Format("Update FFTX_Mail set comment_num = 0,share_num=0,like_num=0,message_num =0 where user_id = {2}", m.Comment_Num, m.Message_Num, m.User_Id);
            int    r   = SqlDB.ExecuteNonQuery(sql);

            //执行失败
            if (r != 1)
            {
                return(false);
            }
            return(true);
        }
Пример #10
0
        public bool changeUserState(string uid, int state)
        {
            string sql    = string.Format("Update  FFTX_User set user_state = {0} where user_id = '{1}'", state, uid);
            int    result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #11
0
        //解封
        public bool deblockUser(UserRequest ur)
        {
            string sql    = string.Format("delete from FFTX_Admin_Request where user_id = {0}", ur.User_Id);
            int    result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #12
0
        //删除留言
        public bool deleteMessage(int mid)
        {
            string sql = string.Format("delete from FFTX_BoardMessage where message_id={0}", mid);
            int    r   = SqlDB.ExecuteNonQuery(sql);

            if (r == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #13
0
        //重命名
        public bool renamePhoto(Photo p)
        {
            string sql    = string.Format("Update FFTX_Photo set photo_src = '{0}' where photo_id = {1}", p.Photo_Src, p.Photo_Id);
            int    result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #14
0
        public bool blockUser(UserRequest ur)
        {
            string sql    = string.Format("update  FFTX_Admin_Request set request_state = 1 where user_id = {0}", ur.User_Id);
            int    result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #15
0
        public bool decOneInGroupNum(Friend f)
        {
            //用户所在组 数量+1
            string sql    = string.Format("update FFTX_Group_to_Friend set group_friend_num = (group_friend_num-1) where user_id ='{0}',group_id={1}", f.User_Id, f.Group_Id);
            int    result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #16
0
        //设置相册封面
        public bool changeAlbumCover(Album album)
        {
            string sql = string.Format("Update FFTX_Album set album_cover = '{0}' where album_id = {1}", album.Album_Cover, album.Album_Id);
            int    r   = SqlDB.ExecuteNonQuery(sql);

            //执行失败
            if (r != 1)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Пример #17
0
        /// <summary>
        /// 用户注册 注册信息包括: ID 用户名 密码 密保问题 密保答案
        /// </summary>
        /// <param name="user">用户类</param>
        /// <returns>添加成功返回1   失败返回-1</returns>
        public int addUser(User user)
        {
            int result = -1;

            string sql = string.Format("INSERT INTO FFTX_User (user_id,user_name,user_password,password_question,password_answer) VALUES ('{0}','{1}','{2}','{3}','{4}')",
                                       user.User_Id, user.User_Name, user.User_Password, user.Password_Question, user.Password_Answer);

            //判断用户ID是否存在.不存在便添加
            if (!isExistUser(user))
            {
                result = SqlDB.ExecuteNonQuery(sql);
            }

            return(result);
        }
Пример #18
0
        public bool addCommentMail(string uid)
        {
            string sql = string.Format("update FFTX_Mail set comment_num = comment_num+1 where user_id = {0}",
                                       uid);
            int r = SqlDB.ExecuteNonQuery(sql);

            if (r == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #19
0
        public bool changePwd(User user)
        {
            string sql = string.Format("Update FFTX_User set user_password = '******' where user_id = '{1}'",
                                       user.User_Password, user.User_Id);
            int result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #20
0
        //更新用户信息
        public bool updateUserInfo(User user)
        {
            string sql = string.Format("Update FFTX_User set user_name='{0}',user_email='{1}',user_phone='{2}',user_sex='{3}' where user_id = '{4}'",
                                       user.User_Name, user.User_Email, user.User_Phone, user.User_Sex, user.User_Id);
            int result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #21
0
        //申请解封
        // 数据库添加一条信息
        public bool requestDeblock(UserRequest ur)
        {
            string sql = string.Format("INSERT INTO FFTX_Admin_Request (user_id,request_time) VALUES ('{0}','{1}')",
                                       ur.User_Id, ur.Request_Time);
            int result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #22
0
        //评论
        public bool addComment(Comment c)
        {
            string sql = string.Format("INSERT INTO FFTX_Photo_Comment (comment_user_id,comment_user_name,photo_id,comment_content,reply_id,comment_time,reply_user_id,reply_user_name) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')",
                                       c.Comment_User_Id, c.Comment_Name, c.Photo_Id, c.Comment_Content, c.Reply_Id, c.Comment_Time, c.Reply_User_Id, c.Reply_User_Name);
            int result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #23
0
        //新建用户拥有站内信
        public bool creatMail(Mail m)
        {
            string sql = string.Format("INSERT INTO FFTX_Mail (user_id) VALUES ('{0}')",
                                       m.User_Id);
            int r = SqlDB.ExecuteNonQuery(sql);

            if (r == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #24
0
        //添加留言
        public bool addMessage(Message m)
        {
            string sql = string.Format("Insert into FFTX_BoardMessage (message_content,message_time,message_friend_id,message_reply_id,message_user_id,message_user_name) values('{0}','{1}','{2}',{3},'{4}','{5}')",
                                       m.Message_Content, m.Message_Time, m.Message_Friend_Id, m.Message_Reply_Id, m.Message_User_Id, m.Message_User_Name);
            int r = SqlDB.ExecuteNonQuery(sql);

            if (r == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #25
0
        //上传照片
        public bool uploadPhoto(Photo p)
        {
            string sql = string.Format("INSERT INTO FFTX_Photo (photo_src,photo_time,album_id,photo_label) VALUES ('{0}','{1}','{2}','{3}')",
                                       p.Photo_Src, p.Photo_Time, p.album_id, p.Photo_Label);
            //在Photo表中添加一条信息
            int result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #26
0
        public bool deleteGroup(Group g)
        {
            //删除分组
            string sql    = string.Format("DELETE FROM FFTX_Friend WHERE group_id='{0}'", g.Group_Id);
            int    result = SqlDB.ExecuteNonQuery(sql);
            string a      = string.Format("delete from FFTX_Group_to_Friend where user_id='{0}' and group_id='{1}'", g.User_Id, g.Group_Id);
            int    b      = SqlDB.ExecuteNonQuery(a);

            if (result == 1 && b == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #27
0
        //删除好友
        public int deleteFriend(Friend f)
        {
            //删除好友
            string sql = string.Format("DELETE FROM FFTX_Friend WHERE user_id={0} AND follow_id={1}", f.User_Id, f.Follow_Id);

            int result = SqlDB.ExecuteNonQuery(sql);

            //用户 粉丝 与 关注数变化

            //好友所在分组总数 -1
            if (result == 1 && new GroupSql().decOneInGroupNum(f) && new UserSql().changeUserFans(f.Follow_Id, "dec") && new UserSql().changeUserFollow(f.User_Id, "dec"))
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Пример #28
0
        /// <summary>
        /// 添加 group_name 和group_id对应信息
        /// </summary>
        /// <param name="group">需要group_name字段</param>
        /// <returns>添加成功返回true 并获取group_id</returns>
        public bool addGroupInfo(Group group)
        {
            //在 Group表中  添加 ID 和 组名对应信息
            if (!searchGroupInfo(group))
            {
                string sql    = string.Format("Insert Into FFTX_Group(group_name) VALUES('{0}')", group.Group_Name);
                int    result = SqlDB.ExecuteNonQuery(sql);

                if (result == 1)                    //添加对应信息成功
                {
                    return(searchGroupInfo(group)); //获取group id是否成功
                }
                else
                {
                    return(false);
                }
            }
            //在Group to User表中  为用户添加相应分组
            return(true);
        }
Пример #29
0
        //删除相册              path: Request.MapPath("~s");
        public bool deleteAlbum(Album album, string path)
        {
            //查询相册中所包含的 photo id
            string        sql   = string.Format("select photo_id from FFTX_Photo where album_id = '{0}'", album.Album_Id);
            SqlDataReader sqldr = SqlDB.ExecuteReader(sql);

            if (sqldr != null && sqldr.HasRows)
            {
                while (sqldr.Read())
                {
                    //删除photo
                    deletePhoto(sqldr.GetInt32(0), path);
                }
            }
            string sql2   = string.Format("delete from FFTX_Album where album_id = {0}", album.Album_Id);
            int    result = SqlDB.ExecuteNonQuery(sql2);

            if (result == 1)
            {
                return(true);
            }
            return(false);
        }
Пример #30
0
        //删除
        public bool deletePhoto(Photo p)
        {
            string sql    = string.Format("delete from FFTX_Photo where photo_id = {0}", p.Photo_Id);
            int    result = SqlDB.ExecuteNonQuery(sql);

            if (result == 1)
            {
                string sql1 = string.Format("delete from FFTX_Photo_Comment where photo_id = {0}", p.Photo_Id);
                string sql2 = string.Format("delete from FFTX_Photo_Like where photo_id = {0}", p.Photo_Id);
                string sql3 = string.Format("delete from FFTX_Photo_Share where photo_id = {0}", p.Photo_Id);
                SqlDB.ExecuteNonQuery(sql1);
                SqlDB.ExecuteNonQuery(sql2);
                SqlDB.ExecuteNonQuery(sql3);


                return(true);
            }

            else
            {
                return(false);
            }
        }