using System;
|
|
using System.Data.OracleClient;
|
|
namespace CCSTrace.CCS.Object
|
{
|
public class LocateEquipment
|
{
|
private int _caseId = 0;
|
private int _dsUfid = -1;
|
private int _fsc = 0;
|
private int _ufid = 0;
|
private string _fdr = "";
|
private string _tpclid = "";
|
|
public LocateEquipment(int mCaseId, bool hasData, OracleConnection conn, OracleTransaction transaction)
|
{
|
string sqlStmt;
|
OracleCommand command = null;
|
OracleDataReader reader = null;
|
|
SetCaseId(mCaseId);
|
|
try
|
{
|
if (hasData)
|
{
|
sqlStmt = "SELECT DSUFID,FSC,UFID,FDR,TPCLID FROM EOS.EVENTRECORD_EX WHERE CASEID = " + mCaseId;
|
|
command = new OracleCommand(sqlStmt, conn, transaction);
|
reader = command.ExecuteReader();
|
|
if (reader.Read())
|
{
|
SetDsufid(Convert.ToInt32(reader["DSUFID"].ToString()));
|
SetFsc(Convert.ToInt32(reader["FSC"].ToString()));
|
SetUfid(Convert.ToInt32(reader["UFID"].ToString()));
|
SetFdr(reader["FDR"].ToString());
|
SetTpclid(reader["TPCLID"].ToString());
|
}
|
}
|
else
|
{
|
sqlStmt = "SELECT UFID FROM EOS.DISASTER_EX WHERE ISDISASTER = " + GlobalVariable.IsDisaster;
|
|
command = new OracleCommand(sqlStmt, conn, transaction);
|
reader = command.ExecuteReader();
|
|
if (reader.Read())
|
SetDsufid(Convert.ToInt32(reader["UFID"].ToString()));
|
}
|
}
|
catch (Exception e)
|
{
|
Console.WriteLine(e.Message);
|
Console.WriteLine(e.StackTrace);
|
}
|
finally
|
{
|
reader.Close();
|
command.Dispose();
|
}
|
}
|
|
public int GetCaseId()
|
{
|
return _caseId;
|
}
|
|
public void SetCaseId(int mCaseId)
|
{
|
_caseId = mCaseId;
|
}
|
|
public int GetDsufid()
|
{
|
return _dsUfid;
|
}
|
|
public void SetDsufid(int mDsUfid)
|
{
|
_dsUfid = mDsUfid;
|
}
|
|
public int GetFsc()
|
{
|
return _fsc;
|
}
|
|
public void SetFsc(int mFsc)
|
{
|
_fsc = mFsc;
|
}
|
|
public int GetUfid()
|
{
|
return _ufid;
|
}
|
|
public void SetUfid(int mUfid)
|
{
|
_ufid = mUfid;
|
}
|
|
public string GetFdr()
|
{
|
return _fdr;
|
}
|
|
public void SetFdr(string mFdr)
|
{
|
_fdr = mFdr;
|
}
|
|
public string GetTpclid()
|
{
|
return _tpclid;
|
}
|
|
public void SetTpclid(string mTpclid)
|
{
|
_tpclid = mTpclid;
|
}
|
|
public string GetSqlStmt()
|
{
|
string sqlStmt;
|
|
sqlStmt = "INSERT INTO EOS.EVENTRECORD_EX (CASEID,DSUFID,FSC,UFID,TPCLID,FDR) VALUES(" + GetCaseId() + "," + GetDsufid() + "," + GetFsc()
|
+ "," + GetUfid() + ",'" + GetTpclid() + "','" + GetFdr() + "')";
|
return sqlStmt;
|
}
|
|
//public String getUpdateSqlStmt()
|
//{
|
// String SqlStmt;
|
|
// SqlStmt = "UPDATE EOS.EVENTRECORD_EX SET DSUFID = " + getDSUFID() + ",FSC = " + getFSC() + ",UFID = " + getUFID() + ",TPCLID = '"
|
// + getTPCLID() + "',FDR = '" + getFDR() + "' WHERE CASEID = " + getCaseID();
|
|
// return SqlStmt;
|
//}
|
}
|
}
|