1 files deleted
4 files added
3 files renamed
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | |
| | | <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> |
| | | <session-factory> |
| | | <property name="connection.provider"> |
| | | NHibernate.Connection.DriverConnectionProvider |
| | | </property> |
| | | <property name="connection.driver_class"> |
| | | NHibernate.Driver.OracleClientDriver |
| | | </property> |
| | | <property name="connection.connection_string"> |
| | | <!--Server=(local);database=LocalDatabase;Integrated Security=SSPI;--> |
| | | </property> |
| | | <property name="dialect"> |
| | | NHibernate.Dialect.Oracle10gDialect |
| | | </property> |
| | | </session-factory> |
| | | </hibernate-configuration> |
New file |
| | |
| | | <StyleCopSettings Version="105" /> |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Web; |
| | | using NHibernate; |
| | | using NHibernate.Cfg; |
| | | |
| | | namespace CCSTrace.CCS |
| | | { |
| | | public class NHibertnateSession |
| | | { |
| | | public static NHibertnateSession Instance { get; } = new NHibertnateSession(); |
| | | |
| | | private string _configurationPath = null; |
| | | private ISessionFactory _sessionFactory = null; |
| | | |
| | | public string ConfigurationPath |
| | | { |
| | | get { return _configurationPath; } |
| | | set { _configurationPath = value; } |
| | | } |
| | | |
| | | public ISessionFactory SessionFactory |
| | | { |
| | | get { return _sessionFactory; } |
| | | set { _sessionFactory = value; } |
| | | } |
| | | |
| | | public NHibertnateSession() |
| | | { |
| | | } |
| | | |
| | | public NHibertnateSession(string configurationPath) |
| | | { |
| | | _configurationPath = configurationPath; |
| | | } |
| | | |
| | | public void DefaultInitialize() |
| | | { |
| | | if (_configurationPath == null) |
| | | _configurationPath = HttpContext.Current.Server.MapPath(@"~\DMMSNHibernate.cfg.xml"); |
| | | var configuration = new Configuration(); |
| | | if (_configurationPath != null) |
| | | configuration.Configure(_configurationPath); |
| | | configuration.SetProperty("connection.connection_string", GlobalVariable.ConnectionString); |
| | | |
| | | configuration.AddAssembly("CCSTrace"); |
| | | /* |
| | | var mappingConfigurationFile = HttpContext.Current.Server.MapPath(@"~\TPower\DMMS\Model\ADDRCONTRAST.hbm.xml"); |
| | | configuration.AddFile(mappingConfigurationFile); |
| | | */ |
| | | _sessionFactory = configuration.BuildSessionFactory(); |
| | | } |
| | | |
| | | |
| | | public ISession OpenSession() |
| | | { |
| | | return _sessionFactory?.OpenSession(); |
| | | } |
| | | public ISession OpenSession(IDbConnection connection) |
| | | { |
| | | return _sessionFactory?.OpenSession(connection); |
| | | } |
| | | } |
| | | } |
File was renamed from CCSTrace/CCS/Object/EventQuery.cs |
| | |
| | | using System;
|
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class EventQuery
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | | |
| | | //private CCS.Function.TransferDate convert = new CCS.Function.TransferDate();
|
| | |
|
| | | public string CcsId { get; set; }
|
| | |
|
| | | public string Meter { get; set; }
|
| | |
|
| | | public int CaseStatus { get; set; }
|
| | |
|
| | | public string ChangeTime { get; set; }
|
| | |
|
| | | public string HandlingSummary { get; set; }
|
| | |
|
| | | public string AssumedTime { get; set; }
|
| | |
|
| | | public string AssumedTimeNth { get; set; }
|
| | |
|
| | | public int DelayTimes { get; set; } = 0;
|
| | |
|
| | | public string Reason { get; set; }
|
| | |
|
| | | public string EventLocation { get; set; } = "";
|
| | |
|
| | | public bool Insert(OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | string sqlStmt;
|
| | |
|
| | | if (!Check())
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (Meter == null)
|
| | | {
|
| | | sqlStmt =
|
| | | "INSERT INTO CCS.EVENTQUERY (CCSID,CASESTATUS,CHANGETIME,ASSUMEDTIME,ASSUMEDTIME_NTH,DELAYTIMES,REASON,INPUTTIME) values(" +
|
| | | "'" + CcsId
|
| | | + "'," + CaseStatus + ",to_date('" + ChangeTime + "','yyyy/mm/dd hh24:mi:ss'),to_date('"
|
| | | + AssumedTime + "','yyyy/mm/dd hh24:mi:ss'),to_date('" + AssumedTimeNth +
|
| | | "','yyyy/mm/dd hh24:mi:ss')," + DelayTimes + ",'" + Reason + "',SYSDATE)";
|
| | | }
|
| | | else
|
| | | {
|
| | | sqlStmt =
|
| | | "INSERT INTO CCS.EVENTQUERY (CCSID,METER,CASESTATUS,CHANGETIME,ASSUMEDTIME,ASSUMEDTIME_NTH,DELAYTIMES,REASON,INPUTTIME) values(" +
|
| | | "'"
|
| | | + CcsId + "','" + Meter + "'," + CaseStatus + ",to_date('" + ChangeTime +
|
| | | "','yyyy/mm/dd hh24:mi:ss'),to_date('" + AssumedTime + "','yyyy/mm/dd hh24:mi:ss'),to_date('"
|
| | | + AssumedTimeNth + "','yyyy/mm/dd hh24:mi:ss')," + DelayTimes + ",'" + Reason + "',SYSDATE)";
|
| | | }
|
| | |
|
| | | var command = new OracleCommand(sqlStmt, conn, transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (command.ExecuteNonQuery() > 0)
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Logger.Error(e, e.Message);
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | public bool Update(OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | if (!Check())
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | var sqlStmt = "UPDATE CCS.EVENTQUERY SET CASESTATUS=" + CaseStatus + ",CHANGETIME=to_date('"
|
| | | + ChangeTime + "','yyyy/mm/dd hh24:mi:ss'),ASSUMEDTIME=to_date('"
|
| | | + AssumedTime + "','yyyy/mm/dd hh24:mi:ss'),ASSUMEDTIME_NTH=to_date('"
|
| | | + AssumedTimeNth + "','yyyy/mm/dd hh24:mi:ss'),DELAYTIMES=" + DelayTimes + ",REASON='"
|
| | | + Reason + "',EVENTLOCATION ='" + EventLocation + "' WHERE CCSID='" + CcsId + "'";
|
| | |
|
| | | var command = new OracleCommand(sqlStmt, conn, transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | Logger.Error("更新CCS.EVENTQUERY資料失敗.");
|
| | | return false;
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Logger.Error(e, e.Message);
|
| | | return false;
|
| | | }
|
| | | finally
|
| | | {
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | public bool UpdateCaseStatus(OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | var sqlStmt = "UPDATE CCS.EVENTQUERY SET CASESTATUS = " + CaseStatus + " WHERE CCSID = '" + CcsId + "'";
|
| | |
|
| | | var command = new OracleCommand(sqlStmt, conn, transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | Logger.Error("更新CCS.EVENTQUERY的CASESTATUS失敗.");
|
| | | return false;
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Logger.Error(e, e.Message);
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | // Not Null Check
|
| | | private bool Check()
|
| | | {
|
| | | if (CcsId == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (CaseStatus == 0)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | Reason = Reason ?? "";
|
| | | return true;
|
| | | }
|
| | | }
|
| | | using System; |
| | | using System.Data.OracleClient; |
| | | using NLog; |
| | | |
| | | namespace CCSTrace.CCS.Object |
| | | { |
| | | public class CCSEventQuery |
| | | { |
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); |
| | | |
| | | //private CCS.Function.TransferDate convert = new CCS.Function.TransferDate(); |
| | | |
| | | public string CcsId { get; set; } |
| | | |
| | | public string Meter { get; set; } |
| | | |
| | | public int CaseStatus { get; set; } |
| | | |
| | | public string ChangeTime { get; set; } |
| | | |
| | | public string HandlingSummary { get; set; } |
| | | |
| | | public string AssumedTime { get; set; } |
| | | |
| | | public string AssumedTimeNth { get; set; } |
| | | |
| | | public int DelayTimes { get; set; } = 0; |
| | | |
| | | public string Reason { get; set; } |
| | | |
| | | public string EventLocation { get; set; } = ""; |
| | | |
| | | public bool Insert(OracleConnection conn, OracleTransaction transaction) |
| | | { |
| | | string sqlStmt; |
| | | |
| | | if (!Check()) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (Meter == null) |
| | | { |
| | | sqlStmt = |
| | | "INSERT INTO CCS.EVENTQUERY " + |
| | | "(CCSID,CASESTATUS,CHANGETIME,ASSUMEDTIME,ASSUMEDTIME_NTH,DELAYTIMES,REASON,INPUTTIME) " + |
| | | "VALUES (" + |
| | | "'" + CcsId |
| | | + "'," + CaseStatus + ",to_date('" + ChangeTime + "','yyyy/mm/dd hh24:mi:ss'),to_date('" |
| | | + AssumedTime + "','yyyy/mm/dd hh24:mi:ss'),to_date('" + AssumedTimeNth + |
| | | "','yyyy/mm/dd hh24:mi:ss')," + DelayTimes + ",'" + Reason + "',SYSDATE)"; |
| | | } |
| | | else |
| | | { |
| | | sqlStmt = |
| | | "INSERT INTO CCS.EVENTQUERY (CCSID,METER,CASESTATUS,CHANGETIME,ASSUMEDTIME,ASSUMEDTIME_NTH,DELAYTIMES,REASON,INPUTTIME) values(" + |
| | | "'" |
| | | + CcsId + "','" + Meter + "'," + CaseStatus + ",to_date('" + ChangeTime + |
| | | "','yyyy/mm/dd hh24:mi:ss'),to_date('" + AssumedTime + "','yyyy/mm/dd hh24:mi:ss'),to_date('" |
| | | + AssumedTimeNth + "','yyyy/mm/dd hh24:mi:ss')," + DelayTimes + ",'" + Reason + "',SYSDATE)"; |
| | | } |
| | | |
| | | var command = new OracleCommand(sqlStmt, conn, transaction); |
| | | |
| | | try |
| | | { |
| | | if (command.ExecuteNonQuery() > 0) |
| | | return true; |
| | | else |
| | | return false; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Logger.Error(e, e.Message); |
| | | throw; |
| | | } |
| | | finally |
| | | { |
| | | command.Dispose(); |
| | | } |
| | | } |
| | | |
| | | public bool Update(OracleConnection conn, OracleTransaction transaction) |
| | | { |
| | | if (!Check()) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | var sqlStmt = "UPDATE CCS.EVENTQUERY SET CASESTATUS=" + CaseStatus + ",CHANGETIME=to_date('" |
| | | + ChangeTime + "','yyyy/mm/dd hh24:mi:ss'),ASSUMEDTIME=to_date('" |
| | | + AssumedTime + "','yyyy/mm/dd hh24:mi:ss'),ASSUMEDTIME_NTH=to_date('" |
| | | + AssumedTimeNth + "','yyyy/mm/dd hh24:mi:ss'),DELAYTIMES=" + DelayTimes + ",REASON='" |
| | | + Reason + "',EVENTLOCATION ='" + EventLocation + "' WHERE CCSID='" + CcsId + "'"; |
| | | |
| | | var command = new OracleCommand(sqlStmt, conn, transaction); |
| | | |
| | | try |
| | | { |
| | | if (command.ExecuteNonQuery() <= 0) |
| | | { |
| | | Logger.Error("更新CCS.EVENTQUERY資料失敗."); |
| | | return false; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Logger.Error(e, e.Message); |
| | | return false; |
| | | } |
| | | finally |
| | | { |
| | | command.Dispose(); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | public bool UpdateCaseStatus(OracleConnection conn, OracleTransaction transaction) |
| | | { |
| | | var sqlStmt = "UPDATE CCS.EVENTQUERY SET CASESTATUS = " + CaseStatus + " WHERE CCSID = '" + CcsId + "'"; |
| | | var command = new OracleCommand(sqlStmt, conn, transaction); |
| | | |
| | | try |
| | | { |
| | | if (command.ExecuteNonQuery() <= 0) |
| | | { |
| | | Logger.Error("更新CCS.EVENTQUERY的CASESTATUS失敗."); |
| | | return false; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Logger.Error(e, e.Message); |
| | | throw; |
| | | } |
| | | finally |
| | | { |
| | | command.Dispose(); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | // Not Null Check |
| | | private bool Check() |
| | | { |
| | | if (CcsId == null) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (CaseStatus == 0) |
| | | { |
| | | return false; |
| | | } |
| | | Reason = Reason ?? ""; |
| | | return true; |
| | | } |
| | | } |
| | | } |
File was renamed from CCSTrace/CCS/Object/CCSRecord.cs |
| | |
| | | using System;
|
| | |
|
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class CcsRecord
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private readonly string _meter;
|
| | | private readonly string _customerName;
|
| | | private readonly string _customerTel;
|
| | | private readonly string _addrCity;
|
| | | private readonly string _addrTown;
|
| | | private readonly string _addrRoad;
|
| | | private readonly string _addrOther;
|
| | | private readonly string _recallName;
|
| | | private readonly string _recallTel;
|
| | | private readonly int _eventBrief;
|
| | | private readonly string _acceptTime;
|
| | | private readonly string _ccsid;
|
| | | private readonly int _importCase;
|
| | | private readonly string _dept;
|
| | | private readonly int _partHicustomer;
|
| | | private readonly string _note;
|
| | |
|
| | | public CcsRecord(string ccsid, string meter, string customername, string customertel, string addrCity, string addrTown, string addrRoad,
|
| | | string addrOther, string recallname, string recalltel, int eventbrief, string accepttime, int importcase, string dept,
|
| | | int partHicustomer, string note)
|
| | | {
|
| | | _meter = meter;
|
| | | _customerName = customername;
|
| | | _customerTel = customertel;
|
| | | _addrCity = addrCity;
|
| | | _addrTown = addrTown;
|
| | | _addrRoad = addrRoad;
|
| | | _addrOther = addrOther;
|
| | | _recallName = recallname;
|
| | | _recallTel = recalltel;
|
| | | _eventBrief = eventbrief; ;
|
| | | _ccsid = ccsid;
|
| | | _importCase = importcase;
|
| | | _dept = dept;
|
| | | _note = note;
|
| | | _partHicustomer = partHicustomer;
|
| | | _acceptTime = accepttime;
|
| | | }
|
| | |
|
| | | public CcsRecord(string ccsid, OracleConnection connectionTpc)
|
| | | {
|
| | | var sqlStmt = "SELECT METER,CUSTOMERNAME,CUSTOMERTEL,ADDR_CITY,ADDR_TOWN,ADDR_ROAD,ADDR_OTHER,RECALLNAME,RECALLTEL,EVENTBRIEF,"
|
| | | + "TO_CHAR(ACCEPTTIME,'YYYY/MM/DD HH24:MI:SS') as ACCEPTTIME,CCSID,IMPORTCASE,DEPT,PARTHICUSTOMER,NOTE FROM CCS.EVENTRECORD "
|
| | | + "WHERE CCSID = '" + ccsid + "'";
|
| | |
|
| | | OracleCommand command = new OracleCommand(sqlStmt, connectionTpc);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | while (reader.Read())
|
| | | {
|
| | | _meter = reader["METER"].ToString();
|
| | | _customerName = reader["CUSTOMERNAME"].ToString();
|
| | | _customerTel = reader["CUSTOMERTEL"].ToString();
|
| | | _addrCity = reader["ADDR_CITY"].ToString();
|
| | | _addrTown = reader["ADDR_TOWN"].ToString();
|
| | | _addrRoad = reader["ADDR_ROAD"].ToString();
|
| | | _addrOther = reader["ADDR_OTHER"].ToString();
|
| | | _recallName = reader["RECALLNAME"].ToString();
|
| | | _recallTel = reader["RECALLTEL"].ToString();
|
| | | _eventBrief = int.Parse(reader["EVENTBRIEF"].ToString());
|
| | | _acceptTime = reader["ACCEPTTIME"].ToString();
|
| | | _ccsid = reader["CCSID"].ToString();
|
| | | _importCase = int.Parse(reader["IMPORTCASE"].ToString());
|
| | | _dept = reader["DEPT"].ToString();
|
| | | _partHicustomer = int.Parse(reader["PARTHICUSTOMER"].ToString());
|
| | | _note = reader["NOTE"].ToString();
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Logger.Error(e, "無法取得CCS報案資訊!" + e.Message);
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | public string Meter => _meter;
|
| | |
|
| | | public string CustomerName => _customerName;
|
| | |
|
| | | public string CustomerTel => _customerTel;
|
| | |
|
| | | public string AddressCity => _addrCity;
|
| | |
|
| | | public string AddressTown => _addrTown;
|
| | |
|
| | | public string AddressRoad => _addrRoad;
|
| | |
|
| | | public string AddressOther => _addrOther;
|
| | |
|
| | | public string RecallTel => _recallTel;
|
| | |
|
| | | public string RecallName => _recallName;
|
| | |
|
| | | public int EventBrief => _eventBrief;
|
| | |
|
| | | public string AcceptTime => _acceptTime;
|
| | |
|
| | | public string CcsId => _ccsid;
|
| | |
|
| | | public int ImportCase => _importCase;
|
| | |
|
| | | public string Detp => _dept;
|
| | |
|
| | | public int PartHicustomer => _partHicustomer;
|
| | |
|
| | | public string Note => _note;
|
| | |
|
| | | public bool InsertDb(OracleConnection connectionTpc, OracleTransaction transaction)
|
| | | {
|
| | | var sqlStmt = "INSERT INTO CCS.EVENTRECORD VALUES ('" + _meter + "','" + _customerName + "','" + _customerTel + "','" + _addrCity + "','"
|
| | | + _addrTown + "','" + _addrRoad + "','" + _addrOther + "','" + _recallName + "','" + _recallTel + "',"
|
| | | + _eventBrief + ",TO_DATE('" + _acceptTime + "','YYYY/MM/DD HH24:MI:SS'),'" + _ccsid + "'," + _importCase + ",'" + _dept + "',"
|
| | | + _partHicustomer + ",'" + _note + "')";
|
| | |
|
| | | OracleCommand command = new OracleCommand(sqlStmt, connectionTpc, transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (command.ExecuteNonQuery() != 1)
|
| | | {
|
| | | throw new Exception("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!");
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Logger.Error(e, e.Message);
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | | command.Dispose();
|
| | | }
|
| | | return true;
|
| | | }
|
| | | }
|
| | | using System; |
| | | |
| | | using System.Data.OracleClient; |
| | | using NLog; |
| | | |
| | | namespace CCSTrace.CCS.Object |
| | | { |
| | | public class CCSEventRecord |
| | | { |
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); |
| | | |
| | | private readonly string _meter; |
| | | private readonly string _customerName; |
| | | private readonly string _customerTel; |
| | | private readonly string _addrCity; |
| | | private readonly string _addrTown; |
| | | private readonly string _addrRoad; |
| | | private readonly string _addrOther; |
| | | private readonly string _recallName; |
| | | private readonly string _recallTel; |
| | | private readonly int _eventBrief; |
| | | private readonly string _acceptTime; |
| | | private readonly string _ccsid; |
| | | private readonly int _importCase; |
| | | private readonly string _dept; |
| | | private readonly int _partHicustomer; |
| | | private readonly string _note; |
| | | |
| | | public CCSEventRecord(string ccsid, string meter, string customername, string customertel, string addrCity, string addrTown, string addrRoad, |
| | | string addrOther, string recallname, string recalltel, int eventbrief, string accepttime, int importcase, string dept, |
| | | int partHicustomer, string note) |
| | | { |
| | | _meter = meter; |
| | | _customerName = customername; |
| | | _customerTel = customertel; |
| | | _addrCity = addrCity; |
| | | _addrTown = addrTown; |
| | | _addrRoad = addrRoad; |
| | | _addrOther = addrOther; |
| | | _recallName = recallname; |
| | | _recallTel = recalltel; |
| | | _eventBrief = eventbrief; ; |
| | | _ccsid = ccsid; |
| | | _importCase = importcase; |
| | | _dept = dept; |
| | | _note = note; |
| | | _partHicustomer = partHicustomer; |
| | | _acceptTime = accepttime; |
| | | } |
| | | |
| | | public CCSEventRecord(string ccsid, OracleConnection connectionTpc) |
| | | { |
| | | var sqlStmt = "SELECT METER,CUSTOMERNAME,CUSTOMERTEL,ADDR_CITY,ADDR_TOWN,ADDR_ROAD,ADDR_OTHER,RECALLNAME,RECALLTEL,EVENTBRIEF," + |
| | | "TO_CHAR(ACCEPTTIME,'YYYY/MM/DD HH24:MI:SS') AS ACCEPTTIME,CCSID,IMPORTCASE,DEPT,PARTHICUSTOMER,NOTE " + |
| | | "FROM CCS.EVENTRECORD WHERE CCSID = '" + ccsid + "'"; |
| | | |
| | | OracleCommand command = new OracleCommand(sqlStmt, connectionTpc); |
| | | OracleDataReader reader = command.ExecuteReader(); |
| | | |
| | | try |
| | | { |
| | | while (reader.Read()) |
| | | { |
| | | _meter = reader["METER"].ToString(); |
| | | _customerName = reader["CUSTOMERNAME"].ToString(); |
| | | _customerTel = reader["CUSTOMERTEL"].ToString(); |
| | | _addrCity = reader["ADDR_CITY"].ToString(); |
| | | _addrTown = reader["ADDR_TOWN"].ToString(); |
| | | _addrRoad = reader["ADDR_ROAD"].ToString(); |
| | | _addrOther = reader["ADDR_OTHER"].ToString(); |
| | | _recallName = reader["RECALLNAME"].ToString(); |
| | | _recallTel = reader["RECALLTEL"].ToString(); |
| | | _eventBrief = int.Parse(reader["EVENTBRIEF"].ToString()); |
| | | _acceptTime = reader["ACCEPTTIME"].ToString(); |
| | | _ccsid = reader["CCSID"].ToString(); |
| | | _importCase = int.Parse(reader["IMPORTCASE"].ToString()); |
| | | _dept = reader["DEPT"].ToString(); |
| | | _partHicustomer = int.Parse(reader["PARTHICUSTOMER"].ToString()); |
| | | _note = reader["NOTE"].ToString(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Logger.Error(e, "無法取得CCS報案資訊!" + e.Message); |
| | | throw; |
| | | } |
| | | finally |
| | | { |
| | | reader.Close(); |
| | | command.Dispose(); |
| | | } |
| | | } |
| | | |
| | | public string Meter => _meter; |
| | | |
| | | public string CustomerName => _customerName; |
| | | |
| | | public string CustomerTel => _customerTel; |
| | | |
| | | public string AddressCity => _addrCity; |
| | | |
| | | public string AddressTown => _addrTown; |
| | | |
| | | public string AddressRoad => _addrRoad; |
| | | |
| | | public string AddressOther => _addrOther; |
| | | |
| | | public string RecallTel => _recallTel; |
| | | |
| | | public string RecallName => _recallName; |
| | | |
| | | public int EventBrief => _eventBrief; |
| | | |
| | | public string AcceptTime => _acceptTime; |
| | | |
| | | public string CcsId => _ccsid; |
| | | |
| | | public int ImportCase => _importCase; |
| | | |
| | | public string Detp => _dept; |
| | | |
| | | public int PartHicustomer => _partHicustomer; |
| | | |
| | | public string Note => _note; |
| | | |
| | | public bool InsertDb(OracleConnection connectionTpc, OracleTransaction transaction) |
| | | { |
| | | var sqlStmt = "INSERT INTO CCS.EVENTRECORD VALUES ('" + _meter + "','" + _customerName + "','" + _customerTel + "','" + _addrCity + "','" |
| | | + _addrTown + "','" + _addrRoad + "','" + _addrOther + "','" + _recallName + "','" + _recallTel + "'," |
| | | + _eventBrief + ",TO_DATE('" + _acceptTime + "','YYYY/MM/DD HH24:MI:SS'),'" + _ccsid + "'," + _importCase + ",'" + _dept + "'," |
| | | + _partHicustomer + ",'" + _note + "')"; |
| | | |
| | | OracleCommand command = new OracleCommand(sqlStmt, connectionTpc, transaction); |
| | | |
| | | try |
| | | { |
| | | if (command.ExecuteNonQuery() != 1) |
| | | { |
| | | throw new Exception("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!"); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Logger.Error(e, e.Message); |
| | | throw; |
| | | } |
| | | finally |
| | | { |
| | | command.Dispose(); |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | } |
File was renamed from CCSTrace/CCS/Object/EventRecord.cs |
| | |
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class EventRecord
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | | //private CCS.Function.TransferDate Convert = new CCS.Function.TransferDate();
|
| | |
|
| | | public EventRecord(int mCaseId, OracleConnection conn, OracleTransaction trx)
|
| | | {
|
| | | CaseId = mCaseId;
|
| | | LocateEquipment = new LocateEquipment(CaseId, false, conn, trx);
|
| | | }
|
| | |
|
| | | public LocateEquipment LocateEquipment { get; }
|
| | |
|
| | | public int CaseId { get; }
|
| | |
|
| | | public string Name { get; set; } = "";
|
| | |
|
| | | public string Meter { get; set; } = "";
|
| | |
|
| | | public string Tel { get; set; } = "";
|
| | |
|
| | | public string Addr { get; set; } = "";
|
| | |
|
| | | public string Brief { get; set; } = "";
|
| | |
|
| | | public string Log { get; set; } = "";
|
| | |
|
| | | public int Dept { get; set; } = 0;
|
| | |
|
| | | public string AcceptNum { get; set; }
|
| | |
|
| | | public string AcceptDate { get; set; }
|
| | |
|
| | | public int TraceFinish { get; set; } = 0;
|
| | |
|
| | | public int Fsc { get; set; } = 0;
|
| | |
|
| | | public int Ufid { get; set; } = 0;
|
| | |
|
| | | public int FdrId { get; set; } = 0;
|
| | |
|
| | | public int ParentId { get; set; } = 0;
|
| | |
|
| | | public int ImportCase { get; set; }
|
| | |
|
| | | public string Note { get; set; } = "";
|
| | |
|
| | | public int IsReCall { get; set; }
|
| | |
|
| | | public string ReCallTel { get; set; } = "";
|
| | |
|
| | | public string ReCallName { get; set; } = "";
|
| | |
|
| | | public int Level { get; set; } = 0;
|
| | |
|
| | |
|
| | | public int TmpCaseId { get; set; } = 0;
|
| | |
|
| | | public bool IsDespatched { get; set; }
|
| | |
|
| | | public string Tpclid { get; set; } = "";
|
| | |
|
| | | public void SetIsDespatched(bool mDespatched)
|
| | | {
|
| | | IsDespatched = mDespatched;
|
| | | }
|
| | |
|
| | | public string GetSqlStmt()
|
| | | {
|
| | | var sqlStmt = "INSERT INTO EOS.EVENTRECORD VALUES (" + CaseId + ",'" + Name + "','" + Meter + "','" + Tel +
|
| | | "','" + Addr + "','" + Brief + "'," + Dept + ",'" + Log + "','" + AcceptNum + "',to_date('"
|
| | | + AcceptDate + "','yyyy/mm/dd hh24:mi:ss')," + Fsc + "," + Ufid + "," + FdrId + "," +
|
| | | TraceFinish + "," + ImportCase + ",'" + Note + "'," + IsReCall + ",'"
|
| | | + ReCallTel + "','" + ReCallName + "'," + Level + ")";
|
| | |
|
| | | return sqlStmt;
|
| | | }
|
| | |
|
| | | //}
|
| | | // return SqlStmt;
|
| | | // + getReCallName() + "',CASELEVEL = " + getLevel() + ",DEPT = " + getDept() + " WHERE CASEID = " + getCaseID();
|
| | | // + ",NOTE = '" + getNote() + "',ISRECALL = " + getisReCall() + ",RECALLTEL = '" + getReCallTel() + "',RECALLNAME = '"
|
| | |
|
| | | // SqlStmt = "UPDATE EOS.EVENTRECORD SET CUSTOMERADDR = '" + getAddr() + "',EVENTBRIEF = '" + getBrief() + "',IMPORTCASE = " + getImportCase()
|
| | | // String SqlStmt;
|
| | | //{
|
| | |
|
| | | //public String getUpdateSqlStmt()
|
| | | }
|
| | | using System.Data.OracleClient; |
| | | using NLog; |
| | | |
| | | namespace CCSTrace.CCS.Object |
| | | { |
| | | public class EOSEventRecord |
| | | { |
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); |
| | | //private CCS.Function.TransferDate Convert = new CCS.Function.TransferDate(); |
| | | |
| | | public EOSEventRecord(int mCaseId, OracleConnection conn, OracleTransaction trx) |
| | | { |
| | | CaseId = mCaseId; |
| | | LocateEquipment = new LocateEquipment(CaseId, false, conn, trx); |
| | | } |
| | | |
| | | public LocateEquipment LocateEquipment { get; } |
| | | |
| | | public int CaseId { get; } |
| | | |
| | | public string Name { get; set; } = ""; |
| | | |
| | | public string Meter { get; set; } = ""; |
| | | |
| | | public string Tel { get; set; } = ""; |
| | | |
| | | public string Addr { get; set; } = ""; |
| | | |
| | | public string Brief { get; set; } = ""; |
| | | |
| | | public string Log { get; set; } = ""; |
| | | |
| | | public int Dept { get; set; } = 0; |
| | | |
| | | public string AcceptNum { get; set; } |
| | | |
| | | public string AcceptDate { get; set; } |
| | | |
| | | public int TraceFinish { get; set; } = 0; |
| | | |
| | | public int Fsc { get; set; } = 0; |
| | | |
| | | public int Ufid { get; set; } = 0; |
| | | |
| | | public int FdrId { get; set; } = 0; |
| | | |
| | | public int ParentId { get; set; } = 0; |
| | | |
| | | public int ImportCase { get; set; } |
| | | |
| | | public string Note { get; set; } = ""; |
| | | |
| | | public int IsReCall { get; set; } |
| | | |
| | | public string ReCallTel { get; set; } = ""; |
| | | |
| | | public string ReCallName { get; set; } = ""; |
| | | |
| | | public int Level { get; set; } = 0; |
| | | |
| | | |
| | | public int TmpCaseId { get; set; } = 0; |
| | | |
| | | public bool IsDespatched { get; set; } |
| | | |
| | | public string Tpclid { get; set; } = ""; |
| | | |
| | | public void SetIsDespatched(bool mDespatched) |
| | | { |
| | | IsDespatched = mDespatched; |
| | | } |
| | | |
| | | public string GetInsertSqlStmt() |
| | | { |
| | | var sqlStmt = "INSERT INTO EOS.EVENTRECORD VALUES (" + CaseId + ",'" + Name + "','" + Meter + "','" + Tel + |
| | | "','" + Addr + "','" + Brief + "'," + Dept + ",'" + Log + "','" + AcceptNum + "',to_date('" |
| | | + AcceptDate + "','yyyy/mm/dd hh24:mi:ss')," + Fsc + "," + Ufid + "," + FdrId + "," + |
| | | TraceFinish + "," + ImportCase + ",'" + Note + "'," + IsReCall + ",'" |
| | | + ReCallTel + "','" + ReCallName + "'," + Level + ")"; |
| | | |
| | | return sqlStmt; |
| | | } |
| | | |
| | | //} |
| | | // return SqlStmt; |
| | | // + getReCallName() + "',CASELEVEL = " + getLevel() + ",DEPT = " + getDept() + " WHERE CASEID = " + getCaseID(); |
| | | // + ",NOTE = '" + getNote() + "',ISRECALL = " + getisReCall() + ",RECALLTEL = '" + getReCallTel() + "',RECALLNAME = '" |
| | | |
| | | // SqlStmt = "UPDATE EOS.EVENTRECORD SET CUSTOMERADDR = '" + getAddr() + "',EVENTBRIEF = '" + getBrief() + "',IMPORTCASE = " + getImportCase() |
| | | // String SqlStmt; |
| | | //{ |
| | | |
| | | //public String getUpdateSqlStmt() |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8" ?> |
| | | <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> |
| | | <session-factory> |
| | | <property name="connection.provider"> |
| | | NHibernate.Connection.DriverConnectionProvider |
| | | </property> |
| | | <property name="connection.driver_class"> |
| | | NHibernate.Driver.OracleClientDriver |
| | | </property> |
| | | <!--property name="connection.connection_string"> |
| | | Server=(local);database=LocalDatabase;Integrated Security=SSPI; |
| | | </--> |
| | | <property name="dialect"> |
| | | NHibernate.Dialect.Oracle10gDialect |
| | | </property> |
| | | </session-factory> |
| | | </hibernate-configuration> |