You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
301 lines
16 KiB
C#
301 lines
16 KiB
C#
using System;
|
|
using System.Text;
|
|
using System.Data.SqlClient;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using DSWeb.SoftMng.DBUtility;
|
|
// ReSharper disable once CheckNamespace
|
|
namespace DSWeb.SoftMng.DAL
|
|
{
|
|
//user_baseinfo
|
|
public partial class user_baseinfoDAL
|
|
{
|
|
public bool Exists(string GID)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select count(1) from user_baseinfo");
|
|
strSql.Append(" where ");
|
|
|
|
strSql.Append(" GID = @GID ");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@GID", SqlDbType.VarChar,36) };
|
|
parameters[0].Value = GID;
|
|
|
|
return DbHelperSQL.Exists(strSql.ToString(),parameters);
|
|
}
|
|
/// <summary>
|
|
/// 增加一条数据
|
|
/// </summary>
|
|
public int Add(DSWeb.SoftMng.Model.user_baseinfo model)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("insert into user_baseinfo(");
|
|
strSql.Append("GID,USERID,COMPANYNAME,DEPTNAME,OFFICEPHONE,HOMEPHONE,MOBILE,FAX,EMAIL1,EMAIL2,HOMEADDRESS,REMARK,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,EMERGUSER,EMERGPHONE,EMERGEMAIL,POSTCODE,QQ,MSN,SIGNATURE,FINANCESOFTCODE,IMAGEURL,SIGNATUREURL");
|
|
strSql.Append(") values (");
|
|
strSql.Append("@GID,@USERID,@COMPANYNAME,@DEPTNAME,@OFFICEPHONE,@HOMEPHONE,@MOBILE,@FAX,@EMAIL1,@EMAIL2,@HOMEADDRESS,@REMARK,@CREATEUSER,@CREATETIME,@MODIFIEDUSER,@MODIFIEDTIME,@EMERGUSER,@EMERGPHONE,@EMERGEMAIL,@POSTCODE,@QQ,@MSN,@SIGNATURE,@FINANCESOFTCODE,@IMAGEURL,@SIGNATUREURL");
|
|
strSql.Append(") ");
|
|
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@GID", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@USERID", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@COMPANYNAME", SqlDbType.VarChar,150) ,
|
|
new SqlParameter("@DEPTNAME", SqlDbType.VarChar,100) ,
|
|
new SqlParameter("@OFFICEPHONE", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@HOMEPHONE", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@MOBILE", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@FAX", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@EMAIL1", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@EMAIL2", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@HOMEADDRESS", SqlDbType.VarChar,150) ,
|
|
new SqlParameter("@REMARK", SqlDbType.VarChar,200) ,
|
|
new SqlParameter("@CREATEUSER", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@CREATETIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@MODIFIEDUSER", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@MODIFIEDTIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@EMERGUSER", SqlDbType.VarChar,100) ,
|
|
new SqlParameter("@EMERGPHONE", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@EMERGEMAIL", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@POSTCODE", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@QQ", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@MSN", SqlDbType.VarChar,100) ,
|
|
new SqlParameter("@SIGNATURE", SqlDbType.Image) ,
|
|
new SqlParameter("@FINANCESOFTCODE", SqlDbType.VarChar,20) ,
|
|
new SqlParameter("@IMAGEURL", SqlDbType.VarChar,100) ,
|
|
new SqlParameter("@SIGNATUREURL", SqlDbType.VarChar,100)
|
|
|
|
};
|
|
|
|
parameters[0].Value = model.GID??(Object)DBNull.Value;
|
|
parameters[1].Value = model.USERID??(Object)DBNull.Value;
|
|
parameters[2].Value = model.COMPANYNAME??(Object)DBNull.Value;
|
|
parameters[3].Value = model.DEPTNAME??(Object)DBNull.Value;
|
|
parameters[4].Value = model.OFFICEPHONE??(Object)DBNull.Value;
|
|
parameters[5].Value = model.HOMEPHONE??(Object)DBNull.Value;
|
|
parameters[6].Value = model.MOBILE??(Object)DBNull.Value;
|
|
parameters[7].Value = model.FAX??(Object)DBNull.Value;
|
|
parameters[8].Value = model.EMAIL1??(Object)DBNull.Value;
|
|
parameters[9].Value = model.EMAIL2??(Object)DBNull.Value;
|
|
parameters[10].Value = model.HOMEADDRESS??(Object)DBNull.Value;
|
|
parameters[11].Value = model.REMARK??(Object)DBNull.Value;
|
|
parameters[12].Value = model.CREATEUSER??(Object)DBNull.Value;
|
|
parameters[13].Value = model.CREATETIME??(Object)DBNull.Value;
|
|
parameters[14].Value = model.MODIFIEDUSER??(Object)DBNull.Value;
|
|
parameters[15].Value = model.MODIFIEDTIME??(Object)DBNull.Value;
|
|
parameters[16].Value = model.EMERGUSER??(Object)DBNull.Value;
|
|
parameters[17].Value = model.EMERGPHONE??(Object)DBNull.Value;
|
|
parameters[18].Value = model.EMERGEMAIL??(Object)DBNull.Value;
|
|
parameters[19].Value = model.POSTCODE??(Object)DBNull.Value;
|
|
parameters[20].Value = model.QQ??(Object)DBNull.Value;
|
|
parameters[21].Value = model.MSN??(Object)DBNull.Value;
|
|
parameters[22].Value = model.SIGNATURE??(Object)DBNull.Value;
|
|
parameters[23].Value = model.FINANCESOFTCODE??(Object)DBNull.Value;
|
|
parameters[24].Value = model.IMAGEURL??(Object)DBNull.Value;
|
|
parameters[25].Value = model.SIGNATUREURL??(Object)DBNull.Value;
|
|
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
|
|
}
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public int Update(DSWeb.SoftMng.Model.user_baseinfo model)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("update user_baseinfo set ");
|
|
|
|
strSql.Append(" GID = @GID,");
|
|
strSql.Append(" USERID = @USERID,");
|
|
strSql.Append(" COMPANYNAME = @COMPANYNAME,");
|
|
strSql.Append(" DEPTNAME = @DEPTNAME,");
|
|
strSql.Append(" OFFICEPHONE = @OFFICEPHONE,");
|
|
strSql.Append(" HOMEPHONE = @HOMEPHONE,");
|
|
strSql.Append(" MOBILE = @MOBILE,");
|
|
strSql.Append(" FAX = @FAX,");
|
|
strSql.Append(" EMAIL1 = @EMAIL1,");
|
|
strSql.Append(" EMAIL2 = @EMAIL2,");
|
|
strSql.Append(" HOMEADDRESS = @HOMEADDRESS,");
|
|
strSql.Append(" REMARK = @REMARK,");
|
|
strSql.Append(" CREATEUSER = @CREATEUSER,");
|
|
strSql.Append(" CREATETIME = @CREATETIME,");
|
|
strSql.Append(" MODIFIEDUSER = @MODIFIEDUSER,");
|
|
strSql.Append(" MODIFIEDTIME = @MODIFIEDTIME,");
|
|
strSql.Append(" EMERGUSER = @EMERGUSER,");
|
|
strSql.Append(" EMERGPHONE = @EMERGPHONE,");
|
|
strSql.Append(" EMERGEMAIL = @EMERGEMAIL,");
|
|
strSql.Append(" POSTCODE = @POSTCODE,");
|
|
strSql.Append(" QQ = @QQ,");
|
|
strSql.Append(" MSN = @MSN,");
|
|
strSql.Append(" SIGNATURE = @SIGNATURE,");
|
|
strSql.Append(" FINANCESOFTCODE = @FINANCESOFTCODE,");
|
|
strSql.Append(" IMAGEURL = @IMAGEURL,");
|
|
strSql.Append(" SIGNATUREURL = @SIGNATUREURL");
|
|
strSql.Append(" where GID=@GID ");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@GID", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@USERID", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@COMPANYNAME", SqlDbType.VarChar,150) ,
|
|
new SqlParameter("@DEPTNAME", SqlDbType.VarChar,100) ,
|
|
new SqlParameter("@OFFICEPHONE", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@HOMEPHONE", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@MOBILE", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@FAX", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@EMAIL1", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@EMAIL2", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@HOMEADDRESS", SqlDbType.VarChar,150) ,
|
|
new SqlParameter("@REMARK", SqlDbType.VarChar,200) ,
|
|
new SqlParameter("@CREATEUSER", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@CREATETIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@MODIFIEDUSER", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@MODIFIEDTIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@EMERGUSER", SqlDbType.VarChar,100) ,
|
|
new SqlParameter("@EMERGPHONE", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@EMERGEMAIL", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@POSTCODE", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@QQ", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@MSN", SqlDbType.VarChar,100) ,
|
|
new SqlParameter("@SIGNATURE", SqlDbType.Image) ,
|
|
new SqlParameter("@FINANCESOFTCODE", SqlDbType.VarChar,20) ,
|
|
new SqlParameter("@IMAGEURL", SqlDbType.VarChar,100) ,
|
|
new SqlParameter("@SIGNATUREURL", SqlDbType.VarChar,100)
|
|
};
|
|
|
|
parameters[0].Value = model.GID??(Object)DBNull.Value;
|
|
parameters[1].Value = model.USERID??(Object)DBNull.Value;
|
|
parameters[2].Value = model.COMPANYNAME??(Object)DBNull.Value;
|
|
parameters[3].Value = model.DEPTNAME??(Object)DBNull.Value;
|
|
parameters[4].Value = model.OFFICEPHONE??(Object)DBNull.Value;
|
|
parameters[5].Value = model.HOMEPHONE??(Object)DBNull.Value;
|
|
parameters[6].Value = model.MOBILE??(Object)DBNull.Value;
|
|
parameters[7].Value = model.FAX??(Object)DBNull.Value;
|
|
parameters[8].Value = model.EMAIL1??(Object)DBNull.Value;
|
|
parameters[9].Value = model.EMAIL2??(Object)DBNull.Value;
|
|
parameters[10].Value = model.HOMEADDRESS??(Object)DBNull.Value;
|
|
parameters[11].Value = model.REMARK??(Object)DBNull.Value;
|
|
parameters[12].Value = model.CREATEUSER??(Object)DBNull.Value;
|
|
parameters[13].Value = model.CREATETIME??(Object)DBNull.Value;
|
|
parameters[14].Value = model.MODIFIEDUSER??(Object)DBNull.Value;
|
|
parameters[15].Value = model.MODIFIEDTIME??(Object)DBNull.Value;
|
|
parameters[16].Value = model.EMERGUSER??(Object)DBNull.Value;
|
|
parameters[17].Value = model.EMERGPHONE??(Object)DBNull.Value;
|
|
parameters[18].Value = model.EMERGEMAIL??(Object)DBNull.Value;
|
|
parameters[19].Value = model.POSTCODE??(Object)DBNull.Value;
|
|
parameters[20].Value = model.QQ??(Object)DBNull.Value;
|
|
parameters[21].Value = model.MSN??(Object)DBNull.Value;
|
|
parameters[22].Value = model.SIGNATURE??(Object)DBNull.Value;
|
|
parameters[23].Value = model.FINANCESOFTCODE??(Object)DBNull.Value;
|
|
parameters[24].Value = model.IMAGEURL??(Object)DBNull.Value;
|
|
parameters[25].Value = model.SIGNATUREURL??(Object)DBNull.Value;
|
|
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
|
|
}
|
|
/// <summary>
|
|
/// 删除一条数据
|
|
/// </summary>
|
|
public int Delete(string GID)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("delete from user_baseinfo ");
|
|
strSql.Append(" where GID=@GID ");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@GID", SqlDbType.VarChar,36) };
|
|
parameters[0].Value = GID;
|
|
|
|
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
|
|
}
|
|
/// <summary>
|
|
/// 按条件批量删除
|
|
/// </summary>
|
|
public int DeleteListWhere(string strWhere)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("delete from user_baseinfo ");
|
|
if(strWhere.Trim()!="")
|
|
{
|
|
strSql.Append(" where "+strWhere);
|
|
}
|
|
return DbHelperSQL.ExecuteSql(strSql.ToString());
|
|
}
|
|
/// <summary>
|
|
/// 得到一个对象实体
|
|
/// </summary>
|
|
public DataSet GetModel(string GID)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select GID, USERID, COMPANYNAME, DEPTNAME, OFFICEPHONE, HOMEPHONE, MOBILE, FAX, EMAIL1, EMAIL2, HOMEADDRESS, REMARK, CREATEUSER, CREATETIME, MODIFIEDUSER, MODIFIEDTIME, EMERGUSER, EMERGPHONE, EMERGEMAIL, POSTCODE, QQ, MSN, SIGNATURE, FINANCESOFTCODE, IMAGEURL, SIGNATUREURL ");
|
|
strSql.Append(" from user_baseinfo ");
|
|
strSql.Append(" where GID=@GID ");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@GID", SqlDbType.VarChar,36) };
|
|
parameters[0].Value = GID;
|
|
|
|
DSWeb.SoftMng.Model.user_baseinfo model=new DSWeb.SoftMng.Model.user_baseinfo();
|
|
return DbHelperSQL.Query(strSql.ToString(),parameters);
|
|
}
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public DataSet GetList(string strWhere)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select * ");
|
|
strSql.Append(" FROM user_baseinfo ");
|
|
if(strWhere.Trim()!="")
|
|
{
|
|
strSql.Append(" where "+strWhere);
|
|
}
|
|
return DbHelperSQL.Query(strSql.ToString());
|
|
}
|
|
/// <summary>
|
|
/// 获得前几行数据
|
|
/// </summary>
|
|
public DataSet GetList(int Top,string strWhere,string filedOrder)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select ");
|
|
if(Top>0)
|
|
{
|
|
strSql.Append(" top "+Top.ToString());
|
|
}
|
|
strSql.Append(" * ");
|
|
strSql.Append(" FROM user_baseinfo ");
|
|
if(strWhere.Trim()!="")
|
|
{
|
|
strSql.Append(" where "+strWhere);
|
|
}
|
|
strSql.Append(" order by " + filedOrder);
|
|
return DbHelperSQL.Query(strSql.ToString());
|
|
}
|
|
/// <summary>
|
|
/// 分页获取数据列表
|
|
/// </summary>
|
|
public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
|
|
{
|
|
//动软代码
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("SELECT * FROM ( ");
|
|
strSql.Append(" SELECT ROW_NUMBER() OVER (");
|
|
if (!string.IsNullOrEmpty(orderby.Trim()))
|
|
strSql.Append("order by T." + orderby);
|
|
strSql.Append(")AS Row, T.* from user_baseinfo T ");
|
|
if (!string.IsNullOrEmpty(strWhere.Trim()))
|
|
{
|
|
strSql.Append(" WHERE " + strWhere);
|
|
}
|
|
strSql.Append(" ) TT");
|
|
strSql.AppendFormat(" WHERE TT.Row > {0} and TT.Row <= {1}", startIndex, endIndex);
|
|
//公共代码
|
|
return DbHelperSQL.Query(strSql.ToString());
|
|
}
|
|
/// <summary>
|
|
/// 获取记录总数
|
|
/// </summary>
|
|
public int GetRecordCount(string strWhere)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select count(1) FROM user_baseinfo ");
|
|
if(strWhere.Trim()!="")
|
|
{
|
|
strSql.Append(" where "+strWhere);
|
|
}
|
|
return DbHelperSQL.ExcuteScalarSQL(strSql.ToString());
|
|
}
|
|
}
|
|
}
|