📄 operationcenter.cs
字号:
_MessageList.AddAnEntity(t_JE);
}
catch (Exception e)
{
NewControl.JPM_List_Entity t_JE = new NewControl.JPM_List_Entity();
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.BMP_DATAERR);
t_JE.Add(Convert.ToString(SERVER_UID));
t_JE.Add(System.DateTime.Now.ToString());
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.STR_MSGTYPE_DATA);
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.STR_MSGCONTENT_FAILCLOSEDATA + e.Message);
_MessageList.AddAnEntity(t_JE);
}
}
public static bool ReloadData()
{
try
{
if (_dataConnection != null && _dataConnection.State == System.Data.ConnectionState.Connecting)
{
_dataConnection.Close();
_dataConnection.Dispose();
_dataConnection = null;
}
_dataConnection = new SqlConnection();
NewControl.JPM_List_Entity t_JE;
_dataConnection.ConnectionString = "SERVER=Localhost;DATABASE=LabLT;UID=mda_LabLT;PWD=1133";
_dataConnection.Open();
_dataAdpter = new SqlDataAdapter("SELECT FLD_UID,FLD_ACCOUNT,FLD_PASSWORD,FLD_NICKNAME,FLD_HEADPIC,FLD_MYSHOW,FLD_SEX,FLD_BIRTHDAY,FLD_BEWRITE,FLD_OPENTIME,FLD_LASTTIME,FLD_LASTIP,FLD_LASTPORT,FLD_STATE FROM TBL_Account", _dataConnection);
if (_dsetUsers.Tables[0] != null)
{
_dsetUsers.Tables[0].Rows.Clear();
}
_dataAdpter.Fill(_dsetUsers, DATASET_TABLE_USERS);
if (_UserList != null)
{
int t_c;
t_c = _dsetUsers.Tables[0].Rows.Count;
_UserList.Clear();
if (t_c > 0)
{
int t_n;
System.Data.DataRowCollection t_Rows;
System.Data.DataRow t_CRow;
t_Rows = _dsetUsers.Tables[0].Rows;
for (t_n = 0; t_n < t_c; t_n++)
{
t_CRow = t_Rows[t_n];
t_JE = new NewControl.JPM_List_Entity();
t_JE.Add(_HeadImagesList.Images[(int)t_CRow[4]]);
t_JE.Add(Convert.ToString(t_CRow[0]));
t_JE.Add((string)t_CRow[3]);
t_JE.Add((string)t_CRow[1]);
t_JE.Add((string)t_CRow[8]);
t_JE.Add(Convert.ToString(t_CRow[13]));
_UserList.AddAnEntity(t_JE);
}
}
}
t_JE = new NewControl.JPM_List_Entity();
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.BMP_RESETDATA);
t_JE.Add(Convert.ToString(SERVER_UID));
t_JE.Add(System.DateTime.Now.ToString());
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.STR_MSGTYPE_SYSTEM);
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.STR_MSGCONTENT_COMRESETDATA);
_MessageList.AddAnEntity(t_JE);
return true;
}
catch (Exception e)
{
NewControl.JPM_List_Entity t_JE = new NewControl.JPM_List_Entity();
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.BMP_DATAERR);
t_JE.Add(Convert.ToString(SERVER_UID));
t_JE.Add(System.DateTime.Now.ToString());
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.STR_MSGTYPE_SYSTEM);
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.STR_MSGCONTENT_FAILRESETDATA + e.Message);
_MessageList.AddAnEntity(t_JE);
}
return false;
}
///<summary>
/// Currency operation
///</summary>
public static bool RegisterUser(icUser theUser)
{
if (LoadData() == false)
{
return false;
}
int t_n, t_c;
System.Data.DataRowCollection t_Rows = _dsetUsers.Tables[0].Rows;
t_c = t_Rows.Count;
for (t_n = 0; t_n < t_c; t_n++)
{
if ((string)t_Rows[t_n][1] == theUser._account)
{
return false;
}
}
System.Data.DataRow t_CRow = _dsetUsers.Tables[0].NewRow();
NewControl.JPM_List_Entity t_JE = new NewControl.JPM_List_Entity();
try
{
if (_dsetUsers.Tables[0] != null)
{
///FLD_UID,FLD_ACCOUNT,FLD_PASSWORD,FLD_NICKNAME
///FLD_HEADPIC,FLD_MYSHOW,FLD_SEX,FLD_BIRTHDAY
///FLD_BEWRITE,FLD_OPENTIME,FLD_LASTTIME,FLD_LASTIP
///FLD_LASTPORT,FLD_STATE
t_Rows = _dsetUsers.Tables[0].Rows;
theUser._uID = (int)t_Rows[t_Rows.Count - 1][0] + 1;
t_CRow[0] = theUser._uID;
t_CRow[1] = theUser._account;
t_CRow[2] = theUser._password;
t_CRow[3] = theUser._nickName;
t_CRow[4] = theUser._headPic;
t_CRow[5] = theUser._myShow;
t_CRow[6] = theUser._sex;
t_CRow[7] = theUser._birthDay;
t_CRow[8] = theUser._bewrite;
t_CRow[9] = theUser._openTime;
t_CRow[10] = theUser._lastTime;
t_CRow[11] = theUser._lastIP;
t_CRow[12] = theUser._lastPort;
t_CRow[13] = USER_STATE_NORMAL;
_dsetUsers.Tables[0].Rows.Add(t_CRow);
string t_str = "INSERT INTO TBL_Account (FLD_UID,FLD_ACCOUNT,FLD_PASSWORD,FLD_NICKNAME,FLD_HEADPIC,FLD_MYSHOW,FLD_SEX,FLD_BIRTHDAY,FLD_BEWRITE,FLD_OPENTIME,FLD_LASTTIME,FLD_LASTIP,FLD_LASTPORT,FLD_STATE) VALUES(" +
theUser._uID + ",'" + theUser._account + "','" + theUser._password + "','" + theUser._nickName + "'," + theUser._headPic + "," + theUser._myShow + "," +
theUser._sex + ",'" + theUser._birthDay + "','" + theUser._bewrite + "','" + theUser._openTime + "','" + theUser._lastTime + "','" +
theUser._lastIP + "'," + theUser._lastPort + ",'c')";
_dataAdpter.InsertCommand = new SqlCommand(t_str, _dataConnection);
_dataAdpter.Update(_dsetUsers.Tables[0]);
t_JE.Add(_HeadImagesList.Images[(int)t_CRow[4]]);
t_JE.Add(Convert.ToString(t_CRow[0]));
t_JE.Add((string)t_CRow[3]);
t_JE.Add((string)t_CRow[1]);
t_JE.Add((string)t_CRow[8]);
t_JE.Add(Convert.ToString(t_CRow[13]));
_UserList.AddAnEntity(t_JE);
return true;
}
}
catch (Exception e)
{
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.BMP_DATAERR);
t_JE.Add(Convert.ToString(MESSAGE_UID_SERVER));
t_JE.Add(System.DateTime.Now.ToString());
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.STR_MSGTYPE_SYSTEM);
t_JE.Add(global::JPMLab_LanTalker_Server.Properties.Resources.STR_MSGCONTENT_DATAERR + e.Message);
_MessageList.AddAnEntity(t_JE);
}
return false;
}
public static char UserLogin(string Acc, string Pwd, string IP, int Port, ref icUser theUser)
{
if (LoadData() == false)
{
return LOGIN_RESULT_EACCOUNT;
}
else if (_dsetUsers.Tables.Count > 0)
{
int t_n, t_c;
char t_s;
System.Data.DataRowCollection t_Rows = _dsetUsers.Tables[0].Rows;
System.Data.DataRow t_CRow;
t_c = t_Rows.Count;
for (t_n = 0; t_n < t_c; t_n++)
{
t_CRow = t_Rows[t_n];
if ((string)t_CRow[1] == Acc)
{
if ((string)t_CRow[2] == Pwd)
{
t_s = Convert.ToChar(t_CRow[13]);
if (t_s == USER_STATE_STOP)
{
return LOGIN_RESULT_STOP;
}
else if (t_s == LOGIN_RESULT_HOT)
{
return LOGIN_RESULT_HOT;
}
t_CRow[10] = System.DateTime.Now.ToString();
t_CRow[11] = IP;
t_CRow[12] = Port;
t_CRow[13] = USER_STATE_HOT;
//FLD_UID,FLD_ACCOUNT,FLD_PASSWORD
//FLD_NICKNAME,FLD_HEADPIC,FLD_MYSHOW
//FLD_SEX,FLD_BIRTHDAY,FLD_BEWRITE
//FLD_OPENTIME,FLD_LASTTIME,FLD_LASTIP
//FLD_LASTPORT
System.DBNull t_DBNULL = System.DBNull.Value;
theUser._uID = (int)t_CRow[0];
theUser._account = (string)t_CRow[1];
theUser._password = (string)t_CRow[2];
theUser._nickName = (string)t_CRow[3];
theUser._headPic = (int)t_CRow[4];
theUser._myShow = (int)t_CRow[5];
theUser._sex = (int)t_CRow[6];
if (t_CRow[7] != t_DBNULL)
{
theUser._birthDay = (string)t_CRow[7];
}
else
{
theUser._birthDay = "";
}
if (t_CRow[8] != t_DBNULL)
{
theUser._bewrite = (string)t_CRow[8];
}
else
{
theUser._bewrite = "";
}
if (t_CRow[9] != t_DBNULL)
{
theUser._openTime = (string)t_CRow[9];
}
else
{
theUser._openTime = "";
}
if (t_CRow[10] != t_DBNULL)
{
theUser._lastTime = (string)t_CRow[10];
}
else
{
theUser._lastTime = "";
}
if (t_CRow[11] != t_DBNULL)
{
theUser._lastIP = (string)t_CRow[11];
}
else
{
theUser._lastIP = "";
}
if (t_CRow[12] != t_DBNULL)
{
theUser._lastPort = (int)t_CRow[12];
}
else
{
theUser._lastPort = 0;
}
_dataAdpter.UpdateCommand = new SqlCommand("UPDATE TBL_Account SET FLD_STATE= '" + USER_STATE_HOT + "' WHERE FLD_UID=" + theUser._uID, _dataConnection);
_dataAdpter.Update(_dsetUsers.Tables[0]);
return LOGIN_RESULT_COMLETE;
}
else
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -