/// <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)); }
/// <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)); }