ulysseskao
2016-05-03 410dc2d04dbecf019129cd8cd65a3be2c62b4d0c
CCSTrace/CCS/Object/NumberContrast.cs
@@ -17,6 +17,24 @@
        {
        }
        public string Ccsid
        {
            get { return _ccsid; }
            set { _ccsid = value; }
        }
        public string AcceptNum
        {
            get { return _acceptNum; }
            set { _acceptNum = value; }
        }
        public int CaseId
        {
            get { return _caseId; }
            set { _caseId = value; }
        }
        public void SetCcsid(string mCcsid)
        {
            _ccsid = mCcsid;
@@ -49,24 +67,31 @@
        public bool Insert(OracleConnection conn, OracleTransaction transaction)
        {
            string sqlStmt;
            if (!Check())
            {
                return false;
            }
            sqlStmt = "INSERT INTO CCS.NUM_CONTRAST (CCSID,ACCEPTNUM,CASEID) VALUES ('" + _ccsid + "','" + _acceptNum + "'," + _caseId + ")";
            var sqlStmt = "INSERT INTO CCS.NUM_CONTRAST (CCSID,ACCEPTNUM,CASEID) VALUES ('" + _ccsid + "','" + _acceptNum + "'," + _caseId + ")";
            OracleCommand command = new OracleCommand(sqlStmt, conn, transaction);
            if (command.ExecuteNonQuery() > 0)
            try
            {
                command.Dispose();
                return true;
                if (command.ExecuteNonQuery() > 0)
                {
                    return true;
                }
            }
            catch (Exception e)
            {
                Logger.Warn(e, e.Message);
            }
            finally
            {
                command?.Dispose();
            }
            command.Dispose();
            return false;
        }
@@ -76,17 +101,25 @@
            {
                return false;
            }
            string sqlStmt = "UPDATE CCS.NUM_CONTRAST SET ACCEPTNUM='" + _acceptNum + "',CASEID=" + _caseId + " WHERE CCSID='" + _ccsid + "'";
            var sqlStmt = "UPDATE CCS.NUM_CONTRAST SET ACCEPTNUM='" + _acceptNum + "',CASEID=" + _caseId + " WHERE CCSID='" + _ccsid + "'";
            OracleCommand command = new OracleCommand(sqlStmt, conn, transaction);
            if (command.ExecuteNonQuery() <= 0)
            try {
                if (command.ExecuteNonQuery() <= 0)
                {
                    return false;
                }
            }
            catch (Exception e)
            {
                command.Dispose();
                return false;
                Logger.Warn(e, e.Message);
            }
            finally
            {
                command?.Dispose();
            }
            command.Dispose();
            return true;
        }