...
This commit is contained in:
@@ -39,8 +39,7 @@ namespace Project
|
||||
sendmailchecktime = DateTime.Now;
|
||||
bool retval = false;
|
||||
var sql = "select wdate from EETGW_ServerSetting" +
|
||||
" where gcode = @gcode " +
|
||||
" and active = 1" +
|
||||
" where active = 1" +
|
||||
" order by wdate desc";
|
||||
var cn = new SqlConnection(Properties.Settings.Default.gwcs);
|
||||
cn.Open();
|
||||
@@ -68,10 +67,26 @@ namespace Project
|
||||
{
|
||||
//이 사용자가 나인지 체크한다
|
||||
cmd.CommandText = sql = "select wuid from EETGW_ServerSetting" +
|
||||
" where gcode = @gcode " +
|
||||
" and active = 1" +
|
||||
" where active = 1" +
|
||||
" order by wdate desc";
|
||||
var uid = cmd.ExecuteScalar();
|
||||
var uid = string.Empty;// cmd.ExecuteScalar();
|
||||
var dar2 = cmd.ExecuteReader();
|
||||
while(dar2.Read())
|
||||
{
|
||||
var v = dar2[0];
|
||||
var id = string.Empty;
|
||||
if (v != null) id = v.ToString();
|
||||
if (uid.isEmpty()) uid = id; //값이 비어있다면 추가한다
|
||||
|
||||
//현재 루프되는 id값이 로그인id와 같다면 그것을 우선 처리한다
|
||||
if (id.Equals(FCOMMON.info.Login.no))
|
||||
{
|
||||
uid = id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dar2.Close();
|
||||
|
||||
if(uid.ToString().Equals(FCOMMON.info.Login.no))
|
||||
{
|
||||
//아직 10분전이므로 정상이다
|
||||
@@ -84,11 +99,11 @@ namespace Project
|
||||
cmd.Parameters.Add("wuid", System.Data.SqlDbType.VarChar).Value = FCOMMON.info.Login.no;
|
||||
|
||||
//기존데이터를 비활성화
|
||||
cmd.CommandText = "update EETGW_ServerSetting set active=0 where gcode =@gcode and active=1 and wuid <> @wuid ";
|
||||
cmd.CommandText = "update EETGW_ServerSetting set active=0 where active=1 and wuid <> @wuid ";
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
//내 데이터를 활성화
|
||||
cmd.CommandText = "update EETGW_ServerSetting set wdate = getdate() where gcode = @gcode and wuid = @wuid and active=1";
|
||||
cmd.CommandText = "update EETGW_ServerSetting set wdate = getdate() where wuid = @wuid and active=1";
|
||||
var cnt = cmd.ExecuteNonQuery();
|
||||
}
|
||||
retval = true;
|
||||
@@ -101,7 +116,7 @@ namespace Project
|
||||
else
|
||||
{
|
||||
//10분넘었으니 다시 생성한다
|
||||
cmd.CommandText = "update EETGW_ServerSetting set active=0 where gcode =@gcode and active=1";
|
||||
cmd.CommandText = $"update EETGW_ServerSetting set active=0 where active=1 and wuid <> '{FCOMMON.info.Login.no}'";
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.CommandText = "insert into EETGW_ServerSetting(gcode,active,wuid,wdate) values(@gcode,1,@wuid,GETDATE())";
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
Reference in New Issue
Block a user