public void rollbackProcess(int msg_idnum)
        {
            if(msg_idnum != 0)
            {
                if(util.dbConnectionCheck())
                {
                    EDI_Messages dbEDIMsg = context.EDI_Messages.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                    if (dbEDIMsg != null && dbEDIMsg.msg_idnum != 0)
                        dbEDIMsg.process_status = "E";

                    EDI315 dbEDI315 = context.EDI315.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                    if(dbEDI315 != null && dbEDI315.EDI315_idnum != 0)
                    {
                        List<EDI315_Detail> dbDetailList = context.EDI315_Detail.Where(x => x.EDI315_idnum == dbEDI315.EDI315_idnum).ToList();
                        if(dbDetailList != null && dbDetailList.Count() > 0)
                        {
                            foreach(EDI315_Detail detailRow in dbDetailList)
                            {
                                List<EDI315_Detail_N9> N9List = context.EDI315_Detail_N9.Where(x => x.EDI315_Detail_idnum == detailRow.EDI315_Detail_idnum).ToList();
                                if(N9List != null && N9List.Count() > 0)
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void rollbackProcess(int msg_idnum)
        {
            if (msg_idnum != 0)
            {
                if (util.dbConnectionCheck())
                {
                    EDI_Messages dbEDIMsg = context.EDI_Messages.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                    if (dbEDIMsg != null && dbEDIMsg.msg_idnum != 0)
                    {
                        dbEDIMsg.process_status = "E";
                    }

                    EDI315 dbEDI315 = context.EDI315.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                    if (dbEDI315 != null && dbEDI315.EDI315_idnum != 0)
                    {
                        List <EDI315_Detail> dbDetailList = context.EDI315_Detail.Where(x => x.EDI315_idnum == dbEDI315.EDI315_idnum).ToList();
                        if (dbDetailList != null && dbDetailList.Count() > 0)
                        {
                            foreach (EDI315_Detail detailRow in dbDetailList)
                            {
                                List <EDI315_Detail_N9> N9List = context.EDI315_Detail_N9.Where(x => x.EDI315_Detail_idnum == detailRow.EDI315_Detail_idnum).ToList();
                                if (N9List != null && N9List.Count() > 0)
                                {
                                    context.EDI315_Detail_N9.RemoveRange(N9List);
                                }

                                List <EDI315_Detail_R4> R4List      = context.EDI315_Detail_R4.Where(x => x.EDI315_Detail_idnum == detailRow.EDI315_Detail_idnum).ToList();
                                List <int> R4idnumList              = R4List.Select(x => x.Detail_R4_idnum).ToList();
                                List <EDI315_Detail_R4_DTM> DTMList = context.EDI315_Detail_R4_DTM.Where(x => R4idnumList.Contains(x.Detail_R4_idnum) && x.EDI315_Detail_idnum == detailRow.EDI315_Detail_idnum).ToList();
                            }
                        }
                    }
                }
            }
        }
        public void rollbackProcess(int msg_idnum)
        {
            if (msg_idnum != 0)
            {
                if (util.dbConnectionCheck())
                {
                    using (DBContext context = new DBContext())
                    {
                        EDI_Messages dbEDIMsg = context.EDI_Messages.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                        if (dbEDIMsg != null && dbEDIMsg.msg_idnum != 0)
                        {
                            dbEDIMsg.process_status = "E";
                        }

                        EDI315 dbEDI315 = context.EDI315.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                        if (dbEDI315 != null && dbEDI315.EDI315_idnum != 0)
                        {
                            List <EDI315_Detail> dbDetailList = context.EDI315_Detail.Where(x => x.EDI315_idnum == dbEDI315.EDI315_idnum).ToList();
                            if (dbDetailList != null && dbDetailList.Count() > 0)
                            {
                                foreach (EDI315_Detail detailRow in dbDetailList)
                                {
                                    List <EDI315_Detail_N9> N9List = context.EDI315_Detail_N9.Where(x => x.EDI315_Detail_idnum == detailRow.EDI315_Detail_idnum).ToList();
                                    if (N9List != null && N9List.Count() > 0)
                                    {
                                        context.EDI315_Detail_N9.RemoveRange(N9List);
                                    }

                                    List <EDI315_Detail_R4> R4List      = context.EDI315_Detail_R4.Where(x => x.EDI315_Detail_idnum == detailRow.EDI315_Detail_idnum).ToList();
                                    List <int> R4idnumList              = R4List.Select(x => x.Detail_R4_idnum).ToList();
                                    List <EDI315_Detail_R4_DTM> DTMList = context.EDI315_Detail_R4_DTM.Where(x => R4idnumList.Contains(x.Detail_R4_idnum) && x.EDI315_Detail_idnum == detailRow.EDI315_Detail_idnum).ToList();

                                    if (DTMList != null && DTMList.Count() > 0)
                                    {
                                        context.EDI315_Detail_R4_DTM.RemoveRange(DTMList);
                                    }

                                    if (R4List != null && R4List.Count() > 0)
                                    {
                                        context.EDI315_Detail_R4.RemoveRange(R4List);
                                    }

                                    context.EDI315_Detail.Remove(detailRow);
                                }
                            }
                            context.EDI315.Remove(dbEDI315);
                        }
                        context.SaveChanges();
                        context.Dispose();
                    }
                }
                else
                {
                    string logMsg = "Function: rollbackProcess\r\n";
                    logMsg += "Error Message: Not able to access DB. Process rollbacked failed.\r\n";
                    logMsg += "msg_idnum: " + msg_idnum;
                    util.insertLog_TextFile("315", msg_idnum, 0, 0, logMsg);
                }
            }
        }
        private void updateMSGStatus(EDI_Messages dbEDIMessage, int msg_idnum, string status)
        {
            try
            {
                if (util.dbConnectionCheck())
                {
                    using (DBContext context = new DBContext())
                    {
                        dbEDIMessage.process_status = status;
                        context.Dispose();
                    }
                }
                else
                {
                    string logMsg = "Function: updateMSGStatus\r\n";
                    logMsg += "Error Message: Not able to access DB.\r\n";
                    util.insertLog("315", 0, 0, 0, logMsg);

                    edi315MsgParsing.rollbackProcess(msg_idnum);
                }
            }
            catch (DbEntityValidationException ex)
            {
                string logMsg = "Function: updateMSGStatus\r\nError Message: " + ex.Message;
                util.insertLog("315", msg_idnum, 0, 0, logMsg);
            }
            catch (Exception ex)
            {
                string logMsg = "Function: updateMSGStatus\r\nError Message: " + ex.ToString();
                util.insertLog("315", msg_idnum, 0, 0, logMsg);
            }
        }
        private void updateMSGStatus(EDI_Messages dbEDIMessage, int msg_idnum, string msgType, string status)
        {
            try
            {
                if (util.dbConnectionCheck())
                {
                    using (DBContext context = new DBContext())
                    {
                        dbEDIMessage.process_status = status;

                        /* DB context. END. */
                        context.Dispose();
                    }
                }
                else
                {
                    string logMsg = "Date: " + DateTime.Now.ToString();
                    logMsg += "\r\nFunction: updateMSGStatus";
                    logMsg += "\r\nError Message: Not able to access DB.";
                    util.insertLog_TextFile(msgType, 0, 0, 0, logMsg);

                    edi315MsgParsing.rollbackProcess(msg_idnum, msgType, "");
                }
            }
            catch (DbEntityValidationException ex)
            {
                #region Exception
                string logMsg = "Date: " + DateTime.Now.ToString();
                logMsg += "\r\nFunction: updateMSGStatus";
                logMsg += "\r\nError Message: ";

                foreach (DbEntityValidationResult item in ex.EntityValidationErrors)
                {
                    // Get entry
                    DbEntityEntry entry          = item.Entry;
                    string        entityTypeName = entry.Entity.GetType().Name;

                    foreach (DbValidationError subItem in item.ValidationErrors)
                    {
                        logMsg += string.Format("\r\nError '{0}' occurred in {1} at {2}", subItem.ErrorMessage, entityTypeName, subItem.PropertyName);
                    }
                }

                util.insertLog(msgType, msg_idnum, 0, 0, logMsg);
                edi315MsgParsing.rollbackProcess(msg_idnum, msgType, "");
                #endregion
            }
            catch (Exception ex)
            {
                #region Exception
                string logMsg = "Date: " + DateTime.Now.ToString();
                logMsg += "\r\nFunction: updateMSGStatus";
                logMsg += "\r\nError Message: \r\n";
                logMsg += ex.ToString();
                util.insertLog(msgType, msg_idnum, 0, 0, logMsg);
                edi315MsgParsing.rollbackProcess(msg_idnum, msgType, "");
                #endregion
            }
        }
Ejemplo n.º 6
0
        public void rollbackProcess(int msg_idnum)
        {
            if (msg_idnum != 0)
            {
                if (util.dbConnectionCheck())
                {
                    using (DBContext context = new DBContext())
                    {
                        EDI_Messages dbEDIMsg = context.EDI_Messages.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                        if (dbEDIMsg != null && dbEDIMsg.msg_idnum != 0)
                        {
                            dbEDIMsg.process_status = "E";
                        }

                        EDI315 dbEDI315 = context.EDI315.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                        if (dbEDI315 != null && dbEDI315.EDI315_idnum != 0)
                        {
                            List <EDI315_Detail> dbDetailList = context.EDI315_Detail.Where(x => x.EDI315_idnum == dbEDI315.EDI315_idnum).ToList();
                            if (dbDetailList != null && dbDetailList.Count() > 0)
                            {
                                foreach (EDI315_Detail detailRow in dbDetailList)
                                {
                                    List <EDI315_Detail_N9> N9List = context.EDI315_Detail_N9.Where(x => x.EDI315_Detail_idnum == detailRow.EDI315_Detail_idnum).ToList();
                                    if (N9List != null && N9List.Count() > 0)
                                    {
                                        context.EDI315_Detail_N9.RemoveRange(N9List);
                                    }

                                    List <EDI315_Detail_R4> R4List      = context.EDI315_Detail_R4.Where(x => x.EDI315_Detail_idnum == detailRow.EDI315_Detail_idnum).ToList();
                                    List <int> R4idnumList              = R4List.Select(x => x.Detail_R4_idnum).ToList();
                                    List <EDI315_Detail_R4_DTM> DTMList = context.EDI315_Detail_R4_DTM.Where(x => R4idnumList.Contains(x.Detail_R4_idnum) && x.EDI315_Detail_idnum == detailRow.EDI315_Detail_idnum).ToList();

                                    if (DTMList != null && DTMList.Count() > 0)
                                    {
                                        context.EDI315_Detail_R4_DTM.RemoveRange(DTMList);
                                    }

                                    if (R4List != null && R4List.Count() > 0)
                                    {
                                        context.EDI315_Detail_R4.RemoveRange(R4List);
                                    }

                                    context.EDI315_Detail.Remove(detailRow);
                                }
                            }
                            context.EDI315.Remove(dbEDI315);
                        }
                        context.SaveChanges();
                        context.Dispose();
                    }
                }
                else
                {
                    // not albe to access DB
                }
            }
        }
Ejemplo n.º 7
0
 public void rollbackProcess(int msg_idnum)
 {
     if (msg_idnum != 0)
     {
         if (util.dbConnectionCheck())
         {
             EDI_Messages dbEDIMsg = context.EDI_Messages.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
         }
     }
 }
Ejemplo n.º 8
0
        private void updateMSGStatus(EDI_Messages dbEDIMessage, int msg_idnum, string status)
        {
            try
            {
                if (util.dbConnectionCheck())
                {
                    using (DBContext context = new DBContext())
                    {
                        dbEDIMessage.process_status = status;
                        context.Dispose();
                    }
                }
                else
                {
                    string logMsg = "Function: updateMSGStatus\r\n";
                    logMsg += "Error Message: Not able to access DB.\r\n";
                    util.insertLog("315", 0, 0, 0, logMsg);

                    edi315MsgParsing.rollbackProcess(msg_idnum);
                }
            }
            catch (DbEntityValidationException ex)
            {
                string logMsg = "Function: updateMSGStatus\r\n";
                    logMsg += Error Message: " + ex.Message;
                string logMsg = "Function: MeesageParsing\r\n";
                logMsg += "Process rollbacked.\r\n";
                logMsg += "Error Message:\r\n";

                foreach (DbEntityValidationResult item in ex.EntityValidationErrors)
                {
                    // Get entry
                    DbEntityEntry entry = item.Entry;
                    string entityTypeName = entry.Entity.GetType().Name;

                    foreach (DbValidationError subItem in item.ValidationErrors)
                    {
                        logMsg += string.Format("Error '{0}' occurred in {1} at {2}", subItem.ErrorMessage, entityTypeName, subItem.PropertyName) + "\r\n";
                    }
                }
            }
            catch (DbEntityValidationException ex)
            {
                string logMsg = "Function: updateMSGStatus\r\nError Message: " + ex.Message;
                util.insertLog("315", msg_idnum, 0, 0, logMsg);
            }
            catch (Exception ex)
            {
                string logMsg = "Function: updateMSGStatus\r\nError Message: " + ex.ToString();
                util.insertLog("315", msg_idnum, 0, 0, logMsg);
            }
        }
Ejemplo n.º 9
0
 private void updateMSGStatus(EDI_Messages dbEDIMessage)
 {
     try
     {
         using (DBContext context = new DBContext())
         {
             dbEDIMessage.process_status = "Y";
             context.Dispose();
         }
     }
     catch (Exception ex)
     {
     }
 }
        public void rollbackProcess(int msg_idnum)
        {
            if(msg_idnum != 0)
            {
                if(util.dbConnectionCheck())
                {
                    EDI_Messages dbEDIMsg = context.EDI_Messages.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                    if (dbEDIMsg != null && dbEDIMsg.msg_idnum != 0)
                        dbEDIMsg.process_status = "E";

                    EDI315 dbEDI315 = context.EDI315.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                    if(dbEDI315 != null && dbEDI315.EDI315_idnum != 0)
                }
            }
        }
 private void updateMSGStatus(EDI_Messages dbEDIMessage, int msg_idnum)
 {
     try
     {
         if (util.dbConnectionCheck())
         {
             using (DBContext context = new DBContext())
             {
                 dbEDIMessage.process_status = "Y";
                 context.Dispose();
             }
         }
     }
     catch (Exception ex)
     {
         util.insertLog("315", msg_idnum, 0, 0, ex.ToString());
     }
 }
 private void updateMSGStatus(EDI_Messages dbEDIMessage, int msg_idnum, string status)
 {
     try
     {
         if (util.dbConnectionCheck())
         {
             using (DBContext context = new DBContext())
             {
                 dbEDIMessage.process_status = status;
                 context.Dispose();
             }
         }
     }
     catch (Exception ex)
     {
         string logMsg = "Function: updateMSGStatus\r\nError Message: " + ex.ToString();
         util.insertLog("315", msg_idnum, 0, 0, logMsg);
     }
 }
Ejemplo n.º 13
0
        public void rollbackProcess(int msg_idnum, string msgType, string status)
        {
            if (msg_idnum != 0)
            {
                if (util.dbConnectionCheck())
                {
                    using (DBContext context = new DBContext())
                    {
                        if (!string.IsNullOrEmpty(status))
                        {
                            EDI_Messages dbEDIMsg = context.EDI_Messages.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                            if (dbEDIMsg != null && dbEDIMsg.msg_idnum != 0)
                            {
                                dbEDIMsg.process_status = status;
                            }
                        }


                        List <EDI315_Detail_R4_DTM> DTMList = context.EDI315_Detail_R4_DTM.Where(x => x.msg_idnum == msg_idnum).ToList();
                        if (DTMList != null && DTMList.Count() > 0)
                        {
                            context.EDI315_Detail_R4_DTM.RemoveRange(DTMList);
                            context.SaveChanges();
                        }

                        List <EDI315_Detail_R4> R4List = context.EDI315_Detail_R4.Where(x => x.msg_idnum == msg_idnum).ToList();
                        if (R4List != null && R4List.Count() > 0)
                        {
                            context.EDI315_Detail_R4.RemoveRange(R4List);
                            context.SaveChanges();
                        }

                        List <EDI315_Detail_N9> N9List = context.EDI315_Detail_N9.Where(x => x.msg_idnum == msg_idnum).ToList();
                        if (N9List != null && N9List.Count() > 0)
                        {
                            context.EDI315_Detail_N9.RemoveRange(N9List);
                            context.SaveChanges();
                        }

                        List <EDI315_Detail> dbDetailList = context.EDI315_Detail.Where(x => x.msg_idnum == msg_idnum).ToList();
                        if (dbDetailList != null && dbDetailList.Count() > 0)
                        {
                            context.EDI315_Detail.RemoveRange(dbDetailList);
                            context.SaveChanges();
                        }

                        List <EDI315> dbEDI315List = context.EDI315.Where(x => x.msg_idnum == msg_idnum).ToList();
                        if (dbEDI315List != null && dbEDI315List.Count() > 0)
                        {
                            context.EDI315.RemoveRange(dbEDI315List);
                            context.SaveChanges();
                        }

                        /* DB context. END. */
                        context.Dispose();
                    }
                }
                else
                {
                    string logMsg = "Date: " + DateTime.Now.ToString();
                    logMsg += "\r\nFunction: rollbackProcess";
                    logMsg += "\r\nError Message: Not able to access DB. Process rollbacked failed.";

                    logMsg += "\r\nValues Info:";
                    logMsg += "\r\nmstType: 315";

                    if (msg_idnum != 0)
                    {
                        logMsg += "\r\nmsg_idnum: " + msg_idnum;
                    }

                    util.insertLog_TextFile(msgType, msg_idnum, 0, 0, logMsg);
                }
            }
        }
Ejemplo n.º 14
0
        private void UpdateMsgStatus(int msg_idnum, string msgType, string status)
        {
            try
            {
                if (util.checkDBConnection())
                {
                    using (DBContext context = new DBContext())
                    {
                        EDI_Messages dbEdiMsg = context.EDI_Messages.Where(x => x.msg_idnum == msg_idnum).FirstOrDefault();
                        if (dbEdiMsg != null && dbEdiMsg.msg_idnum != 0)
                        {
                            dbEdiMsg.process_status = status;
                            context.SaveChanges();
                        }

                        /* DB context. END. */
                        context.Dispose();
                    }
                }
                else
                {
                    string logMsg = "Date: " + DateTime.Now.ToString();
                    logMsg += "\r\nFunction: updateMSGStatus";
                    logMsg += "\r\nError Message: Not able to access DB.";
                    logMsg += "\r\n\r\n=====================================================================";
                    logMsg += "=============================================================================";
                    logMsg += "=============================================================================";
                    util.insertLog_text(logMsg);
                }
            }
            catch (DbEntityValidationException ex)
            {
                #region Exception
                string logMsg = "Date: " + DateTime.Now.ToString();
                logMsg += "\r\nFunction: updateMSGStatus";
                logMsg += "\r\nError Message: ";

                foreach (DbEntityValidationResult item in ex.EntityValidationErrors)
                {
                    // Get entry
                    DbEntityEntry entry          = item.Entry;
                    string        entityTypeName = entry.Entity.GetType().Name;

                    foreach (DbValidationError subItem in item.ValidationErrors)
                    {
                        logMsg += string.Format("\r\nError '{0}' occurred in {1} at {2}", subItem.ErrorMessage, entityTypeName, subItem.PropertyName);
                    }
                }

                util.insertLog_DB(msgType, msg_idnum, 0, 0, logMsg);
                #endregion
            }
            catch (Exception ex)
            {
                #region Exception
                string logMsg = "Date: " + DateTime.Now.ToString();
                logMsg += "\r\nFunction: updateMSGStatus";
                logMsg += "\r\nError Message: \r\n";
                logMsg += ex.ToString();
                util.insertLog_DB(msgType, msg_idnum, 0, 0, logMsg);
                #endregion
            }
        }
 private void updateMSGStatus(EDI_Messages dbEDIMessage, int msg_idnum, string msgType string status)
Ejemplo n.º 16
0
        /// <summary>
        /// Parse the message from EDI_Message and insert into entities.
        /// </summary>
        /// <param name="msg_type">Hard coded as "315"</param>
        /// <param name="msg_body">Message body that needs to be parsed</param>
        /// <param name="msg_idnum"></param>
        /// <returns></returns>
        public bool ParseMessage(string msg_type, string msg_body, int msg_idnum)
        {
            bool result = false;

            #region Initialize Variables
            string   msgType          = msg_type;
            string   msgBody          = msg_body;
            int      msgIdnum         = msg_idnum;
            string[] msgArr           = null;
            string[] currentRowTemp   = null;
            string[] currentRow       = new string[30];
            string   header           = "";
            string   logMsg           = "";
            int      convertToInt     = 0;
            decimal  convertToDecimal = 0;

            EDI_Messages messages  = new EDI_Messages();
            Container    container = new Container();
            #endregion

            msgBody = Regex.Replace(msg_body, @"^\s+$[\r\n]*", "", RegexOptions.Multiline);
            msgArr  = msgBody.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

            foreach (string row in msgArr)
            {
                string msg;
                // Clear array before insert new row into array
                if (currentRowTemp != null)
                {
                    Array.Clear(currentRowTemp, 0, currentRowTemp.Length);
                }
                if (currentRow != null)
                {
                    Array.Clear(currentRow, 0, currentRow.Length);
                }

                // Insert data into dynamically allocated memory array, and
                // copy to statically allocated memory array.
                msg            = row.Trim();
                currentRowTemp = msg.Split(new[] { "*" }, StringSplitOptions.None);
                Array.Copy(currentRowTemp, 0, currentRow, 0, currentRowTemp.Length);

                // Begin to parse engine.
                header = "";

                // Check whether the message header is valid or not.
                if (EDI315_headers.Any(x => x.ToUpper() == currentRow[0]))
                {
                    header = currentRow[0];
                }
                else
                {
                    logMsg = util.buildLogMsg("ParseMessage", "Invalid format message.");
                    util.insertLog_text(logMsg);
                    result = false;
                    break;
                }

                //Add parsed message into entity lists.

                if (row != null && row.Length > 0)
                {
                    convertToInt     = 0;
                    convertToDecimal = 0;
                    switch (header)
                    {
                    case "ISA": break;

                    case "GS": break;

                    case "ST":
                        #region ST
                        if (currentRow[1] == "315")
                        {
                            b4      = new B4();
                            q2      = new Q2();
                            n9_list = new List <N9>();
                            r4_list = new List <R4>();
                        }
                        else
                        {
                            logMsg = util.buildLogMsg("ParseMessage", "ST: Invalid Transaction Set Identifier Code (ST01/143).");
                            util.insertLog_text(logMsg);
                        }
                        #endregion
                        break;

                    case "B4":
                        #region
                        b4.special_handling_code = currentRow[1];
                        Int32.TryParse(currentRow[2], out convertToInt);
                        b4.inquiry_request_number = convertToInt;
                        b4.shipment_status_code   = currentRow[3];
                        b4.date                         = currentRow[4];
                        b4.status_time                  = currentRow[5];
                        b4.status_location              = currentRow[6];
                        b4.equipment_initial            = currentRow[7];
                        b4.equipment_number             = currentRow[8];
                        b4.equipment_status_code        = currentRow[9];
                        b4.equipment_type               = currentRow[10];
                        b4.location_identifier          = currentRow[11];
                        b4.location_qualifier           = currentRow[12];
                        b4.equipment_number_check_digit = currentRow[13];
                        #endregion
                        break;

                    case "N9":
                        #region N9
                        N9 n9 = new N9();

                        n9.reference_identification_qualifier = currentRow[1];
                        n9.reference_identification           = currentRow[2];
                        n9.free_form_description = currentRow[3];
                        n9.date      = currentRow[4];
                        n9.time      = currentRow[5];
                        n9.time_code = currentRow[6];

                        n9_list.Add(n9);
                        #endregion
                        break;

                    case "Q2":
                        #region Q2
                        q2.vessel_code              = currentRow[1];
                        q2.country_code             = currentRow[2];
                        q2.date                     = currentRow[3];
                        q2.scheduled_sailing_date   = currentRow[4];
                        q2.scheduled_discharge_date = currentRow[5];
                        Int32.TryParse(currentRow[6], out convertToInt);
                        q2.landing_quantity = convertToInt;
                        Decimal.TryParse(currentRow[7], out convertToDecimal);
                        q2.weight           = convertToDecimal;
                        q2.weight_qualifier = currentRow[8];
                        q2.voyage_number    = currentRow[9];
                        q2.reference_identification_qualifier = currentRow[10];
                        q2.reference_identification           = currentRow[11];
                        q2.vessel_code_qualifier = currentRow[12];
                        q2.vessel_name           = currentRow[13];
                        Decimal.TryParse(currentRow[7], out convertToDecimal);
                        q2.volume = convertToDecimal;
                        q2.volume_unit_qualifier = currentRow[15];
                        q2.weight_unit_code      = currentRow[16];
                        #endregion
                        break;

                    case "R4":
                        #region R4
                        R4 r4 = new R4();
                        r4.port_terminal_function_code = currentRow[1];
                        r4.location_qualifier          = currentRow[2];
                        r4.location_identifier         = currentRow[3];
                        r4.port_name           = currentRow[4];
                        r4.country_code        = currentRow[5];
                        r4.state_province_code = currentRow[6];
                        r4.dtm = new DTM();
                        r4_list.Add(r4);
                        #endregion
                        break;

                    case "DTM":
                        #region DTM
                        DTM dtm = r4_list.Last().dtm;
                        Int32.TryParse(currentRow[1], out convertToInt);
                        dtm.date_time_qualifier = convertToInt;
                        dtm.date      = currentRow[2];
                        dtm.time      = currentRow[3];
                        dtm.time_code = currentRow[4];
                        #endregion
                        break;

                    case "SE":
                        #region SE
                        UpdateDB(msg_idnum);
                        #endregion
                        break;

                    case "GE": break;

                    case "IEA": break;

                    default:
                        logMsg = util.buildLogMsg("ParseMessage", "Invalid header");
                        util.insertLog_text(logMsg);
                        break;
                    }
                }
                if (header == "IEA")
                {
                    result = true;
                    break;
                }
            }
            return(result);
        }