Esempio n. 1
0
        public void InsertQAOCRData(DataTable dt)
        {
            SOQ_DETAILS soq = new SOQ_DETAILS();
            try
            {
                foreach (DataRow eachRow in dt.Rows)
                {
                    soq.ADDENDA_NBR = eachRow["ADDENDA_NBR"].ToString();
                    soq.DODGE_PROJ_NBR = eachRow["DODGE_PROJ_NBR"].ToString();
                    soq.PDF_FILE_SIZE_BYTES = eachRow["PDF_FILE_SIZE_BYTES"].ToString();
                    soq.QUEUE_TIMESTAMP = eachRow["QUEUE_TIMESTAMP"].ToString();
                    soq.SBP_OCR_XML = eachRow["SBP_OCR_XML"].ToString();
                    soq.TITLE_CODE = eachRow["TITLE_CODE"].ToString();
                    soq.VER_NBR = eachRow["VER_NBR"].ToString();

                    OracleHelper helper = new OracleHelper();
                    helper.InsertQAOCRData(soq);

                    XElement statusXML = XElement.Load(string.Format(@"{0}\StatusXML\status.xml", Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)));
                    statusXML.XPathSelectElement("//last-queue-timestamp").SetValue((eachRow["QUEUE_TIMESTAMP"].ToString()));
                    statusXML.Save(string.Format(@"{0}\StatusXML\status.xml", Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)));
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
        public bool InsertQAOCRData(SOQ_DETAILS soqdetails)
        {
            string queryPath = string.Format(@"{0}\Query\INSERT_QA_SOQ_QUERY.sql", Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
            string query = File.ReadAllText(queryPath);
            bool isInserted = true;
            try
            {
                query = String.Format(query,
                                    soqdetails.DODGE_PROJ_NBR,
                                    soqdetails.TITLE_CODE,
                                    soqdetails.ADDENDA_NBR,
                                    soqdetails.VER_NBR,
                                    soqdetails.SBP_OCR_XML,
                                    "TO_DATE ('" + Convert.ToDateTime(soqdetails.QUEUE_TIMESTAMP).ToString("yyyyMMddHHmmss") + "','YYYYMMDDHH24MISS')",
                                    soqdetails.PDF_FILE_SIZE_BYTES);
                using (oraconnection = new OracleConnection(ConfigurationManager.AppSettings["DSN_PNRQ"]))
                {
                    try
                    {
                        oraconnection.Open();
                        oracommand = new OracleCommand(query, oraconnection);
                        oracommand.CommandType = CommandType.Text;
                        int value = oracommand.ExecuteNonQuery();
                    }
                    catch (Exception)
                    {
                        mhcLogger.Info("Tailed to Insert. Script " + query, "");
                    }
                    finally
                    {
                        oraconnection.Close();
                    }

                }

            }
            catch (Exception)
            {

                throw;
            }
            return isInserted;
        }