예제 #1
0
        /// <summary>
        /// Creates XML elements from the data of the system.
        /// </summary>
        /// <param name="xmlWriter">Object with the XML message to add new information and return to client side</param>
        /// <param name="val">Value to be puted inside the XML message</param>
        /// <param name="dtdVersion">Version of the DTD that follows the XML message</param>
        /// <param name="xmlElement">Element of the XML that is checked</param>
        public static void ON2XML(XmlWriter xmlWriter, ONDate val, double dtdVersion, string xmlElement)
        {
            if (val == null)
            {
                if (xmlElement == ONXml.XMLTAG_V)
                    xmlWriter.WriteElementString(xmlElement, "");
                else
                    xmlWriter.WriteElementString(ONXml.XMLTAG_NULL, null);
            }
            else
            {
                if (dtdVersion < 2.0) // Apply the locale format
                {
                    if ((val.TypedValue.Hour == 0) && (val.TypedValue.Minute == 0) && (val.TypedValue.Second == 0))
                        xmlWriter.WriteElementString(xmlElement, val.TypedValue.ToString("d"));
                    else
                        xmlWriter.WriteElementString(xmlElement, val.TypedValue.ToString());
                }
                else
                {
                    xmlWriter.WriteStartElement(xmlElement);
                    if (xmlElement == ONXml.XMLTAG_OIDFIELD && dtdVersion > 2.0)
                        xmlWriter.WriteAttributeString("Type", "date");

                    xmlWriter.WriteString(val.TypedValue.ToString("yyyy-MM-dd"));
                    xmlWriter.WriteEndElement();
                }
            }
        }
예제 #2
0
        public override int CompareTo(object obj)
        {
            ONDate lVal = obj as ONDate;

            if (lVal == null)
            {
                return(1);
            }

            if (Value == null && lVal.Value == null)
            {
                return(0);
            }

            if (Value == null)
            {
                return(-1);
            }

            if (lVal.Value == null)
            {
                return(1);
            }

            return(TypedValue.CompareTo(lVal.TypedValue));
        }
예제 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="val">Value for this type</param>
 public ONDate(ONDate val)
 {
     if (val == null)
         Value = null;
     else
         Value = val.Value;
 }
예제 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="val">Value for this type</param>
 public ONDate(ONDate val)
 {
     if (val == null)
     {
         Value = null;
     }
     else
     {
         Value = val.Value;
     }
 }
예제 #5
0
        public static ONDate Min(ONDate obj1, ONDate obj2)
        {
            if (((object)obj1 == null) || (obj1.Value == null) || ((object)obj2 == null) || (obj2.Value == null))
            {
                throw new ONNullException(null);
            }

            if (DateTime.Compare(obj1.TypedValue.Date, obj2.TypedValue.Date) >= 0)
            {
                return(obj2);
            }
            else
            {
                return(obj1);
            }
        }
예제 #6
0
        public RevisionInstance Create_instanceServ(ONInt p_atrid_RevisarAeronaveArg, ONDate p_atrFechaRevisionArg, ONString p_atrNombreRevisorArg, ONString p_atrId_AeronaveArg)
        {
            // Create new context
            using (ONServiceContext lOnContext = new ONServiceContext(OnContext))
            {

                // Call Executive
                RevisionExecutive lExecutive = new RevisionExecutive();
                lExecutive.OnContext = lOnContext;
                lExecutive.Instance = Instance;
                Instance = lExecutive.Create_instanceServ(p_atrid_RevisarAeronaveArg, p_atrFechaRevisionArg, p_atrNombreRevisorArg, p_atrId_AeronaveArg);

            }

            return Instance;
        }
예제 #7
0
        internal RevisionInstance Create_instanceServ(ONInt p_atrid_RevisarAeronaveArg, ONDate p_atrFechaRevisionArg, ONString p_atrNombreRevisorArg, ONString p_atrId_AeronaveArg)
        {
            if (Instance != null)
            {
                ONFilterList onfilt = new ONFilterList();
                onfilt.Add("QueryByOid", new QueryByOidFilter(Instance.Oid));
                Instance.Find(onfilt);
            }
            // Execute service
            RevisionAction lAction = new RevisionAction(OnContext);
            lAction.Instance = new RevisionInstance(OnContext);
            Instance = lAction.Create_instanceServ(p_atrid_RevisarAeronaveArg, p_atrFechaRevisionArg, p_atrNombreRevisorArg, p_atrId_AeronaveArg);

            OnContext.OperationStack.Pop();
            OnContext.OperationStack.Push(Instance);

            return Instance;
        }
예제 #8
0
        public override bool Equals(object obj)
        {
            ONDate lObj = obj as ONDate;

            if ((Value == null) && (lObj.Value == null))
            {
                return(true);
            }

            if ((Value == null) || (lObj.Value == null))
            {
                return(false);
            }

            DateTime lDate1 = TypedValue;
            DateTime lDate2 = lObj.TypedValue;

            return((lDate1.Year == lDate2.Year) && (lDate1.Month == lDate2.Month) && (lDate1.Day == lDate2.Day));
        }
예제 #9
0
        public static ONDate Min(ONDate obj1, ONDate obj2)
        {
            if (((object) obj1 == null) || (obj1.Value == null) ||((object) obj2 == null) || (obj2.Value == null))
                throw new ONNullException(null);

            if (DateTime.Compare(obj1.TypedValue.Date, obj2.TypedValue.Date) >= 0)
                return obj2;
            else
                return obj1;
        }
 public PasajeroAeronaveLMDFilter(ONDate initDateVar, ONDate finalDateVar)
     : base("PasajeroAeronave", "LMD")
 {
     InMemory = false;
     InData = true;
 }
 public AdministradorLMDFilter(ONDate initDateVar, ONDate finalDateVar)
     : base("Administrador", "LMD")
 {
     InMemory = false;
     InData = true;
 }
예제 #12
0
        public override void Copy(ONInstance instance)
        {
            RevisionInstance linstance = instance as RevisionInstance;

            Oid = new RevisionOid(linstance.Oid);

            NombreRevisorAttr = new ONString(linstance.NombreRevisorAttr);
            FechaRevisionAttr = new ONDate(linstance.FechaRevisionAttr);
            Id_AeronaveAttr = new ONString(linstance.Id_AeronaveAttr);
            RevisionPasajeroRoleTemp = linstance.RevisionPasajeroRoleTemp;
            StateObj = new ONString(linstance.StateObj);

            base.Copy(instance);
        }
예제 #13
0
        /// <summary>
        /// Returns a date to which a specified time interval has been added.
        /// </summary>				
        public static ONDate dateAdd(ONString interval, ONInt number, ONDate adate)
        {
            if (interval == null || number == null || adate == null)
                return ONDate.Null;

            switch (interval.TypedValue)
            {
                case "yyyy":
                    return new ONDate(adate.TypedValue.AddYears(number.TypedValue));
                case "m":
                    return new ONDate(adate.TypedValue.AddMonths(number.TypedValue));
                case "d":
                    return new ONDate(adate.TypedValue.AddDays(number.TypedValue));
                default :
                    return adate;
            }
        }
예제 #14
0
        /// <summary>
        /// Convert the arguments adate and atime to a datetime representation. 
        /// </summary>	
        public static ONDateTime toDateTime(ONDate adate, ONTime atime)
        {
            if (adate == null || atime == null)
                return ONDateTime.Null;

            DateTime lDate = adate.TypedValue;
            DateTime lTime = atime.TypedValue;

            return new ONDateTime(new DateTime(lDate.Year, lDate.Month, lDate.Day, lTime.Hour, lTime.Minute, lTime.Second));
        }
예제 #15
0
        /// <summary>
        /// Return a string representation of the argument adate. 
        /// Converts aDate to a string of the form: m/d/yy
        /// </summary>	
        public static ONString toShortDateFormat(ONDate adate)
        {
            if (adate == null)
                return ONString.Null;

            return new ONString(adate.TypedValue.ToString("d/M/yy"));
        }
예제 #16
0
        /// <summary>
        /// Return the day of week contained in adate.The possible values are 1 through 7
        /// </summary>		
        public static ONInt getDayOfWeek(ONDate adate)
        {
            if (adate == null)
                return ONInt.Null;

            int lDayOfWeek = (int) adate.TypedValue.DayOfWeek + 1;
            return new ONInt(lDayOfWeek);
        }
예제 #17
0
        /// <summary>
        /// Return the days of difference between date1 and date2
        /// </summary>		
        public static ONInt daysDifferenceFromDate(ONDate date1, ONDate date2)
        {
            if (date1 == null || date2 == null)
                return ONInt.Null;

            if (date1 > date2)
                return new ONInt(0);

            return new ONInt(date2.TypedValue.Subtract(date1.TypedValue).Days);
        }
예제 #18
0
        /// <summary>
        /// Compare two dates for equality.
        /// The result is true if and only if the argument adate1 represents the same date as adate2.
        /// </summary>				
        public static ONBool dateEquals(ONDate adate1, ONDate adate2)
        {
            if (adate1 == null || adate2 == null)
                return ONBool.Null;

            return new ONBool(adate1.TypedValue.Equals(adate2.TypedValue));
        }
예제 #19
0
        /// <summary>
        /// Tests if adate1 is before the specified date adate2.
        /// Return: true if and only if adate1 is strictly earlier than the date represented by adate2.
        /// </summary>			
        public static ONBool dateBefore(ONDate adate1, ONDate adate2)
        {
            if (adate1 == null || adate2 == null)
                return ONBool.Null;

            return  new ONBool(adate1.TypedValue < adate2.TypedValue);
        }
예제 #20
0
        /// <summary>
        /// Return and string representation of the argument aDate. 
        /// Converts aDate to a string of the form: mon dd, yyyy 
        /// </summary>	
        public static ONString toMediumDateFormat(ONDate adate)
        {
            if (adate == null)
                return ONString.Null;

            return new ONString(adate.TypedValue.ToString("MMM dd, yyyy"));
        }
예제 #21
0
        /// <summary>
        /// Return a date corresponding to the next day of the argument aDate
        /// </summary>				
        public static ONDate tomorrow(ONDate adate)
        {
            if (adate == null)
                return ONDate.Null;

            return new ONDate(adate.TypedValue.AddDays(1));
        }
예제 #22
0
        /// <summary>
        /// Return the month in adate
        /// </summary>				
        public static ONInt getMonth(ONDate adate)
        {
            if (adate == null)
                return ONInt.Null;

            return new ONInt(adate.TypedValue.Month);
        }
예제 #23
0
        /// <summary>
        /// Return a date corresponding to the earlier day of the argument aDate
        /// </summary>				
        public static ONDate yesterday(ONDate adate)
        {
            if (adate == null)
                return ONDate.Null;

            return new ONDate(adate.TypedValue.AddDays(-1));
        }
예제 #24
0
        /// <summary>
        /// Counts the number of appearances of the day of the week between two dates
        /// </summary>
        public static ONInt getNumDayOfWeekBetweenDates(ONInt dayofweek, ONDate inidate, ONDate enddate)
        {
            if (dayofweek == null || inidate == null || enddate == null)
                return null;

            if (inidate > enddate)
                return new ONInt(0);

            ONInt numTotal = (ONInt)daysDifferenceFromDate(inidate, enddate);
            ONInt numDays = ONInt.Divint(numTotal, (new ONReal(7)));
            ONInt diffDays = numTotal % new ONInt(7);
            ONInt iniDay = (ONInt)getDayOfWeek(inidate);
            ONInt endDay = (ONInt)getDayOfWeek(enddate);

            if (endDay < iniDay)
            {
                endDay += new ONInt(7);
            }

            if (dayofweek < iniDay)
            {
                dayofweek += new ONInt(7);
            }

            ONInt iniRest = endDay - diffDays;
            if ((dayofweek >= iniRest) && (dayofweek <= endDay))
            {
                numDays++;
            }
            return (ONInt)numDays;
        }
예제 #25
0
        /// <summary>
        /// Return the year in adate
        /// </summary>			
        public static ONInt getYear(ONDate adate)
        {
            if (adate == null)
                return ONInt.Null;

            return new ONInt (adate.TypedValue.Year);
        }
예제 #26
0
 public RevisionLMDFilter(ONDate initDateVar, ONDate finalDateVar)
     : base("Revision", "LMD")
 {
     InMemory = false;
     InData = true;
 }
 public NaveNodrizaLMDFilter(ONDate initDateVar, ONDate finalDateVar)
     : base("NaveNodriza", "LMD")
 {
     InMemory = false;
     InData = true;
 }