using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data.SqlClient;
|
using System.Data;
|
using SQLHelper;
|
|
namespace DAL
|
{
|
public class ClsUser
|
{
|
ClsCN oCn = new ClsCN();
|
public string UserCode;
|
public string UserName;
|
public string Psd;
|
public bool AddCzymc()
|
{
|
oCn.RunProc("insert into Gy_Czygl(Czybm,Czymc,Czmm) values('" + this.UserCode + "','" +
|
this.UserName + "','" + this.Psd + "')");
|
return true;
|
}
|
public bool DeleteCzymc(string ID)
|
{
|
oCn.RunProc("delete from Gy_Czygl where Czybm='" + ID + "'");
|
return true;
|
}
|
public DataSet GetAllUser()
|
{
|
return (oCn.RunProcReturn("select * from Gy_Czygl", "Gy_Czygl"));
|
}
|
public bool UpdateCzymc(string ID)
|
{
|
oCn.RunProc("update Gy_Czygl set Czymc='" + this.UserName + "',Czmm='" + this.Psd + "' where Czybm='" + ID + "'");
|
return true;
|
}
|
public DataSet CheckCzymc(string sUser, string sPsd)
|
{
|
SqlParameter[] prams ={oCn.MakeInParam("@Czymc",SqlDbType.VarChar,100,sUser ),
|
oCn.MakeInParam("@Czmm",SqlDbType.VarChar ,100,sPsd ),
|
};
|
return oCn.RunProcReturn("select * from Gy_Czygl where Czymc='" + sUser + "' and Czmm='" + sPsd + "' ", prams, "Gy_Czygl");
|
}
|
public DataSet GetUserByMainID(string MainID)
|
{
|
SqlParameter[] prams={oCn.MakeInParam("@MainID",SqlDbType.VarChar,30,MainID)
|
};
|
return (oCn.RunProcReturn("select * from Gy_Czygl where Czybm=@MainID ",prams,"Gy_Czygl"));
|
}
|
|
public bool ChangePsd()
|
{
|
try
|
{
|
oCn.RunProc("update Gy_Czygl set Czmm='" + this.Psd + "' where Czymc='" + this.UserCode + "'");
|
return true;
|
}
|
catch (Exception e)
|
{
|
return false;
|
}
|
}
|
|
public DataSet CheckMainID(string MainID, string sPsd)
|
{
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("select * from Gy_Czygl where Czybm='" + MainID + "' and Czmm='" + sPsd + "' ", "Gy_Czygl");
|
if (DS.Tables[0].Rows.Count == 0)
|
return null;
|
else
|
{
|
return DS;
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
}
|
|
}
|