| using System;  | 
| using System.Data;  | 
| using System.Configuration;  | 
| using System.Web;  | 
| using System.Web.Security;  | 
| using System.Web.UI;  | 
| using System.Web.UI.HtmlControls;  | 
| using System.Web.UI.WebControls;  | 
| using System.Web.UI.WebControls.WebParts;  | 
|   | 
| using System.Data.OracleClient;  | 
|   | 
| namespace CCSTrace.CCS.Object  | 
| {  | 
|     public class CCSRecord  | 
|     {  | 
|         private String Meter;  | 
|         private String CustomerName;  | 
|         private String CustomerTel;  | 
|         private String ADDR_City;  | 
|         private String ADDR_Town;  | 
|         private String ADDR_Road;  | 
|         private String ADDR_Other;  | 
|         private String RecallName;  | 
|         private String RecallTel;  | 
|         private int EventBrief;  | 
|         private String AcceptTime;  | 
|         private String CCSID;  | 
|         private int ImportCase;  | 
|         private String Dept;  | 
|         private int PartHicustomer;  | 
|         private String Note;  | 
|   | 
|         public CCSRecord(String _CCSID, String _METER, String _CUSTOMERNAME, String _CUSTOMERTEL, String _ADDR_CITY, String _ADDR_TOWN, String _ADDR_ROAD,  | 
|                          String _ADDR_OTHER, String _RECALLNAME, String _RECALLTEL, int _EVENTBRIEF, String _ACCEPTTIME, int _IMPORTCASE, String _DEPT,  | 
|                          int _PartHicustomer,String _NOTE)  | 
|         {  | 
|             this.Meter = _METER;  | 
|             this.CustomerName = _CUSTOMERNAME;  | 
|             this.CustomerTel = _CUSTOMERTEL;  | 
|             this.ADDR_City = _ADDR_CITY;  | 
|             this.ADDR_Town = _ADDR_TOWN;  | 
|             this.ADDR_Road = _ADDR_ROAD;  | 
|             this.ADDR_Other = _ADDR_OTHER;  | 
|             this.RecallName = _RECALLNAME;  | 
|             this.RecallTel = _RECALLTEL;  | 
|             this.EventBrief = _EVENTBRIEF; ;  | 
|             this.CCSID = _CCSID;  | 
|             this.ImportCase = _IMPORTCASE;  | 
|             this.Dept = _DEPT;  | 
|             this.Note = _NOTE;  | 
|             this.PartHicustomer = _PartHicustomer;  | 
|             this.AcceptTime = _ACCEPTTIME;  | 
|         }  | 
|   | 
|         public CCSRecord(String _CCSID, OracleConnection _ConnectionTPC, SEventLog _PLog)  | 
|         {  | 
|             String SqlStmt;  | 
|   | 
|             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();  | 
|                     ADDR_City = reader["ADDR_CITY"].ToString();  | 
|                     ADDR_Town = reader["ADDR_TOWN"].ToString();  | 
|                     ADDR_Road = reader["ADDR_ROAD"].ToString();  | 
|                     ADDR_Other = reader["ADDR_OTHER"].ToString();  | 
|                     RecallName = reader["RECALLNAME"].ToString();  | 
|                     RecallTel = reader["RECALLTEL"].ToString();  | 
|                     EventBrief = Int32.Parse(reader["EVENTBRIEF"].ToString());  | 
|                     AcceptTime = reader["ACCEPTTIME"].ToString();  | 
|                     CCSID = reader["CCSID"].ToString();  | 
|                     ImportCase = Int32.Parse(reader["IMPORTCASE"].ToString());  | 
|                     Dept = reader["DEPT"].ToString();  | 
|                     PartHicustomer = Int32.Parse(reader["PARTHICUSTOMER"].ToString());  | 
|                     Note = reader["NOTE"].ToString();  | 
|                 }  | 
|             }  | 
|             catch (Exception e)  | 
|             {  | 
|                 _PLog.Error("無法取得CCS報案資訊!" + e.Message);  | 
|                 Console.WriteLine(e.StackTrace);  | 
|   | 
|                 if (LocalVariable.ShowError)  | 
|                     _PLog.Error(e.StackTrace);  | 
|   | 
|                 throw e;  | 
|             }  | 
|             finally  | 
|             {   | 
|                 reader.Close();  | 
|                 Command.Dispose();  | 
|             }  | 
|         }  | 
|   | 
|         public bool InsertDB(OracleConnection _ConnectionTPC, System.Data.OracleClient.OracleTransaction _Transaction, SEventLog _PLog)  | 
|         {  | 
|             String SqlStmt;  | 
|   | 
|             SqlStmt = "INSERT INTO CCS.EVENTRECORD VALUES ('" + this.Meter + "','" + CustomerName + "','" + CustomerTel + "','" + ADDR_City + "','"  | 
|                     + ADDR_Town + "','" + ADDR_Road + "','" + ADDR_Other + "','" + 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)  | 
|                 {  | 
|                     _PLog.Error("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!");  | 
|   | 
|                     throw new Exception("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!");  | 
|                 }  | 
|             }  | 
|             catch (Exception e)  | 
|             {  | 
|                 Console.WriteLine(e.StackTrace);  | 
|   | 
|                 if (LocalVariable.ShowError)  | 
|                     _PLog.Error(e.StackTrace);  | 
|   | 
|                 _PLog.Error("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!" + e.Message);  | 
|                 //throw new Exception("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中");  | 
|                 throw e;  | 
|             }  | 
|             finally  | 
|             {  | 
|                 Command.Dispose();  | 
|             }  | 
|             return true;  | 
|         }  | 
|   | 
|         public String getMeter()  | 
|         {  | 
|             return this.Meter;  | 
|         }  | 
|   | 
|         public String getCustomerName()  | 
|         {  | 
|             return this.CustomerName;  | 
|         }  | 
|   | 
|         public String getCustomerTel()  | 
|         {  | 
|             return this.CustomerTel;  | 
|         }  | 
|   | 
|         public String getADDR_City()  | 
|         {  | 
|             return this.ADDR_City;  | 
|         }  | 
|   | 
|         public String getADDR_Town()  | 
|         {  | 
|             return this.ADDR_Town;  | 
|         }  | 
|   | 
|         public String getADDR_Road()  | 
|         {  | 
|             return this.ADDR_Road;  | 
|         }  | 
|   | 
|         public String getADDR_Other()  | 
|         {  | 
|             return this.ADDR_Other;  | 
|         }  | 
|   | 
|         public String getRecallName()  | 
|         {  | 
|             return this.RecallName;  | 
|         }  | 
|   | 
|         public String getRecallTel()  | 
|         {  | 
|             return this.RecallTel;  | 
|         }  | 
|   | 
|         public int getEventBrief()  | 
|         {  | 
|             return this.EventBrief;  | 
|         }  | 
|   | 
|         public String getAcceptTime()  | 
|         {  | 
|             return this.AcceptTime;  | 
|         }  | 
|   | 
|         public String getCCSID()  | 
|         {  | 
|             return this.CCSID;  | 
|         }  | 
|   | 
|         public int getImportCase()  | 
|         {  | 
|             return this.ImportCase;  | 
|         }  | 
|   | 
|         public String getDetp()  | 
|         {  | 
|             return this.Dept;  | 
|         }  | 
|   | 
|         public int getPartHicustomer()  | 
|         {  | 
|             return PartHicustomer;  | 
|         }  | 
|   | 
|         public String getNote()  | 
|         {  | 
|             return this.Note;  | 
|         }  | 
|     }  | 
| }  |