public void TestGetObjectDateValue() {
   Date date = new Date();
   date.year = 2012;
   date.month = 12;
   date.day = 2;
   DateValue dateValue = new DateValue();
   dateValue.value = date;
   Assert.AreEqual(date, PqlUtilities.GetValue(dateValue));
 }
 public string BaseYyyyMmDdHhMmSsExtension(string baseName, string extension)
 {
     var dateValue = new DateValue(DateTime.Now);
     return new StringBuilder(baseName)
         .Append("_")
         .Append(dateValue.YyyyMmDd())
         .Append("_")
         .Append(dateValue.HhMmSs())
         .Append(InsertDot(extension))
         .ToString();
 }
Example #3
0
        public void TestNotIsEqualTo()
        {
            // Arrange
            var now = DateTime.Now;
            var todayA = new DateValue(now);
            var todayB = new DateValue(now);
            var tommorow = new DateValue(DateTime.Now.AddDays(1));

            // Act & Assert
            Assert.IsFalse(((BooleanValue)todayA.IsNotEqualTo(todayB)).Val);
            Assert.IsTrue(((BooleanValue)todayA.IsNotEqualTo(tommorow)).Val);
            Assert.IsTrue(((BooleanValue)tommorow.IsNotEqualTo(todayA)).Val);
        }
Example #4
0
 public virtual BooleanValue LessThanOrEqualTo(DateValue other)
 {
     throw new InvalidOperationException("Operation not supported");
 }
Example #5
0
 internal virtual Value IsLessThanDate(DateValue value)
 {
     throw new InvalidOperationException(CreateMessage(Operation.LessThan, value, this));
 }
    public void TestGetObjectDateSetValue() {
      DateTime dateTime = new DateTime();
      Date date = new Date();
      date.year = 2012;
      date.month = 12;
      date.day = 2;
      DateValue dateValue = new DateValue();
      dateValue.value = date;

      SetValue setValue = new SetValue();
      setValue.values = new Value[] { dateValue };
      List<object> value = PqlUtilities.GetValue(setValue) as List<object>;
      Assert.AreEqual(1, value.Count);
      Assert.True(value.Contains(date));
    }
Example #7
0
 internal override Value IsNotEqualToDate(DateValue value)
 {
     return new Undefined();
 }
Example #8
0
 internal override Value IsGreaterThanDate(DateValue value)
 {
     return new Undefined();
 }
Example #9
0
        public Date AddMonths(int months)
        {
            Date output = new Date(DateValue.AddMonths(months));

            return(output);
        }
Example #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldEncodeArrays()
        public virtual void ShouldEncodeArrays()
        {
            AssertEncoding("D1.0|2.0|3.0|", new int[] { 1, 2, 3 });
            AssertEncoding("Ztrue|false|", new bool[] { true, false });
            AssertEncoding("LYWxp|YXJl|eW91|b2s=|", new string[] { "ali", "are", "you", "ok" });
            AssertEncoding("", new string[] {});
            AssertEncoding("P1:4326:1.234;2.567|1:4326:2.345;5.678|2:9157:3.0;4.0;5.0|", new Point[] { Values.pointValue(CoordinateReferenceSystem.WGS84, 1.234, 2.567), Values.pointValue(CoordinateReferenceSystem.WGS84, 2.345, 5.678), Values.pointValue(CoordinateReferenceSystem.Cartesian_3D, 3, 4, 5) });
            AssertEncoding("T1991-03-05|1992-04-06|", new LocalDate[] { DateValue.date(1991, 3, 5).asObjectCopy(), DateValue.date(1992, 4, 6).asObjectCopy() });
            AssertEncoding("T12:45:13.000008676|05:04:50.000000076|", new LocalTime[] { LocalTimeValue.localTime(12, 45, 13, 8676).asObjectCopy(), LocalTimeValue.localTime(5, 4, 50, 76).asObjectCopy() });
            AssertEncoding("T1991-03-05T12:45:13.000008676|1992-04-06T05:04:50.000000076|", new DateTime[] { LocalDateTimeValue.localDateTime(1991, 3, 5, 12, 45, 13, 8676).asObjectCopy(), LocalDateTimeValue.localDateTime(1992, 4, 6, 5, 4, 50, 76).asObjectCopy() });
            AssertEncoding("T02:45:13.000008676Z|01:05:00.0000003+01:00|05:04:50.000000076+05:00|", new OffsetTime[] { TimeValue.time(2, 45, 13, 8676, UTC).asObjectCopy(), TimeValue.time(OffsetTime.ofInstant(Instant.ofEpochSecond(300, 300), ZoneId.of("Europe/Stockholm"))).asObjectCopy(), TimeValue.time(5, 4, 50, 76, "+05:00").asObjectCopy() });
            AssertEncoding("T1991-03-05T02:45:13.000008676Z|1991-03-05T02:45:13.000008676+01:00[Europe/Stockholm]|1992-04-06T05:04:50.000000076+05:00|", new ZonedDateTime[] { DateTimeValue.datetime(1991, 3, 5, 2, 45, 13, 8676, UTC).asObjectCopy(), DateTimeValue.datetime(1991, 3, 5, 2, 45, 13, 8676, ZoneId.of("Europe/Stockholm")).asObjectCopy(), DateTimeValue.datetime(1992, 4, 6, 5, 4, 50, 76, "+05:00").asObjectCopy() });
            AssertEncoding("AP165Y11M3DT5.000000012S|P166Y4DT6.000000005S|", new TemporalAmount[] { DurationValue.duration(1991, 3, 5, 12).asObjectCopy(), DurationValue.duration(1992, 4, 6, 5).asObjectCopy() });
        }
Example #11
0
 public void Decre()
 {
     var yesterday = DateValue.AddDays(-1);
 }
 public ComparableDateValue(DateValue dateValue)
 {
     _dateValue = dateValue;
     _hashCode  = dateValue.AsDecimal.GetHashCode();
 }
Example #13
0
 public Date(DateValue date)
 {
     this.date = date;
 }
Example #14
0
 public virtual IValue Add(DateValue other)
 {
     throw new InvalidOperationException("Operation not supported");
 }
Example #15
0
 public virtual BooleanValue Or(DateValue other)
 {
     throw new InvalidOperationException("Operation not supported");
 }
Example #16
0
        public static object ChangeType(XmlSchemaType xmlType, object value, SequenceType type,
                                        XmlNameTable nameTable, XmlNamespaceManager nsmgr)
        {
            if (type.TypeCode == XmlTypeCode.AnyAtomicType || xmlType.TypeCode == type.TypeCode)
            {
                return(value);
            }
            try
            {
                switch (xmlType.TypeCode)
                {
                case XmlTypeCode.String:
                case XmlTypeCode.UntypedAtomic:
                    switch (type.TypeCode)
                    {
                    case XmlTypeCode.UntypedAtomic:
                        return(new UntypedAtomic(value.ToString()));

                    case XmlTypeCode.String:
                        return(value.ToString());

                    case XmlTypeCode.DateTime:
                        return(DateTimeValue.Parse(value.ToString()));

                    case XmlTypeCode.Date:
                        return(DateValue.Parse(value.ToString()));

                    case XmlTypeCode.Time:
                        return(TimeValue.Parse(value.ToString()));

                    case XmlTypeCode.GYearMonth:
                        return(GYearMonthValue.Parse(value.ToString()));

                    case XmlTypeCode.GYear:
                        return(GYearValue.Parse(value.ToString()));

                    case XmlTypeCode.GMonth:
                        return(GMonthValue.Parse(value.ToString()));

                    case XmlTypeCode.GMonthDay:
                        return(GMonthDayValue.Parse(value.ToString()));

                    case XmlTypeCode.GDay:
                        return(GDayValue.Parse(value.ToString()));

                    case XmlTypeCode.Duration:
                        return(DurationValue.Parse(value.ToString()));

                    case XmlTypeCode.QName:
                        if (xmlType.TypeCode == XmlTypeCode.UntypedAtomic)
                        {
                            throw new XPath2Exception("XPTY0004", Resources.XPTY0004,
                                                      new SequenceType(xmlType, XmlTypeCardinality.One, null), type);
                        }
                        return(QNameValue.Parse(value.ToString(), nsmgr));

                    case XmlTypeCode.Notation:
                        return(NotationValue.Parse(value.ToString(), nsmgr));

                    case XmlTypeCode.AnyUri:
                        return(new AnyUriValue(value.ToString()));

                    default:
                    {
                        string text = value.ToString();
                        object res  = type.SchemaType.Datatype.ParseValue(text, nameTable, nsmgr);
                        switch (type.TypeCode)
                        {
                        case XmlTypeCode.Integer:
                        case XmlTypeCode.PositiveInteger:
                        case XmlTypeCode.NegativeInteger:
                        case XmlTypeCode.NonPositiveInteger:
                        case XmlTypeCode.NonNegativeInteger:
                            return((Integer)Convert.ToDecimal(res));

                        case XmlTypeCode.DayTimeDuration:
                            return(new DayTimeDurationValue((TimeSpan)res));

                        case XmlTypeCode.YearMonthDuration:
                            return(new YearMonthDurationValue((TimeSpan)res));

                        case XmlTypeCode.HexBinary:
                            return(new HexBinaryValue((byte[])res));

                        case XmlTypeCode.Base64Binary:
                            if (text.EndsWith("==") &&
                                (text.Length < 3 || "AQgw".IndexOf(text[text.Length - 3]) == -1))
                            {
                                throw new XPath2Exception("FORG0001", Resources.FORG0001, value);
                            }
                            return(new Base64BinaryValue((byte[])res));

                        case XmlTypeCode.Idref:
                            if (type.SchemaType == SequenceType.XmlSchema.IDREFS)
                            {
                                return(new IDREFSValue((string[])res));
                            }
                            goto default;

                        case XmlTypeCode.NmToken:
                            if (type.SchemaType == SequenceType.XmlSchema.NMTOKENS)
                            {
                                return(new NMTOKENSValue((string[])res));
                            }
                            goto default;

                        case XmlTypeCode.Entity:
                            if (type.SchemaType == SequenceType.XmlSchema.ENTITIES)
                            {
                                return(new ENTITIESValue((string[])res));
                            }
                            goto default;

                        default:
                            return(res);
                        }
                    }
                    }

                case XmlTypeCode.Boolean:
                    switch (type.TypeCode)
                    {
                    case XmlTypeCode.Decimal:
                    case XmlTypeCode.Float:
                    case XmlTypeCode.Double:
                    case XmlTypeCode.Integer:
                    case XmlTypeCode.NonPositiveInteger:
                    case XmlTypeCode.NegativeInteger:
                    case XmlTypeCode.Long:
                    case XmlTypeCode.Int:
                    case XmlTypeCode.Short:
                    case XmlTypeCode.Byte:
                    case XmlTypeCode.NonNegativeInteger:
                    case XmlTypeCode.UnsignedLong:
                    case XmlTypeCode.UnsignedInt:
                    case XmlTypeCode.UnsignedShort:
                    case XmlTypeCode.UnsignedByte:
                    case XmlTypeCode.PositiveInteger:
                        return(ChangeType(value, type.ItemType));

                    case XmlTypeCode.String:
                        return(ToString((bool)value));

                    case XmlTypeCode.UntypedAtomic:
                        return(new UntypedAtomic(ToString((bool)value)));
                    }
                    break;

                case XmlTypeCode.Integer:
                case XmlTypeCode.NonPositiveInteger:
                case XmlTypeCode.NegativeInteger:
                case XmlTypeCode.Long:
                case XmlTypeCode.Int:
                case XmlTypeCode.Short:
                case XmlTypeCode.Byte:
                case XmlTypeCode.NonNegativeInteger:
                case XmlTypeCode.UnsignedLong:
                case XmlTypeCode.UnsignedInt:
                case XmlTypeCode.UnsignedShort:
                case XmlTypeCode.UnsignedByte:
                case XmlTypeCode.PositiveInteger:
                case XmlTypeCode.Decimal:
                case XmlTypeCode.Float:
                case XmlTypeCode.Double:
                    switch (type.TypeCode)
                    {
                    case XmlTypeCode.String:
                        return(ToString(value));

                    case XmlTypeCode.UntypedAtomic:
                        return(new UntypedAtomic(ToString(value)));

                    case XmlTypeCode.Boolean:
                        return(CoreFuncs.BooleanValue(value));

                    case XmlTypeCode.AnyUri:
                        throw new XPath2Exception("XPTY0004", Resources.XPTY0004,
                                                  new SequenceType(xmlType, XmlTypeCardinality.One, null), type);

                    default:
                        return(ChangeType(value, type.ItemType));
                    }

                default:
                {
                    IXmlConvertable convert = value as IXmlConvertable;
                    if (convert != null)
                    {
                        return(convert.ValueAs(type, nsmgr));
                    }
                    if (type.TypeCode == XmlTypeCode.String)
                    {
                        return(ToString(value));
                    }
                    if (type.TypeCode == XmlTypeCode.UntypedAtomic)
                    {
                        return(new UntypedAtomic(ToString(value)));
                    }
                    return(type.SchemaType.Datatype.ChangeType(value, type.ValueType));
                }
                }
            }
            catch (XmlSchemaException ex)
            {
                throw new XPath2Exception(ex.Message, ex);
            }
            catch (InvalidCastException)
            {
                throw new XPath2Exception("XPTY0004", Resources.XPTY0004,
                                          new SequenceType(xmlType, XmlTypeCardinality.One, null), type);
            }
            catch (FormatException)
            {
                throw new XPath2Exception("XPTY0004", Resources.XPTY0004,
                                          new SequenceType(xmlType, XmlTypeCardinality.One, null), type);
            }
            throw new XPath2Exception("XPTY0004", Resources.XPTY0004,
                                      new SequenceType(xmlType, XmlTypeCardinality.One, null), type);
        }
Example #17
0
        public static object GetTypedValue(this XPathItem item)
        {
            XPathNavigator nav = item as XPathNavigator;

            if (nav == null)
            {
                return(item.TypedValue);
            }
            IXmlSchemaInfo schemaInfo = nav.SchemaInfo;

            if (schemaInfo == null || schemaInfo.SchemaType == null)
            {
                switch (nav.NodeType)
                {
                case XPathNodeType.Comment:
                case XPathNodeType.ProcessingInstruction:
                case XPathNodeType.Namespace:
                    return(nav.Value);

                default:
                    return(new UntypedAtomic(nav.Value));
                }
            }
            XmlTypeCode typeCode = schemaInfo.SchemaType.TypeCode;

            if (typeCode == XmlTypeCode.AnyAtomicType && schemaInfo.MemberType != null)
            {
                typeCode = schemaInfo.MemberType.TypeCode;
            }
            switch (typeCode)
            {
            case XmlTypeCode.UntypedAtomic:
                return(new UntypedAtomic(nav.Value));

            case XmlTypeCode.Integer:
            case XmlTypeCode.PositiveInteger:
            case XmlTypeCode.NegativeInteger:
            case XmlTypeCode.NonPositiveInteger:
                return((Integer)(decimal)nav.TypedValue);

            case XmlTypeCode.Date:
                return(DateValue.Parse(nav.Value));

            case XmlTypeCode.DateTime:
                return(DateTimeValue.Parse(nav.Value));

            case XmlTypeCode.Time:
                return(TimeValue.Parse(nav.Value));

            case XmlTypeCode.Duration:
                return(DurationValue.Parse(nav.Value));

            case XmlTypeCode.DayTimeDuration:
                return(new DayTimeDurationValue((TimeSpan)nav.TypedValue));

            case XmlTypeCode.YearMonthDuration:
                return(new YearMonthDurationValue((TimeSpan)nav.TypedValue));

            case XmlTypeCode.GDay:
                return(GDayValue.Parse(nav.Value));

            case XmlTypeCode.GMonth:
                return(GMonthValue.Parse(nav.Value));

            case XmlTypeCode.GMonthDay:
                return(GMonthDayValue.Parse(nav.Value));

            case XmlTypeCode.GYear:
                return(GYearValue.Parse(nav.Value));

            case XmlTypeCode.GYearMonth:
                return(GYearMonthValue.Parse(nav.Value));

            case XmlTypeCode.QName:
            case XmlTypeCode.Notation:
            {
                XmlNamespaceManager nsmgr = new XmlNamespaceManager(nav.NameTable);
                ExtFuncs.ScanLocalNamespaces(nsmgr, nav.Clone(), true);
                if (schemaInfo.SchemaType.TypeCode == XmlTypeCode.Notation)
                {
                    return(NotationValue.Parse(nav.Value, nsmgr));
                }
                else
                {
                    return(QNameValue.Parse(nav.Value, nsmgr));
                }
            }

            case XmlTypeCode.AnyUri:
                return(new AnyUriValue(nav.Value));

            case XmlTypeCode.HexBinary:
                return(new HexBinaryValue((byte[])nav.TypedValue));

            case XmlTypeCode.Base64Binary:
                return(new Base64BinaryValue((byte[])nav.TypedValue));

            case XmlTypeCode.Idref:
                if (schemaInfo.SchemaType == SequenceType.XmlSchema.IDREFS)
                {
                    return(new IDREFSValue((string[])nav.TypedValue));
                }
                goto default;

            case XmlTypeCode.NmToken:
                if (schemaInfo.SchemaType == SequenceType.XmlSchema.NMTOKENS)
                {
                    return(new NMTOKENSValue((string[])nav.TypedValue));
                }
                goto default;

            case XmlTypeCode.Entity:
                if (schemaInfo.SchemaType == SequenceType.XmlSchema.ENTITIES)
                {
                    return(new ENTITIESValue((string[])nav.TypedValue));
                }
                goto default;

            default:
                return(nav.TypedValue);
            }
        }
Example #18
0
        public Date AddDays(int days)
        {
            Date output = new Date(DateValue.AddDays(days));

            return(output);
        }
Example #19
0
        public void HandleDateParam()
        {
            // Brian: Not sure tha these tests SHOULD pass...
            // a time component on the Date?
            var p1 = new DateValue(new DateTimeOffset(1972, 11, 30, 15, 20, 49, TimeSpan.Zero));
            Assert.AreEqual("1972-11-30", p1.ToString());

            // we can parse a valid FHIR datetime and strip the time part off
            // (but it must be a valid FHIR datetime)
            var p2 = DateValue.Parse("1972-11-30T18:45:36Z");
            Assert.AreEqual("1972-11-30", p2.ToString());

            var crit = Criterium.Parse("paramX=1972-11-30");
            var p3 = ((UntypedValue)crit.Operand).AsDateValue();
            Assert.AreEqual("1972-11-30", p3.Value);

            try
            {
                // Test with an invalid FHIR datetime (no timezone specified)
                var p4 = DateValue.Parse("1972-11-30T18:45:36");
                Assert.Fail("The datetime [1972-11-30T18:45:36] does not have a timezone, hence should fail parsing as a datevalue (via fhirdatetime)");
            }
            catch (ArgumentException)
            {
            }
        }
Example #20
0
        public Date AddYears(int years)
        {
            Date output = new Date(DateValue.AddYears(years));

            return(output);
        }
Example #21
0
 internal override Value IsLessThanOrEqualToDate(DateValue value)
 {
     return new Undefined();
 }
Example #22
0
        public override int GetHashCode()
        {
            string hashStr = DateValue.ToString();

            return(hashStr.GetHashCode());
        }
 public CodeQualityMeasurementDto(DateValue sqaleIndexMeasurement, DateValue linesMeasurement)
 {
     this.SqaleIndex      = sqaleIndexMeasurement.Value;
     this.Lines           = linesMeasurement.Value;
     this.MeasurementDate = sqaleIndexMeasurement.Date;
 }
Example #24
0
 public override object GetXslOutput()
 {
     return(DateValue.ToString());
 }
    public void TestGetObjectMixedSetValue() {
      TextValue textValue = new TextValue();
      DateValue dateValue = new DateValue();
      textValue.value = "value1";
      Date date = new Date();
      date.year = 2012;
      date.month = 12;
      date.day = 2;
      dateValue.value = date;

      SetValue setValue = new SetValue();
      setValue.values = new Value[] { textValue, dateValue };
      PqlUtilities.GetValue(setValue);
    }
Example #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CopyEventsFromPrevComp.Visible = false;  //DEBUG

            if (Session["CurrentUserName"] == null)
            {
                CurrentUserID = "";
            }
            else
            {
                CurrentUserID = Session["CurrentUserName"].ToString();
            }
            CurrCompCode = gl.GetCompetitionCode();
            string CompCodeText = Request.QueryString.Get("Code");

            NewCompetition = false;
            if ((CompCodeText != "") && (CompCodeText != null))
            {
                gl.SetCompetitionCode(CompCodeText);
                CurrCompCode = CompCodeText;
                if (CurrCompCode == "NYTT")
                {
                    NewCompetition = true;
                }
            }

            System.Data.Objects.ObjectParameter CurrAccessLevel    = new System.Data.Objects.ObjectParameter("CurrentAccessLevel", "0");
            System.Data.Objects.ObjectParameter CurrCanEnterScores = new System.Data.Objects.ObjectParameter("CanEnterScores", "0");

            AthlEnt.GetAccessLevel(CurrentUserID, CurrCompCode, CurrAccessLevel, CurrCanEnterScores);
            AccessLevelint = Convert.ToInt32(CurrAccessLevel.Value);
            CanEnterScores = Convert.ToInt32(CurrCanEnterScores.Value);

            //--AccessLevel
            //--
            //--0 = Queries Only
            //--1 = Club Representative
            //--2 = Administrator
            //--3 = Selected Competition Only
            //
            //--    CanEnterScores 0 = No, 1 = Yes

            if (IsPostBack)
            {
                Message.Text = "";
                DateTime DateValue;
                string   ValinnV   = Convert.ToString(Vellir.SelectedValue);
                string   InnslDags = Dagsetning.Text;
                if (ValinnV != GamliVollur.Text)
                {
                    MotADO ado = new MotADO();

                    ado.GeymaVallarupplys(ValinnV);
                    Stadur.Text     = ado.ValinnStadur;
                    UtiEdaInni.Text = ado.ValidUtiInni;

                    if (UtiEdaInni.Text == "0")
                    {
                        UtiEdaInni.Text = "Utanhúss";
                    }
                    if (UtiEdaInni.Text == "1")
                    {
                        UtiEdaInni.Text = "Innanhúss";
                    }
                    if (UtiEdaInni.Text == "2")
                    {
                        UtiEdaInni.Text = "Utan- eða Innanhúss";
                    }


                    GamliVollur.Text = ValinnV.ToString();
                }


                if (InnslDags != GamlaDags.Text)
                {
                    string[] separators = { ".", "/", " " };
                    string[] words      = InnslDags.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                    if (words[0].Length == 1)
                    {
                        words[0] = "0" + words[0];
                    }
                    if (words[1].Length == 1)
                    {
                        words[1] = "0" + words[1];
                    }
                    if (words[2].Length == 1)
                    {
                        words[2] = "200" + words[2];
                    }
                    else if (words[2].Length == 2)
                    {
                        words[2] = "20" + words[2];
                    }

                    InnslDags = words[0] + "." + words[1] + "." + words[2];
                    // if (words[0].Length >
                    if (InnslDags.Length == 8)
                    {
                        InnslDags = InnslDags.Substring(0, 2) + "." + InnslDags.Substring(2, 2) + "." + InnslDags.Substring(4, 4);
                        HeitiMots.Focus();
                    }
                    else
                    if (InnslDags.Length == 7)
                    {
                        InnslDags = "0" + InnslDags.Substring(0, 1) + "." + InnslDags.Substring(1, 2) + "." + InnslDags.Substring(3, 4);
                    }
                    else
                    if (InnslDags.Length == 6)
                    {
                        InnslDags = InnslDags.Substring(0, 2) + "." + InnslDags.Substring(2, 2) + ".20" + InnslDags.Substring(4, 2);
                    }
                    else
                    if (InnslDags.Length == 5)
                    {
                        InnslDags = "0" + InnslDags.Substring(0, 1) + "." + InnslDags.Substring(1, 2) + ".20" + InnslDags.Substring(3, 2);
                    }
                    else
                    if (InnslDags.Length == 4)
                    {
                        InnslDags = InnslDags.Substring(0, 2) + "." + InnslDags.Substring(2, 2) + "." + DateTime.Now.ToString("yyyy");
                    }
                    else
                    if (InnslDags.Length == 3)
                    {
                        InnslDags = "0" + InnslDags.Substring(0, 1) + "." + InnslDags.Substring(1, 2) + "." + DateTime.Now.ToString("yyyy");
                    }
                    else
                    if (InnslDags.Length == 2)
                    {
                        InnslDags = InnslDags + "." + DateTime.Now.ToString("MM.yyyy");
                    }
                    else
                    if (InnslDags.Length == 1)
                    {
                        InnslDags = "0" + InnslDags + "." + DateTime.Now.ToString("MM.yyyy");
                    }

                    if (!DateTime.TryParse(InnslDags, out DateValue))
                    {
                        Message.Text = "Dagsetning " + InnslDags + " er ekki í lagi.";
                    }
                    else
                    {
                        InnslDags = DateValue.ToShortDateString();
                        NoOfDays  = 1;
                    }
                    Dagsetning.Text = InnslDags;
                    GamlaDags.Text  = InnslDags;
                    HeitiMots.Focus();
                }
                if (CompetitionDate2.Text != "")
                {
                    if (!DateTime.TryParse(CompetitionDate2.Text, out DateValue))
                    {
                        Message.Text = "Dagsetning 2 " + CompetitionDate2.Text + " er ekki í lagi.";
                    }
                    else
                    {
                        AthlComp.Date2 = DateValue;
                        NoOfDays       = 2;
                    }
                }
                else
                {
                    AthlComp.Date2        = Convert.ToDateTime("1753-01-01 00:00:00.000");
                    CompetitionDate3.Text = "";
                    CompetitionDate4.Text = "";
                }
                if (CompetitionDate3.Text != "")
                {
                    if (!DateTime.TryParse(CompetitionDate3.Text, out DateValue))
                    {
                        Message.Text = "Dagsetning 3 " + CompetitionDate3.Text + " er ekki í lagi.";
                    }
                    else
                    {
                        AthlComp.Date3 = DateValue;
                        NoOfDays       = 3;
                    }
                }
                else
                {
                    AthlComp.Date3        = Convert.ToDateTime("1753-01-01 00:00:00.000");
                    CompetitionDate4.Text = "";
                }
                if (CompetitionDate4.Text != "")
                {
                    if (!DateTime.TryParse(CompetitionDate4.Text, out DateValue))
                    {
                        Message.Text = "Dagsetning 4 " + CompetitionDate4.Text + " er ekki í lagi.";
                    }
                    else
                    {
                        AthlComp.dagsetning4 = DateValue;
                        NoOfDays             = 4;
                    }
                }
                else
                {
                    AthlComp.dagsetning4 = Convert.ToDateTime("1753-01-01 00:00:00.000");
                }
                AthlComp.tegundstigakeppni = gl.TryConvertStringToInt32(TegundStigakeppni.SelectedValue.ToString());
            }
            else  //Not Postback - Page Load
            {
                //AccessLevelText = Session["CurrentAccessLevel"].ToString();
                //if ((AccessLevelText == "0") || (AccessLevelText == "") || (AccessLevelText == null))
                if ((AccessLevelint != 1) && (AccessLevelint != 2)) //Access is NOT Club Repesentative and NOT Administrator, Competition Creator or CompetitionUpdateAccess = Administrator
                {
                    //NewCompetitorButton.Visible = false;
                    //YourCompetitors.Visible = false;
                    //AddNewCompetitorsBtn.Visible = false;
                    SetupEvents.Visible = false;
                    //  Vista.Visible = false;
                    HeitiMots.ReadOnly         = true;
                    EnsktHeiti.ReadOnly        = true;
                    Dagsetning.ReadOnly        = true;
                    Vellir.Enabled             = false;
                    Stadur.ReadOnly            = true;
                    UtiEdaInni.ReadOnly        = true;
                    Motshaldari.ReadOnly       = true;
                    Yfirdomari.ReadOnly        = true;
                    SkranGjaldPrGrein.ReadOnly = true;
                    SkranGjPrBodhl.ReadOnly    = true;
                    SkranGjPrGreinU18.ReadOnly = true;
                    SkranGjPrBodhlU18.ReadOnly = true;
                    CompStatus.Enabled         = false;
                    TegundStigakeppni.Enabled  = false;
                    ReiknaIAAFStig.Enabled     = false;
                    ReiknaUnglStig.Enabled     = false;
                    Message.Text  = "Þú hefur ekki leyfi til að breyta uppsetningu mótsins";
                    Vista.Visible = false;
                }
                else
                {
                    Message.Text = "";
                }

                if ((gl.GetCompetitionCode() != "") && (gl.GetCompetitionCode() != "NYTT") && (NewCompetition == false))
                {
                    {
                        //SetupEvents.Visible = true;

                        CompetitionCode.Text = gl.GetCompetitionCode();
                        //CompCode2.Text = CompetitionCode.Text;
                        //CompCode4.Text = CompetitionCode.Text;
                        //CompCode7.Text = CompetitionCode.Text;

                        AthleticCompetitionCRUD AthlCompCRUD = new AthleticCompetitionCRUD();
                        AthlComp        = AthlCompCRUD.GetCompetitionRec(gl.GetCompetitionCode());
                        HeitiMots.Text  = AthlComp.Name;
                        EnsktHeiti.Text = AthlComp.ensktheitiamoti;
                        Dagsetning.Text = AthlComp.Date.ToShortDateString();
                        gl.SetGlobalValue("CompetitionName", AthlComp.Name);
                        gl.SetGlobalValue("EnglishCompetitionName", AthlComp.ensktheitiamoti);
                        UtiEdaInni.Text = AthlComp.OutdoorsOrIndoors.ToString();
                        gl.SetOutdoorsOrIndoors(UtiEdaInni.Text);

                        Int16 VenueIndex = 0;
                        System.Data.Objects.ObjectParameter Indx = new System.Data.Objects.ObjectParameter("Indx", typeof(Int32));

                        AthlEnt.IndexCompetitionVenue(AthlComp.keppnisvollur, Indx);
                        if (Int16.TryParse(Indx.Value.ToString(), out VenueIndex) == false)
                        {
                            VenueIndex = 0;
                        }
                        //VenueIndex = ReturnIndexOfVenue(AthlComp.keppnisvollur);

                        if (VenueIndex > 0)
                        {
                            Vellir.SelectedIndex = VenueIndex;
                        }

                        Stadur.Text = AthlComp.Location;
                        if (UtiEdaInni.Text == "0")
                        {
                            UtiEdaInni.Text = "Utanhúss";
                        }
                        if (UtiEdaInni.Text == "1")
                        {
                            UtiEdaInni.Text = "Innanhúss";
                        }

                        CompStatus.SelectedIndex        = AthlComp.Staða_móts;
                        TegundStigakeppni.SelectedValue = AthlComp.tegundstigakeppni.ToString();
                        Motshaldari.Text       = AthlComp.Organizer;
                        Yfirdomari.Text        = AthlComp.Judge;
                        Motsstjori.Text        = AthlComp.Director;
                        SkranGjaldPrGrein.Text = string.Format("{0:N2}", AthlComp.skraningargjaldprgrein);     //AthlComp.skraningargjaldprgrein.ToString();
                        SkranGjPrBodhl.Text    = string.Format("{0:N2}", AthlComp.Skráningargjld_f__boðhlaup); //.ToString();
                        SkranGjPrGreinU18.Text = string.Format("{0:N2}", AthlComp.Skráningargj__yngri_en_18_ára);
                        SkranGjPrBodhlU18.Text = string.Format("{0:N2}", AthlComp.Skráningargj__f_boðhl_y_18_ára);
                        //if (AthlComp.Reikna_unglingastig == 1)
                        //{
                        //    ReiknaUnglStig.Text = "Já";
                        //}
                        //else
                        //{
                        //    ReiknaUnglStig.Text = "Nei";
                        //}
                        ReiknaUnglStig.SelectedValue = AthlComp.Reikna_unglingastig.ToString();
                        //if (AthlComp.Reikna_IAAF_stig == 1)
                        //{
                        //    ReiknaIAAFStig.Text = "Já";
                        //}
                        //else
                        //{
                        //    ReiknaIAAFStig.Text = "Nei";
                        //}
                        ReiknaIAAFStig.SelectedValue = AthlComp.Reikna_IAAF_stig.ToString();

                        gl.SetCompetitionCode(AthlComp.Code);
                        gl.SetCompetitionName(AthlComp.Name);
                        gl.SetCompetionYear(AthlComp.Date.Year);
                        if (AthlComp.keppnisvollur != "")
                        {
                            gl.SetCompetitionVenue(AthlComp.keppnisvollur + ", " + AthlComp.Location);
                        }
                        else
                        {
                            gl.SetCompetitionVenue(AthlComp.Location);
                        }

                        Int32    NoOfDates = 0;
                        ListItem newItem   = new ListItem();
                        newItem       = new ListItem();
                        newItem.Text  = "Allir dagar";
                        newItem.Value = "%";
                        //AthleticsEntities1 AthlEnt = new AthleticsEntities1();
                        var DatesInCompetition = AthlEnt.ReturnCompetitionEventDates(gl.GetCompetitionCode());
                        foreach (var result in DatesInCompetition)
                        {
                            NoOfDates     = NoOfDates + 1;
                            newItem       = new ListItem();
                            newItem.Text  = Convert.ToString(result);       // "Dagur 1"; // Convert.ToString(result.Dags);
                            newItem.Value = Convert.ToString(result) + "%"; // "D1%"; // Convert.ToString(result.Dags) + "%";
                        }
                        if (AthlComp.Date2 > Convert.ToDateTime("1900.01.01"))
                        {
                            CompetitionDate2.Visible = true;
                            CompetitionDate2.Text    = AthlComp.Date2.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture);
                        }
                        if (AthlComp.Date3 > Convert.ToDateTime("1900.01.01"))
                        {
                            CompetitionDate3.Visible = true;
                            CompetitionDate3.Text    = AthlComp.Date3.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture);
                        }
                        if (AthlComp.dagsetning4 > Convert.ToDateTime("1900.01.01"))
                        {
                            CompetitionDate4.Visible = true;
                            CompetitionDate4.Text    = AthlComp.dagsetning4.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture);
                        }
                    }
                    HeitiMots.Focus();
                }
                else
                {
                    string SelNafn;
                    SelNafn                        = gl.GetSelNafn();
                    SetupEvents.Visible            = false;
                    CopyEventsFromPrevComp.Visible = false;
                    UpdateEventSetup.Visible       = false;
                    CompStatus.SelectedIndex       = 1;
                    Vista.Text                     = "Stofna";
                }
            }
        }
 /// <summary>
 /// Adds a new Date value to the list of query parameters.
 /// </summary>
 /// <param name="key">The parameter name.</param>
 /// <param name="value">The parameter value.</param>
 /// <returns>The statement builder, for chaining method calls.</returns>
 public StatementBuilder AddValue(string key, Date value) {
   DateValue queryValue = new DateValue();
   queryValue.value = value;
   return AddValue(key, queryValue);
 }
Example #28
0
 public BuiltInFunctions()
 {
     // Text
     Functions["len"]         = new Len();
     Functions["lower"]       = new Lower();
     Functions["upper"]       = new Upper();
     Functions["left"]        = new Left();
     Functions["right"]       = new Right();
     Functions["mid"]         = new Mid();
     Functions["replace"]     = new Replace();
     Functions["rept"]        = new Rept();
     Functions["substitute"]  = new Substitute();
     Functions["concatenate"] = new Concatenate();
     Functions["char"]        = new CharFunction();
     Functions["exact"]       = new Exact();
     Functions["find"]        = new Find();
     Functions["fixed"]       = new Fixed();
     Functions["proper"]      = new Proper();
     Functions["search"]      = new Search();
     Functions["text"]        = new Text.Text();
     Functions["t"]           = new T();
     Functions["hyperlink"]   = new Hyperlink();
     Functions["value"]       = new Value();
     // Numbers
     Functions["int"] = new CInt();
     // Math
     Functions["abs"]         = new Abs();
     Functions["asin"]        = new Asin();
     Functions["asinh"]       = new Asinh();
     Functions["cos"]         = new Cos();
     Functions["cosh"]        = new Cosh();
     Functions["power"]       = new Power();
     Functions["sign"]        = new Sign();
     Functions["sqrt"]        = new Sqrt();
     Functions["sqrtpi"]      = new SqrtPi();
     Functions["pi"]          = new Pi();
     Functions["product"]     = new Product();
     Functions["ceiling"]     = new Ceiling();
     Functions["count"]       = new Count();
     Functions["counta"]      = new CountA();
     Functions["countblank"]  = new CountBlank();
     Functions["countif"]     = new CountIf();
     Functions["countifs"]    = new CountIfs();
     Functions["fact"]        = new Fact();
     Functions["floor"]       = new Floor();
     Functions["sin"]         = new Sin();
     Functions["sinh"]        = new Sinh();
     Functions["sum"]         = new Sum();
     Functions["sumif"]       = new SumIf();
     Functions["sumifs"]      = new SumIfs();
     Functions["sumproduct"]  = new SumProduct();
     Functions["sumsq"]       = new Sumsq();
     Functions["stdev"]       = new Stdev();
     Functions["stdevp"]      = new StdevP();
     Functions["stdev.s"]     = new Stdev();
     Functions["stdev.p"]     = new StdevP();
     Functions["subtotal"]    = new Subtotal();
     Functions["exp"]         = new Exp();
     Functions["log"]         = new Log();
     Functions["log10"]       = new Log10();
     Functions["ln"]          = new Ln();
     Functions["max"]         = new Max();
     Functions["maxa"]        = new Maxa();
     Functions["median"]      = new Median();
     Functions["min"]         = new Min();
     Functions["mina"]        = new Mina();
     Functions["mod"]         = new Mod();
     Functions["average"]     = new Average();
     Functions["averagea"]    = new AverageA();
     Functions["averageif"]   = new AverageIf();
     Functions["averageifs"]  = new AverageIfs();
     Functions["round"]       = new Round();
     Functions["rounddown"]   = new Rounddown();
     Functions["roundup"]     = new Roundup();
     Functions["rand"]        = new Rand();
     Functions["randbetween"] = new RandBetween();
     Functions["rank"]        = new Rank();
     Functions["rank.eq"]     = new Rank();
     Functions["rank.avg"]    = new Rank(true);
     Functions["quotient"]    = new Quotient();
     Functions["trunc"]       = new Trunc();
     Functions["tan"]         = new Tan();
     Functions["tanh"]        = new Tanh();
     Functions["atan"]        = new Atan();
     Functions["atan2"]       = new Atan2();
     Functions["atanh"]       = new Atanh();
     Functions["acos"]        = new Acos();
     Functions["acosh"]       = new Acosh();
     Functions["var"]         = new Var();
     Functions["varp"]        = new VarP();
     Functions["large"]       = new Large();
     Functions["small"]       = new Small();
     Functions["degrees"]     = new Degrees();
     // Information
     Functions["isblank"]    = new IsBlank();
     Functions["isnumber"]   = new IsNumber();
     Functions["istext"]     = new IsText();
     Functions["isnontext"]  = new IsNonText();
     Functions["iserror"]    = new IsError();
     Functions["iserr"]      = new IsErr();
     Functions["error.type"] = new ErrorType();
     Functions["iseven"]     = new IsEven();
     Functions["isodd"]      = new IsOdd();
     Functions["islogical"]  = new IsLogical();
     Functions["isna"]       = new IsNa();
     Functions["na"]         = new Na();
     Functions["n"]          = new N();
     // Logical
     Functions["if"]      = new If();
     Functions["iferror"] = new IfError();
     Functions["ifna"]    = new IfNa();
     Functions["not"]     = new Not();
     Functions["and"]     = new And();
     Functions["or"]      = new Or();
     Functions["true"]    = new True();
     Functions["false"]   = new False();
     // Reference and lookup
     Functions["address"]  = new Address();
     Functions["hlookup"]  = new HLookup();
     Functions["vlookup"]  = new VLookup();
     Functions["lookup"]   = new Lookup();
     Functions["match"]    = new Match();
     Functions["row"]      = new Row();
     Functions["rows"]     = new Rows();
     Functions["column"]   = new Column();
     Functions["columns"]  = new Columns();
     Functions["choose"]   = new Choose();
     Functions["index"]    = new RefAndLookup.Index();
     Functions["indirect"] = new Indirect();
     Functions["offset"]   = new Offset();
     // Date
     Functions["date"]             = new Date();
     Functions["today"]            = new Today();
     Functions["now"]              = new Now();
     Functions["day"]              = new Day();
     Functions["month"]            = new Month();
     Functions["year"]             = new Year();
     Functions["time"]             = new Time();
     Functions["hour"]             = new Hour();
     Functions["minute"]           = new Minute();
     Functions["second"]           = new Second();
     Functions["weeknum"]          = new Weeknum();
     Functions["weekday"]          = new Weekday();
     Functions["days360"]          = new Days360();
     Functions["yearfrac"]         = new Yearfrac();
     Functions["edate"]            = new Edate();
     Functions["eomonth"]          = new Eomonth();
     Functions["isoweeknum"]       = new IsoWeekNum();
     Functions["workday"]          = new Workday();
     Functions["networkdays"]      = new Networkdays();
     Functions["networkdays.intl"] = new NetworkdaysIntl();
     Functions["datevalue"]        = new DateValue();
     Functions["timevalue"]        = new TimeValue();
     // Database
     Functions["dget"]     = new Dget();
     Functions["dcount"]   = new Dcount();
     Functions["dcounta"]  = new DcountA();
     Functions["dmax"]     = new Dmax();
     Functions["dmin"]     = new Dmin();
     Functions["dsum"]     = new Dsum();
     Functions["daverage"] = new Daverage();
     Functions["dvar"]     = new Dvar();
     Functions["dvarp"]    = new Dvarp();
     //Finance
     Functions["pmt"] = new Pmt();
 }
Example #29
0
 internal virtual Value IsNotEqualToDate(DateValue value)
 {
     throw new InvalidOperationException(CreateMessage(Operation.NotEqualTo, value, this));
 }
Example #30
0
 public override ListValue MapDate(DateValue value)
 {
     return(null);
 }