148 lines
4.3 KiB
C#
148 lines
4.3 KiB
C#
|
|
using System;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Data.SqlClient;
|
|||
|
|
using ZWL.DBUtility;//请先添加引用
|
|||
|
|
namespace ZWL.BLL
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 类ERPSystemSetting。
|
|||
|
|
/// </summary>
|
|||
|
|
public class ERPSystemSetting
|
|||
|
|
{
|
|||
|
|
public ERPSystemSetting()
|
|||
|
|
{ }
|
|||
|
|
#region Model
|
|||
|
|
private int _id;
|
|||
|
|
private string _filetype;
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
public int ID
|
|||
|
|
{
|
|||
|
|
set { _id = value; }
|
|||
|
|
get { return _id; }
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
public string FileType
|
|||
|
|
{
|
|||
|
|
set { _filetype = value; }
|
|||
|
|
get { return _filetype; }
|
|||
|
|
}
|
|||
|
|
#endregion Model
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region 成员方法
|
|||
|
|
/// <summary>
|
|||
|
|
/// 是否存在该记录
|
|||
|
|
/// </summary>
|
|||
|
|
public bool Exists(int ID)
|
|||
|
|
{
|
|||
|
|
StringBuilder strSql = new StringBuilder();
|
|||
|
|
strSql.Append("select count(1) from ERPSystemSetting");
|
|||
|
|
strSql.Append(" where ID=" + ID + " ");
|
|||
|
|
|
|||
|
|
SqlParameter[] parameters = {
|
|||
|
|
new SqlParameter("@ID", SqlDbType.Int,4) };
|
|||
|
|
parameters[0].Value = ID;
|
|||
|
|
|
|||
|
|
return DbHelperSQL.Exists(strSql.ToString(), parameters);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 增加一条数据
|
|||
|
|
/// </summary>
|
|||
|
|
public int Add()
|
|||
|
|
{
|
|||
|
|
StringBuilder strSql = new StringBuilder();
|
|||
|
|
strSql.Append("insert into ERPSystemSetting(");
|
|||
|
|
strSql.Append("FileType)");
|
|||
|
|
strSql.Append(" values (");
|
|||
|
|
strSql.Append("@FileType)");
|
|||
|
|
strSql.Append(";select @@IDENTITY");
|
|||
|
|
SqlParameter[] parameters = {
|
|||
|
|
new SqlParameter("@FileType", SqlDbType.VarChar,8000)};
|
|||
|
|
parameters[0].Value = FileType;
|
|||
|
|
|
|||
|
|
object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
|
|||
|
|
if (obj == null)
|
|||
|
|
{
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return Convert.ToInt32(obj);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 更新一条数据
|
|||
|
|
/// </summary>
|
|||
|
|
public void Update()
|
|||
|
|
{
|
|||
|
|
StringBuilder strSql = new StringBuilder();
|
|||
|
|
strSql.Append("update ERPSystemSetting set ");
|
|||
|
|
strSql.Append("FileType=@FileType");
|
|||
|
|
SqlParameter[] parameters = {
|
|||
|
|
new SqlParameter("@FileType", SqlDbType.VarChar,8000)};
|
|||
|
|
parameters[0].Value = FileType;
|
|||
|
|
|
|||
|
|
DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除一条数据
|
|||
|
|
/// </summary>
|
|||
|
|
public void Delete(int ID)
|
|||
|
|
{
|
|||
|
|
StringBuilder strSql = new StringBuilder();
|
|||
|
|
strSql.Append("delete ERPSystemSetting ");
|
|||
|
|
strSql.Append(" where ID=" + ID + " ");
|
|||
|
|
SqlParameter[] parameters = {
|
|||
|
|
new SqlParameter("@ID", SqlDbType.Int,4) };
|
|||
|
|
parameters[0].Value = ID;
|
|||
|
|
|
|||
|
|
DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 得到一个对象实体
|
|||
|
|
/// </summary>
|
|||
|
|
public void GetModel()
|
|||
|
|
{
|
|||
|
|
StringBuilder strSql = new StringBuilder();
|
|||
|
|
strSql.Append("select ID,FileType ");
|
|||
|
|
strSql.Append(" FROM ERPSystemSetting ");
|
|||
|
|
SqlParameter[] parameters = {};
|
|||
|
|
|
|||
|
|
DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
|
|||
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
if (ds.Tables[0].Rows[0]["ID"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
|
|||
|
|
}
|
|||
|
|
FileType = ds.Tables[0].Rows[0]["FileType"].ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获得数据列表
|
|||
|
|
/// </summary>
|
|||
|
|
public DataSet GetList(string strWhere)
|
|||
|
|
{
|
|||
|
|
StringBuilder strSql = new StringBuilder();
|
|||
|
|
strSql.Append("select [ID],[FileType] ");
|
|||
|
|
strSql.Append(" FROM ERPSystemSetting ");
|
|||
|
|
if (strWhere.Trim() != "")
|
|||
|
|
{
|
|||
|
|
strSql.Append(" where " + strWhere);
|
|||
|
|
}
|
|||
|
|
return DbHelperSQL.Query(strSql.ToString());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion 成员方法
|
|||
|
|
}
|
|||
|
|
}
|