コード例 #1
0
        /// <summary>
        /// Processes the m52 message.
        /// </summary>
        /// <returns>A string collection with the data to be returned</returns>
        public System.Collections.Specialized.StringCollection Process()
        {
            StringCollection res       = null;
            OracleConnection oraDBConn = null;
            ILogger          logger    = null;
            bool             bRes      = false;


            try
            {
                Database d = OPS.Components.Data.DatabaseFactory.GetDatabase();
                logger = DatabaseFactory.Logger;
                System.Data.IDbConnection DBCon = d.GetNewConnection();
                oraDBConn = (OracleConnection)DBCon;
                oraDBConn.Open();

                if (oraDBConn.State == System.Data.ConnectionState.Open)
                {
                    CargaDescarga.DBComponent dbCargaDescarga = new CargaDescarga.DBComponent();

                    if (_InReservationId < 0)
                    {
                        _OutReservationId = -1;
                    }
                    else
                    {
                        _OutReservationId = _InReservationId;
                    }

                    dbCargaDescarga.UMDM_Operation(ref oraDBConn, _user, _unit, _movDate, _PDMOperationStatus,
                                                   _NumberOfSlots, ref _InSlotIni, ref _InSlotEnd,
                                                   ref _OutReservationId, ref _DateIni, ref _DateEnd,
                                                   ref _TimeSlotIni);

                    bRes = true;
                }

                if (bRes)
                {
                    /*
                     * <ap>
                     *					<re> </re> --> Reservation
                     * </ap>
                     * */
                    string response = "<re>" + _OutReservationId.ToString() + "</re>";

                    res = new StringCollection();
                    res.Add(new AckMessage(_msgId, response).ToString());
                }
                else
                {
                    if (logger != null)
                    {
                        logger.AddLog("[Msg83:Process]: Error.", LoggerSeverities.Error);
                    }
                    res = ReturnNack(NackMessage.NackTypes.NACK_ERROR_BECS);
                }
            }
            catch (Exception e)
            {
                if (logger != null)
                {
                    logger.AddLog("[Msg83:Process]: Error: " + e.Message, LoggerSeverities.Error);
                }
                res = ReturnNack(NackMessage.NackTypes.NACK_ERROR_BECS);
            }
            finally
            {
                if (oraDBConn != null)
                {
                    oraDBConn.Close();
                    oraDBConn.Dispose();
                    oraDBConn = null;
                }
            }

            return(res);
        }
コード例 #2
0
        /// <summary>
        /// Processes the m52 message.
        /// </summary>
        /// <returns>A string collection with the data to be returned</returns>
        public System.Collections.Specialized.StringCollection Process()
        {
            StringCollection res       = null;
            OracleConnection oraDBConn = null;
            ILogger          logger    = null;
            bool             bRes      = false;


            try
            {
                Database d = OPS.Components.Data.DatabaseFactory.GetDatabase();
                logger = DatabaseFactory.Logger;
                System.Data.IDbConnection DBCon = d.GetNewConnection();
                oraDBConn = (OracleConnection)DBCon;
                oraDBConn.Open();

                if (oraDBConn.State == System.Data.ConnectionState.Open)
                {
                    CargaDescarga.DBComponent dbCargaDescarga = new CargaDescarga.DBComponent();

                    _OutSlotIni = _InSlotIni;
                    _OutSlotEnd = _InSlotEnd;

                    dbCargaDescarga.UMDM_Query(ref oraDBConn, _user, _unit, _movDate,
                                               _NumberOfSlots, ref _OutSlotIni, ref _OutSlotEnd,
                                               ref _ReservationId, ref _DateIni, ref _DateEnd, ref _FirstOpDateEnd,
                                               ref _TimeSlotIni, ref _TimeSlotEnd);

                    bRes            = true;
                    _responseResult = 1;
                }

                if (bRes)
                {
/*
 * <ap>
 *					<r> </r> -->Result
 *					<re> </re> --> Reservation
 *					<ns> </ns> --> Number of slots
 *					<si> </si> --> Slot ini
 *					<se> </se> --> Slot end
 *					<ts> </ts> --> Time slot
 *					<d1> </d1> --> Fecha de inicio
 *					<d2> </d2> --> Fecha de fin
 *					<do2> </do2> --> Fecha de fin de la primera operacion de la reserva
 *
 * </ap>
 * */
                    string response = "<r>" + Convert.ToString(_responseResult) + "</r>";
                    response += "<re>" + _ReservationId.ToString() + "</re>";
                    response += "<ns>" + _NumberOfSlots.ToString() + "</ns>";
                    response += "<si>" + _OutSlotIni.ToString() + "</si>";
                    response += "<se>" + _OutSlotEnd.ToString() + "</se>";
                    response += "<ts>" + _TimeSlotIni.ToString() + "</ts>";
                    response += "<d1>" + _DateIni + "</d1>";
                    response += "<d2>" + _DateEnd + "</d2>";
                    response += "<do2>" + _FirstOpDateEnd + "</do2>";

                    res = new StringCollection();
                    res.Add(new AckMessage(_msgId, response).ToString());
                }
                else
                {
                    if (logger != null)
                    {
                        logger.AddLog("[Msg81:Process]: Error.", LoggerSeverities.Error);
                    }
                    res = ReturnNack(NackMessage.NackTypes.NACK_ERROR_BECS);
                }
            }
            catch (Exception e)
            {
                if (logger != null)
                {
                    logger.AddLog("[Msg81:Process]: Error: " + e.Message, LoggerSeverities.Error);
                }
                res = ReturnNack(NackMessage.NackTypes.NACK_ERROR_BECS);
            }
            finally
            {
                if (oraDBConn != null)
                {
                    oraDBConn.Close();
                    oraDBConn.Dispose();
                    oraDBConn = null;
                }
            }

            return(res);
        }