RentHouseDAL/HouseService.cs

(开头部分) 26KB

这里只显示每个文件的开头 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 HouseService
    {
        public static int AddHouse(House house)
        {
            string sql = @"insert into Houses values(@ID,@UserName,@Mode,@Style,@Area,@Floor,@Situation,@Hire,
                        @PayType,@Community,@Address,@Allocation,@Description,@FbDate,@Status)";
            SqlParameter[] para = new SqlParameter[] { 
                new SqlParameter("@ID",house.ID),
                new SqlParameter("@UserName",house.User.UserName),
                new SqlParameter("@Mode",house.Mode),
                new SqlParameter("@Style",house.Style),
                new SqlParameter("@Area",house.Area),
                new SqlParameter("@Floor",house.Floor),
                new SqlParameter("@Situation",house.Situation),
                new SqlParameter("@Hire",house.Hire),
                new SqlParameter("@PayType",house.PayType),
                new SqlParameter("@Community",house.Community),
                new SqlParameter("@Address",house.Address),
                new SqlParameter("@Allocation",house.Allocation),
                new SqlParameter("@Description",house.Description),
                new SqlParameter("@FbDate",house.FbDate),
                new SqlParameter("@Status",house.Status)
            };
            return DBHelper.ExecuteCommand(sql,CommandType.Text,para);
        }

        public static int DeleteHouseByID(string id)
        {
            string sql = "delete from Houses where ID=@ID";
            SqlParameter[] para = new SqlParameter[] {
                new SqlParameter("@ID",id)
            };
            return DBHelper.ExecuteCommand(sql, CommandType.Text, para);
        }

        public static int DeleteHouseByUserName(string username)
        {
            string sql = "delete from Houses where UserName=@UserName";
            SqlParameter[] para = new SqlParameter[] {
                new SqlParameter("@UserName",username)
            };
            return DBHelper.ExecuteCommand(sql, CommandType.Text, para);
        }

        #region Select
        #region GetCount
        public static int GetAllCount()
        {
            string sql = "select count(*) from Houses";
            return Convert.ToInt32(DBHelper.GetScalar(sql, CommandType.Text, null));
后面还有 636 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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