📄 need.cs
字号:
using System;
using System.Data;
using HouseSystem.SQLDAL;
using HouseSystem.Modal;
namespace HouseSystem.Components
{
/// <summary>
/// Need 的摘要说明。
/// </summary>
public class Need
{
public static int Add(HouseInfo entity)
{
int num2;
object[] objArray1 = new object[0x23] {
"INSERT INTO Need(Type ,User_ID,Area_ID ,Ht_ID ,IsAgency ,Addr ,Square ,Price ,FYHX ,ZXQK ,Other ,LinkMan ,Tel1 ,Tel2 ,Email ,Expire ,IpAddr) VALUES (", entity.Type, " ,", entity.UserID, " ,", entity.AreaID, " ,", entity.HtID, " ,", entity.IsAgency, " ,'", entity.Addr, "' ,", entity.Square, " ,", entity.Price,
" ,'", entity.FYHX, "' ,'", entity.ZXQK, "' ,'", entity.Other, "' ,'", entity.LinkMan, "' ,'", entity.Tel1, "' ,'", entity.Tel2, "' ,'", entity.Email, "' ,", entity.Expire,
" ,'", entity.IpAddr, "')"
} ;
string text1 = string.Concat(objArray1);
try
{
int num1 = SQLHelper.ExecuteNonQuery(text1);
num2 = num1;
}
catch (Exception exception1)
{
num2 = -99;
}
return num2;
}
public static int Del(int ID)
{
string text1 = "DELETE FROM Need WHERE ID=" + ID;
return SQLHelper.ExecuteNonQuery(text1);
}
public static int Del(int ID, int UserId)
{
object[] objArray1 = new object[5] { "DELETE FROM Need WHERE ID=", ID, " AND User_ID = ", UserId, "" } ;
string text1 = string.Concat(objArray1);
return SQLHelper.ExecuteNonQuery(text1);
}
public static DataTable GetAllNeedList()
{
string text1 = "SELECT ID, Type ,Area_ID ,Ht_ID ,IsAgency ,Addr ,Square ,Price , FYHX ,AddTime FROM Need WHERE State=1 ORDER BY ID DESC";
return SQLHelper.ExecuteDataTable(text1);
}
public static DataRow GetNeedDetail(int ID)
{
string text1 = "SELECT * FROM Need WHERE ID=" + ID;
return SQLHelper.ExecuteDataRow(text1);
}
public static DataRow GetNeedDetail(int ID, int UserId)
{
object[] objArray1 = new object[5] { "SELECT * FROM Need WHERE ID=", ID, " AND User_ID = ", UserId, "" } ;
string text1 = string.Concat(objArray1);
return SQLHelper.ExecuteDataRow(text1);
}
public static DataTable GetNeedList(byte Type)
{
string text1 = "SELECT ID, Type ,User_ID ,Area_ID ,Ht_ID ,IsAgency ,Addr ,Square ,Price , FYHX ,AddTime FROM Need WHERE State=1 AND Type = " + Type + " ORDER BY ID DESC";
return SQLHelper.ExecuteDataTable(text1);
}
public static DataTable GetNeedList(byte Type, byte Top)
{
object[] objArray1 = new object[5] { "SELECT TOP ", Top, " ID, Type ,User_ID ,Area_ID ,Ht_ID ,IsAgency ,Addr ,Square ,Price , FYHX ,AddTime FROM Need WHERE State=1 AND Type = ", Type, " ORDER BY ID DESC" } ;
string text1 = string.Concat(objArray1);
return SQLHelper.ExecuteDataTable(text1);
}
public static DataTable GetNeedListByTypeArea(byte Type, byte areaId)
{
object[] objArray1 = new object[5] { "SELECT ID, Type ,Area_ID ,Ht_ID ,IsAgency ,Addr ,Square ,Price , FYHX ,AddTime FROM Need WHERE State=1 AND Type = ", Type, " AND Area_ID = ", areaId, " ORDER BY ID DESC" } ;
string text1 = string.Concat(objArray1);
return SQLHelper.ExecuteDataTable(text1);
}
public static DataTable GetNeedListByTypeArea(byte Type, byte areaId, byte infoType)
{
object[] objArray1 = new object[7] { "SELECT ID, Type ,Area_ID ,Ht_ID ,IsAgency ,Addr ,Square ,Price , FYHX ,AddTime FROM Need WHERE State=1 AND Type = ", Type, " AND Area_ID = ", areaId, " AND IsAgency = ", infoType, " ORDER BY ID DESC" } ;
string text1 = string.Concat(objArray1);
return SQLHelper.ExecuteDataTable(text1);
}
public static DataTable GetNeedListByUserID(int UserId)
{
string text1 = "SELECT ID, Type ,User_ID ,Area_ID ,Ht_ID ,IsAgency ,Addr ,Square ,Price , FYHX ,AddTime FROM Need WHERE State=1 AND User_ID = " + UserId + " ORDER BY ID DESC";
return SQLHelper.ExecuteDataTable(text1);
}
public static int Hits(int ID)
{
string text1 = "UPDATE Need SET Hits = Hits + 1 WHERE ID=" + ID;
return SQLHelper.ExecuteNonQuery(text1);
}
public static bool IsExist(string addr, string ipAddr)
{
bool flag1;
string[] textArray1 = new string[5] { "SELECT ipAddr FROM Need WHERE Addr = '", addr, "' AND IpAddr = '", ipAddr, "'" } ;
string text1 = string.Concat(textArray1);
try
{
object obj1 = SQLHelper.ExecuteScalar(text1);
if (obj1 != null)
{
return true;
}
flag1 = false;
}
catch (Exception exception1)
{
flag1 = false;
}
return flag1;
}
public static int Update(HouseInfo entity)
{
int num2;
object[] objArray1 = new object[0x21] {
"UPDATE Need SET Type=", entity.Type, " ,Area_ID=", entity.AreaID, " ,Ht_ID=", entity.HtID, " ,IsAgency=", entity.IsAgency, " ,Addr='", entity.Addr, "' ,Square=", entity.Square, " ,Price=", entity.Price, " ,FYHX='", entity.FYHX,
"' ,ZXQK='", entity.ZXQK, "' ,Other='", entity.Other, "' ,LinkMan='", entity.LinkMan, "' ,Tel1='", entity.Tel1, "' ,Tel2='", entity.Tel2, "' ,Email='", entity.Email, "' ,Expire=", entity.Expire, " WHERE (ID = ", entity.ID,
")"
} ;
string text1 = string.Concat(objArray1);
try
{
int num1 = SQLHelper.ExecuteNonQuery(text1);
num2 = num1;
}
catch (Exception exception1)
{
num2 = -99;
}
return num2;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -