Exemplo n.º 1
0
        /// <summary>
        /// 修改交易信息数据
        /// </summary>
        /// <param name="trade_info"></param>
        /// <returns></returns>
        public int EditTradeInfo(Entity.TradeInfo trade_info)
        {
            string sqlStr = @"UPDATE [TradeInfo]
                SET [commodityID] = @commodityID
                    ,[sellerID] = @sellerID
                    ,[buyerID] = @buyerID
                    ,[isDeal] = @isDeal
                    ,[dealPrice] = @dealPrice
                    ,[cut] = @cut
                    ,[tradeDate] = @tradeDate
                    ,[tradeNote] = @tradeNote
                WHERE recordID = @recordID";

            SqlParameter[] paras =
            {
                new SqlParameter("@recordID",    trade_info.RecordId),
                new SqlParameter("@commodityID", trade_info.CommmdityId),
                new SqlParameter("@sellerID",    trade_info.SellerId),
                new SqlParameter("@buyerID",     trade_info.BuyerId),
                new SqlParameter("@isDeal",      trade_info.IsDeal),
                new SqlParameter("@dealPrice",   trade_info.DealMoney),
                new SqlParameter("@cut",         trade_info.CutMoney),
                new SqlParameter("@tradeDate",   trade_info.TradeDate),
                new SqlParameter("@tradeNote",   trade_info.TradeNote),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查询商品信息(商品ID,即数据库中的commodityID)
        /// </summary>
        /// <param name="commodity_id"></param>
        /// <returns></returns>
        public DataSet SearchCommodityById(string commodity_id)
        {
            string sqlStr = @"SELECT [commodityID]
                ,[phoneNumber]
                ,[commodityName]
                ,[commodityDescription]
                ,[commodityType]
                ,[originalPrice]
                ,[estimatePrice]
                ,[commodityNumber]
                ,[degrees]
                ,[commodityImage1]
                ,[commodityImage2]
                ,[commodityImage3]
                ,[commodityNote]
                ,[launchDate]
            FROM [Commodity] WHERE commodityID = @commodity_id";

            SqlParameter[] paras =
            {
                new SqlParameter("@commodity_id", commodity_id),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.Search(sqlStr, paras));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 修改帖子数据
        /// </summary>
        /// <param name="post"></param>
        /// <returns></returns>
        public int EditPostInfo(Entity.Post post)
        {
            string sqlStr = @"UPDATE [Post]
                SET [postTitle] = @postTitle
                ,[postType] = @postType
                ,[postContent] = @postContent
                ,[postDate] = @postDate
                ,[isReplyType] = @isReplyType
                ,[postID] = @postID
                ,[phoneNumber] = @phoneNumber
                ,[postNote] = @postNote
            WHERE postID = @postID";

            SqlParameter[] paras =
            {
                new SqlParameter("@postTitle",   post.PostTitle),
                new SqlParameter("@postType",    post.PostType),
                new SqlParameter("@postContent", post.PostContent),
                new SqlParameter("@postDate",    post.PostDate),
                new SqlParameter("@isReplyType", post.IsReplyType),
                new SqlParameter("@postID",      post.PostId),
                new SqlParameter("@phoneNumber", post.UserId),
                new SqlParameter("@postNote",    post.PostNote),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 查询用户信息(用户ID,ID即数据库中的电话号码)
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public DataSet SearchUser(string userId)
        {
            string sqlStr = @"SELECT [userName]
                      ,[userNickname]
                      ,[sex]
                      ,[userSchool]
                      ,[grade]
                      ,[email]
                      ,[userImage]
                      ,[password]
                      ,[creditRate]
                      ,[phoneNumber]
                      ,[personalSignature]
                      ,[registrationDate]
                      ,[userType]
                  FROM [User] where phoneNumber=@userId";

            SqlParameter[] paras =
            {
                new SqlParameter("@userId", userId),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.Search(sqlStr, paras));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="commodity"></param>
        /// <returns></returns>
        public int AddCommodity(Entity.Commodity commodity)
        {
            string sqlStr = @"INSERT INTO [Commodity]
                ([commodityID]
                ,[phoneNumber]
                ,[commodityName]
                ,[commodityDescription]
                ,[commodityType]
                ,[originalPrice]
                ,[estimatePrice]
                ,[commodityNumber]
                ,[degrees]
                ,[commodityImage1]
                ,[commodityImage2]
                ,[commodityImage3]
                ,[commodityNote]
                ,[launchDate])
            VALUES
                (
                @commodityID
                ,@phoneNumber
                ,@commodityName
                ,@commodityDescription
                ,@commodityType
                ,@originalPrice
                ,@estimatePrice
                ,@commodityNumber
                ,@degrees
                ,@commodityImage1
                ,@commodityImage2
                ,@commodityImage3
                ,@commodityNote
                ,@launchDate)";

            SqlParameter[] paras =
            {
                new SqlParameter("@commodityID",          commodity.CommodityId),
                new SqlParameter("@phoneNumber",          commodity.UserId),
                new SqlParameter("@commodityName",        commodity.CommodityName),
                new SqlParameter("@commodityDescription", commodity.CommodityDescription),
                new SqlParameter("@commodityType",        commodity.CommodityType),
                new SqlParameter("@originalPrice",        commodity.OriginalPrice),
                new SqlParameter("@estimatePrice",        commodity.EstimateMoney),
                new SqlParameter("@commodityNumber",      commodity.CommodityNumber),
                new SqlParameter("@degrees",              commodity.Degress),
                new SqlParameter("@commodityImage1",      commodity.CommodityImage1),
                new SqlParameter("@commodityImage2",      commodity.CommodityImage2),
                new SqlParameter("@commodityImage3",      commodity.CommodityImage3),
                new SqlParameter("@commodityNote",        commodity.CommodityNote),
                new SqlParameter("@launchDate",           commodity.LaunchDate),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public int AddUser(Entity.User user)
        {
            string sqlStr = @"INSERT INTO [User]
           ([userName]
           ,[userNickname]
           ,[sex]
           ,[userSchool]
           ,[grade]
           ,[email]
           ,[userImage]
           ,[password]
           ,[creditRate]
           ,[phoneNumber]
           ,[personalSignature]
           ,[registrationDate]
           ,[userType])
     VALUES
           (
            @userName,
           ,@userNickname
           ,@sex
           ,@userSchool
           ,@grade
           ,@email
           ,@userImage
           ,@password
           ,@creditRate
           ,@phoneNumber
           ,@personalSignature
           ,@registrationDate
           ,@userType)";

            SqlParameter[] paras =
            {
                new SqlParameter("@userName",          user.UserName),
                new SqlParameter("@userNickname",      user.UserNickName),
                new SqlParameter("@sex",               user.Sex),
                new SqlParameter("@userSchool",        user.UserSchool),
                new SqlParameter("@grade",             user.UserGrade),
                new SqlParameter("@email",             user.UserEmail),
                new SqlParameter("@phoneNumber",       user.UserId),
                new SqlParameter("@userImage",         user.UserImage),
                new SqlParameter("@password",          user.PassWord),
                new SqlParameter("@creditRate",        user.CreditRate),
                new SqlParameter("@personalSignature", user.PersonalSign),
                new SqlParameter("@registrationDate",  user.RegistrationDate),
                new SqlParameter("@userType",          user.UserType),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 删除交易记录
        /// </summary>
        /// <param name="record_id"></param>
        /// <returns></returns>
        public int DeleTradeInfo(int record_id)
        {
            string sqlStr = @"DELETE FROM [TradeInfo]
                WHERE recordID = @record_id";

            SqlParameter[] paras =
            {
                new SqlParameter("@record_id", record_id),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }
Exemplo n.º 8
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="post_id"></param>
        /// <returns></returns>
        public int DelePost(string post_id)
        {
            string sqlStr = @"DELETE FROM [Post]
                    WHERE postID = @postID";

            SqlParameter[] paras =
            {
                new SqlParameter("@postID", post_id)
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }
Exemplo n.º 9
0
        /// <summary>
        /// 删除商品
        /// </summary>
        /// <param name="commodity_id"></param>
        /// <returns></returns>
        public int DeleCommodity(string commodity_id)
        {
            string sqlStr = @"DELETE FROM [Commodity]
                    WHERE commodityID = @commodity_id";

            SqlParameter[] paras =
            {
                new SqlParameter("@commodity_id", commodity_id)
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }
Exemplo n.º 10
0
        /// <summary>
        /// 注销用户
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public int DeleUser(string userId)
        {
            string sqlStr = @"DELETE FROM [User]
                    WHERE phoneNumber = @userId";

            SqlParameter[] paras =
            {
                new SqlParameter("@userId", userId)
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }
Exemplo n.º 11
0
        /// <summary>
        /// 查询商品交易信息(通过记录ID查找,ID即数据库中的recordID)
        /// </summary>
        /// <param name="trade_info_id"></param>
        /// <returns></returns>
        public DataSet SearchTradeInfo(int trade_info_id)
        {
            string sqlStr = @"SELECT [commodityID]
                ,[sellerID]
                ,[buyerID]
                ,[isDeal]
                ,[dealPrice]
                ,[cut]
                ,[tradeDate]
                ,[tradeNote]   
            FROM [TradeInfo] where recordID = @trade_info_id";

            SqlParameter[] paras =
            {
                new SqlParameter("@trade_info_id", trade_info_id),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.Search(sqlStr, paras));
        }
Exemplo n.º 12
0
        /// <summary>
        /// 查询帖子信息(帖子ID,即数据库中postID)
        /// </summary>
        /// <param name="post_id"></param>
        /// <returns></returns>
        public DataSet SearchPost(string post_id)
        {
            string sqlStr = @"SELECT [postTitle]
                ,[postType]
                ,[postContent]
                ,[postDate]
                ,[isReplyType]
                ,[postID]
                ,[phoneNumber]
                ,[postNote]
            FROM [Post] WHERE postID = @postID";

            SqlParameter[] paras =
            {
                new SqlParameter("@postID", post_id),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.Search(sqlStr, paras));
        }
Exemplo n.º 13
0
        /// <summary>
        /// 添加商品交易信息
        /// </summary>
        /// <param name="trade_info"></param>
        /// <returns></returns>
        public int AddTradeInfo(Entity.TradeInfo trade_info)
        {
            string sqlStr = @"INSERT INTO [TradeInfo]
            ([recordID]
            ,[commodityID]
            ,[sellerID]
            ,[buyerID]
            ,[isDeal]
            ,[dealPrice]
            ,[cut]
            ,[tradeDate]
            ,[tradeNote])
    VALUES
            (
            @recordID
            ,@commodityID
            ,@sellerID
            ,@buyerID
            ,@isDeal
            ,@dealPrice
            ,@cut
            ,@tradeDate
            ,@tradeNote)";

            SqlParameter[] paras =
            {
                new SqlParameter("@recordID",    trade_info.RecordId),
                new SqlParameter("@commodityID", trade_info.CommmdityId),
                new SqlParameter("@sellerID",    trade_info.SellerId),
                new SqlParameter("@buyerID",     trade_info.BuyerId),
                new SqlParameter("@isDeal",      trade_info.IsDeal),
                new SqlParameter("@dealPrice",   trade_info.DealMoney),
                new SqlParameter("@cut",         trade_info.CutMoney),
                new SqlParameter("@tradeDate",   trade_info.TradeDate),
                new SqlParameter("@tradeNote",   trade_info.TradeNote),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }
Exemplo n.º 14
0
        /// <summary>
        /// 修改商品数据
        /// </summary>
        /// <param name="commodity"></param>
        /// <returns></returns>
        public int EditCommodityInfo(Entity.Commodity commodity)
        {
            string sqlStr = @"UPDATE [Commodity]
                 SET [commodityID] = @commodityID
                ,[phoneNumber] = @phoneNumber
                ,[commodityName] = @commodityName
                ,[commodityDescription] = @commodityDescription
                ,[commodityType] = @commodityType
                ,[originalPrice] = @originalPrice
                ,[estimatePrice] = @estimatePrice
                ,[commodityNumber] = @commodityNumber
                ,[degrees] = @degrees
                ,[commodityImage1] = @commodityImage1
                ,[commodityImage2] = @commodityImage2
                ,[commodityImage3] = @commodityImage3
                ,[commodityNote] = @commodityNote
                ,[launchDate] = @launchDate
            WHERE commodityID = @commodityID";

            SqlParameter[] paras =
            {
                new SqlParameter("@commodityID",          commodity.CommodityId),
                new SqlParameter("@phoneNumber",          commodity.UserId),
                new SqlParameter("@commodityName",        commodity.CommodityName),
                new SqlParameter("@commodityDescription", commodity.CommodityDescription),
                new SqlParameter("@commodityType",        commodity.CommodityType),
                new SqlParameter("@originalPrice",        commodity.OriginalPrice),
                new SqlParameter("@estimatePrice",        commodity.EstimateMoney),
                new SqlParameter("@commodityNumber",      commodity.CommodityNumber),
                new SqlParameter("@degrees",              commodity.Degress),
                new SqlParameter("@commodityImage1",      commodity.CommodityImage1),
                new SqlParameter("@commodityImage2",      commodity.CommodityImage2),
                new SqlParameter("@commodityImage3",      commodity.CommodityImage3),
                new SqlParameter("@commodityNote",        commodity.CommodityNote),
                new SqlParameter("@launchDate",           commodity.LaunchDate),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }
Exemplo n.º 15
0
        /// <summary>
        /// 添加帖子
        /// </summary>
        /// <param name="post"></param>
        /// <returns></returns>
        public int AddPost(Entity.Post post)
        {
            string sqlStr = @"INSERT INTO [Post]
                ([postTitle]
                ,[postType]
                ,[postContent]
                ,[postData]
                ,[isReplyType]
                ,[postID]
                ,[phoneNumber]
                ,[postNote])
            VALUES 
                (
                @postTitle
                ,@postType
                ,@postContent
                ,@postData
                ,@isReplyType
                ,@postID
                ,@phoneNumber
                ,@postNote)";

            SqlParameter[] paras =
            {
                new SqlParameter("@postTitle",   post.PostTitle),
                new SqlParameter("@postType",    post.PostType),
                new SqlParameter("@postContent", post.PostContent),
                new SqlParameter("@postData",    post.PostDate),
                new SqlParameter("@isReplyType", post.IsReplyType),
                new SqlParameter("@postID",      post.PostId),
                new SqlParameter("@phoneNumber", post.UserId),
                new SqlParameter("@postNote",    post.PostNote),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }
Exemplo n.º 16
0
        /// <summary>
        /// 修改用户数据
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public int EditUserInfo(Entity.User user)
        {
            string sqlStr = @"UPDATE [User]
                       SET [userName] = @userName
                          ,[userNickname] = @userNickname
                          ,[sex] = @sex
                          ,[userSchool] = @userSchool
                          ,[grade] = @grade
                          ,[email] = @email
                          ,[userImage] = @userImage
                          ,[password]=@password
                          ,[creditRate]=@creditRate
                          ,[personalSignature] = @personalSignature
                          ,[registrationDate] = @registrationDate
                          ,[userType] = @userType
                     WHERE phoneNumber = @userId";

            SqlParameter[] paras =
            {
                new SqlParameter("@userName",          user.UserName),
                new SqlParameter("@userNickname",      user.UserNickName),
                new SqlParameter("@sex",               user.Sex),
                new SqlParameter("@userSchool",        user.UserSchool),
                new SqlParameter("@grade",             user.UserGrade),
                new SqlParameter("@email",             user.UserEmail),
                new SqlParameter("@userImage",         user.UserImage),
                new SqlParameter("@password",          user.PassWord),
                new SqlParameter("@creditRate",        user.CreditRate),
                new SqlParameter("@personalSignature", user.PersonalSign),
                new SqlParameter("@registrationDate",  user.RegistrationDate),
                new SqlParameter("@userType",          user.UserType),
                new SqlParameter("@userId",            user.UserId),
            };
            var handler = new DAL.DatabaseHandler();

            return(handler.ExeSql(sqlStr, paras));
        }