RentHouseDAL/PictureService.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RentHouseModel;
using System.Data.SqlClient;
using System.Data;

namespace RentHouseDAL
{
    public static class PictureService
    {
        public static void AddPicture(string houseid)
        {
            string sql = "insert into Pictures(Img1,Img2,Img3,Img4,Img5,HouseID) values('','','','','',@HouseID)";
            SqlParameter[] para=new SqlParameter[]{
                new SqlParameter("@HouseID",houseid)
            };
           DBHelper.ExecuteCommand(sql,CommandType.Text,para);
        }

        public static void DeletePictureByHouseID(string houseid)
        {
            string sql = "delete from Pictures where HouseID=@HouseID";
            SqlParameter[] para = new SqlParameter[]{
                new SqlParameter("@HouseID",houseid)
            };
            DBHelper.ExecuteCommand(sql, CommandType.Text, para);
        }

        public static Picture GetPictureByHouseID(string houseid)
        {
            Picture pic=new Picture();
            string sql = "select * from Pictures where HouseID=@HouseID";
            SqlParameter[] para = new SqlParameter[] { 
                new SqlParameter("@HouseID",houseid)
            };
            using (SqlDataReader reader = DBHelper.GetReader(sql, CommandType.Text, para))
            {
                if (reader.Read())
                {
                    pic.ID=Convert.ToInt32(reader["ID"]);
                    pic.Img1=reader["Img1"].ToString();
                    pic.Img2=reader["Img2"].ToString();
                    pic.Img3=reader["Img3"].ToString();
                    pic.Img4=reader["Img4"].ToString();
                    pic.Img5=reader["Img5"].ToString();
                    pic.HouseID=houseid;
                }
                else
                {
                    pic=null;
                }
            }
            return pic;
        }

        public static int ModifyImg1(string img1, string houseid)
        {
            string sql = "update Pictures set Img1=@Img1 where HouseID=@HouseID";
后面还有 48 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。