ulysseskao
2016-05-03 b66af4500c0b5d6a923d864eb4047b5150c8aac1
refator code
1 files deleted
4 files added
3 files renamed
163 ■■■■ changed files
CCSTrace.Tests/DMMSNHibernate.cfg.xml 18 ●●●●● patch | view | raw | blame | history
CCSTrace.Tests/Settings.StyleCop 1 ●●●● patch | view | raw | blame | history
CCSTrace/CCS/NHibertnateSession.cs 66 ●●●●● patch | view | raw | blame | history
CCSTrace/CCS/Object/CCSEventQuery.cs 7 ●●●●● patch | view | raw | blame | history
CCSTrace/CCS/Object/CCSEventRecord.cs 12 ●●●● patch | view | raw | blame | history
CCSTrace/CCS/Object/EOSEventRecord.cs 6 ●●●● patch | view | raw | blame | history
CCSTrace/CCS/RecordLog.cs 36 ●●●●● patch | view | raw | blame | history
CCSTrace/DMMSNHibernate.cfg.xml 17 ●●●●● patch | view | raw | blame | history
CCSTrace.Tests/DMMSNHibernate.cfg.xml
New file
@@ -0,0 +1,18 @@
<?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>
CCSTrace.Tests/Settings.StyleCop
New file
@@ -0,0 +1 @@
<StyleCopSettings Version="105" />
CCSTrace/CCS/NHibertnateSession.cs
New file
@@ -0,0 +1,66 @@
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);
        }
    }
}
CCSTrace/CCS/Object/CCSEventQuery.cs
File was renamed from CCSTrace/CCS/Object/EventQuery.cs
@@ -4,7 +4,7 @@
namespace CCSTrace.CCS.Object
{
    public class EventQuery
    public class CCSEventQuery
    {
        private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
        
@@ -42,7 +42,9 @@
            if (Meter == null)
            {
                sqlStmt =
                    "INSERT INTO CCS.EVENTQUERY (CCSID,CASESTATUS,CHANGETIME,ASSUMEDTIME,ASSUMEDTIME_NTH,DELAYTIMES,REASON,INPUTTIME) values(" +
                    "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 +
@@ -117,7 +119,6 @@
        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
CCSTrace/CCS/Object/CCSEventRecord.cs
File was renamed from CCSTrace/CCS/Object/CCSRecord.cs
@@ -5,7 +5,7 @@
namespace CCSTrace.CCS.Object
{
    public class CcsRecord
    public class CCSEventRecord
    {
        private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
@@ -26,7 +26,7 @@
        private readonly int _partHicustomer;
        private readonly string _note;
        public CcsRecord(string ccsid, string meter, string customername, string customertel, string addrCity, string addrTown, string addrRoad,
        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)
        {
@@ -48,11 +48,11 @@
            _acceptTime = accepttime;
        }
        public CcsRecord(string ccsid, OracleConnection connectionTpc)
        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 + "'";
            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();
CCSTrace/CCS/Object/EOSEventRecord.cs
File was renamed from CCSTrace/CCS/Object/EventRecord.cs
@@ -3,12 +3,12 @@
namespace CCSTrace.CCS.Object
{
    public class EventRecord
    public class EOSEventRecord
    {
        private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
        //private CCS.Function.TransferDate Convert = new CCS.Function.TransferDate();
        public EventRecord(int mCaseId, OracleConnection conn, OracleTransaction trx)
        public EOSEventRecord(int mCaseId, OracleConnection conn, OracleTransaction trx)
        {
            CaseId = mCaseId;
            LocateEquipment = new LocateEquipment(CaseId, false, conn, trx);
@@ -70,7 +70,7 @@
            IsDespatched = mDespatched;
        }
        public string GetSqlStmt()
        public string GetInsertSqlStmt()
        {
            var sqlStmt = "INSERT INTO EOS.EVENTRECORD VALUES (" + CaseId + ",'" + Name + "','" + Meter + "','" + Tel +
                          "','" + Addr + "','" + Brief + "'," + Dept + ",'" + Log + "','" + AcceptNum + "',to_date('"
CCSTrace/CCS/RecordLog.cs
File was deleted
CCSTrace/DMMSNHibernate.cfg.xml
New file
@@ -0,0 +1,17 @@
<?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>