📄 ghistory.cs
字号:
//======================================================
//== (c)2008 aspxcms inc by NeTCMS v1.0 ==
//== Forum:bbs.aspxcms.com ==
//== Website:www.aspxcms.com ==
//======================================================
using System;
using System.Data;
using System.Data.SqlClient;
using NetCMS.DALFactory;
using NetCMS.Model;
using NetCMS.Common;
using System.Text.RegularExpressions;
using System.Text;
using System.Reflection;
using NetCMS.DALProfile;
using NetCMS.Config;
namespace NetCMS.DALSQLServer
{
public class Ghistory : DbBase, IGhistory
{
public DataTable sel_sysUser(string UserNum,int flag)
{
#region
SqlParameter param = new SqlParameter("@UserNum", UserNum);
string Sql = null;
if (flag == 0)
{
Sql = "Select UserGroupNumber,iPoint,gPoint,SiteID,UserName From " + Pre + "sys_user where UserNum=@UserNum";
}
else if (flag == 1)
{
Sql = "select UserName,PassQuestion,PassKey,Email,UserNum from " + Pre + "sys_User where UserName=@UserNum";
}
else if (flag == 2)
{
Sql = "Select CardNumber,CardPassWord,Money,TimeOutDate,isUse,isLock,isBuy,Point From " + Pre + "user_Card where CardNumber=@UserNum";
}
else if (flag == 3)
{
Sql = "select TopTitle,GoodTitle,CheckTtile,OCTF,DelSelfTitle,DelOTitle,EditSelfTitle,EditOtitle,ReadTitle,GIChange,GTChageRate from " + Pre + "user_Group where GroupNumber=@UserNum";
}
else if (flag == 4)//mycom_Look.aspx
{
Sql = "select Title,Content from " + Pre + "api_commentary where Commid=@UserNum";
}
else if (flag == 5)
{
Sql = "Select ClassCName From " + Pre + "friend_class where ClassID=@UserNum";
}
return DbHelper.ExecuteTable(CommandType.Text, Sql, param);
#endregion
}
public int del_userInfo(string ID,int flag)
{
#region
SqlParameter param = new SqlParameter("@GhID", ID);
string Sql = null;
if (flag == 0)
{
Sql = "delete " + Pre + "user_Ghistory where GhID=@GhID";
}
else if (flag == 1)//collection.aspx
{
Sql = "delete " + Pre + "API_Faviate where FID=@GhID And UserNum='" + NetCMS.Global.Current.UserNum + "'";
}
else if (flag == 2)
{
Sql = "delete " + Pre + "api_commentary where Commid=@GhID";
}
else if (flag == 3)
{
Sql = "delete " + Pre + "user_Ghistory where GhID=@GhID " + NetCMS.Common.Public.getSessionStr() + "";
}
return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, param);
#endregion
}
public int sel_sysUserInfo(string UserNum, string UserPassword)
{
#region
SqlParameter[] param = new SqlParameter[] { new SqlParameter("@UserNum", UserNum), new SqlParameter("@UserPassword", UserPassword) };
int flg = 0;
string Sql = "select ID from " + Pre + "sys_User where UserNum=@UserNum and UserPassword=@UserPassword";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, param);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
flg = 1;
}
dt.Clear(); dt.Dispose();
}
return flg;
#endregion
}
public int update_sysUser(int Money1, string UserNum,int flag)
{
#region
SqlParameter param = new SqlParameter("@UserNum", UserNum);
string Sql = null;
if (flag == 0)
{
Sql = "update " + Pre + "sys_User set gPoint=gPoint+" + Money1 + " where UserNum=@UserNum";
}
else if (flag == 1)
{
Sql = "update " + Pre + "sys_User set iPoint=iPoint+" + Money1 + " where UserNum=@UserNum";
}
return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, param);
#endregion
}
public int update_userInfos(string UserNum, string cnm,int flag)
{
#region
SqlParameter[] param = new SqlParameter[2];
param[0] = new SqlParameter("@UserNum", SqlDbType.NVarChar, 15);
param[0].Value = UserNum;
param[1] = new SqlParameter("@CardNumber", SqlDbType.NVarChar, 32);
param[1].Value = cnm;
string Sql = null;
if (flag == 0)
{
Sql = "update " + Pre + "user_Card set isUse='1',UserNum=@UserNum where CardNumber=@CardNumber";
}
else if (flag == 1)//getPassword.aspx
{
Sql = "update " + Pre + "sys_User set UserPassword=@UserNum where UserNum=@CardNumber";
}
return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, param);
#endregion
}
public bool addTo(string NewsID,int ChID)
{
#region
SqlParameter[] param = new SqlParameter[2];
param[0] = new SqlParameter("@NewsID", SqlDbType.NVarChar, 15);
param[0].Value = NewsID;
param[1] = new SqlParameter("@ChID", SqlDbType.Int, 4);
param[1].Value = ChID;
string gsql = "select count(id) from " + Pre + "API_Faviate where FID=@NewsID and ChID=@ChID And UserNum='" + NetCMS.Global.Current.UserNum + "'";
int i_Count = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, gsql, param));
if (i_Count == 0)
{
string Sql = "insert " + Pre + "API_Faviate(FID,UserNum,CreatTime,APIID,DataLib,ChID) values(@NewsID,'" + NetCMS.Global.Current.UserNum + "','" + DateTime.Now + "','0','',@ChID)";
DbHelper.ExecuteNonQuery(CommandType.Text, Sql, param);
return true;
}
return false;
#endregion
}
#region Exchange.aspx
public int Add(GhistoryInfo Gh, int ghtype, string UserNum, string content)
{
#region
string Sql = "insert into " + Pre + "User_Ghistory(GhID,ghtype,Gpoint,iPoint,Money,CreatTime,UserNUM,gtype,content) values(@GhID,'" + ghtype + "',@Gpoint,@iPoint,0,@CreatTime,@UserNum,3,@content)";
SqlParameter[] parm = GetGhistory(Gh);
int i_length = parm.Length;
Array.Resize<SqlParameter>(ref parm, i_length + 2);
parm[i_length] = new SqlParameter("@UserNum", UserNum);
parm[i_length + 1] = new SqlParameter("@content", content);
return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, parm);
#endregion
}
private SqlParameter[] GetGhistory(GhistoryInfo Gh)
{
#region
SqlParameter[] parm = new SqlParameter[4];
parm[0] = new SqlParameter("@GhID", SqlDbType.NVarChar, 50);
parm[0].Value = Rand.Number(12);
parm[1] = new SqlParameter("@Gpoint", SqlDbType.NVarChar, 50);
parm[1].Value = Gh.Gpoint;
parm[2] = new SqlParameter("@iPoint", SqlDbType.NVarChar, 50);
parm[2].Value = Gh.iPoint;
parm[3] = new SqlParameter("@CreatTime", SqlDbType.DateTime);
parm[3].Value = DateTime.Now;
return parm;
#endregion
}
#endregion
public int sel_userCardInfo(string cnm)
{
#region
SqlParameter param = new SqlParameter("@CardNumber", cnm);
int flg = 0;
string Sql = "Select isUse From " + Pre + "user_Card where CardNumber=@CardNumber";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, param);
if (dt != null && dt.Rows.Count > 0)
{
flg = int.Parse(dt.Rows[0]["isUse"].ToString());
dt.Clear(); dt.Dispose();
}
return flg;
#endregion
}
public int sel_sysPramUser()
{
#region
int flg = 0;
string Sql = "select GhClass from " + Pre + "sys_PramUser";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, null);
if (dt != null && dt.Rows.Count > 0)
{
flg = int.Parse(dt.Rows[0]["GhClass"].ToString());
dt.Clear(); dt.Dispose();
}
return flg;
#endregion
}
public int add_userGhistory(string GhID, string UserNum, int Gpoint, int Money, DateTime CreatTime, string content)
{
#region
SqlParameter[] param = new SqlParameter[3];
param[0] = new SqlParameter("@GhID", SqlDbType.NVarChar, 12);
param[0].Value = GhID;
param[1] = new SqlParameter("@UserNum", SqlDbType.NVarChar, 15);
param[1].Value = UserNum;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -