コード例 #1
0
        /// <summary>
        /// Store in database PAXMSGS object
        /// </summary>
        /// <param name="db"></param>
        /// <param name="hub"></param>
        /// <returns></returns>
        public OSUSR_UUK_PAXMSGS Save(BaggageEntities db, String hub)
        {
            OSUSR_UUK_PAXMSGS obj = this.getOSUSR_UUK_PAXMSGS();

            BaggageEntities dbins = new BaggageEntities();
            try
            {

                // Just store and send to Engine queue if it's a hub message
                if (!hub.Equals(this.IDEST))
                {
                    throw new Exception("PTM TTY message not hub, destination: " + this.IDEST);
                }

                dbins.OSUSR_UUK_PAXMSGS.Add(obj);
                dbins.SaveChanges();
                return obj;
            }
            catch (DbEntityValidationException ex)
            {
                dbins.OSUSR_UUK_PAXMSGS.Remove(obj);

                // Retrieve the error messages as a list of strings.
                var errorMessages = ex.EntityValidationErrors
                        .SelectMany(x => x.ValidationErrors)
                        .Select(x => x.ErrorMessage);

                // Join the list to a single string.
                var fullErrorMessage = string.Join("; ", errorMessages);

                // Combine the original exception message with the new one.
                var exceptionMessage = string.Concat(ex.Message, " PTMTTYTable the validation errors are: ", fullErrorMessage);

                // Throw a new DbEntityValidationException with the improved exception message.
                throw new TableException(exceptionMessage);
            }
            catch (Exception e)
            {
                dbins.OSUSR_UUK_PAXMSGS.Remove(obj);

                throw e;
            }
        }
コード例 #2
0
        public OSUSR_UUK_PAXMSGS getOSUSR_UUK_PAXMSGS()
        {
            OSUSR_UUK_PAXMSGS obj = new OSUSR_UUK_PAXMSGS();

            // Fill all the information
            obj.ID = this.ID;
            obj.BUSINESS = this.BUSINESS;
            obj.CHD = this.CHD;
            obj.ECONOMY = this.ECONOMY;
            obj.FIRST = this.FIRST;
            obj.INF = this.INF;
            obj.IDATE = this.IDATE;
            obj.IFLTNR = this.IFLTNR;
            obj.IORIGIN = this.IORIGIN;
            obj.ODATE = this.ODATE;
            obj.ODEST = this.ODEST;
            obj.OFLTNR = this.OFLTNR;
            obj.RESERVATIONSTATUS = this.RESERVATIONSTATUS;
            obj.TIMESTAMP = this.TIMESTAMP;
            
            return obj;
        }