Exemplo n.º 1
0
        public string LocalDateToInt(NodaTime.LocalDate ld)
        {
            string year  = ld.Year.ToString("D4");
            string month = ld.Month.ToString("D2");
            string day   = ld.Day.ToString("D2");

            return(year + month + day);
        }
Exemplo n.º 2
0
 public GetSchools.SchoolStatus GetEffectiveStatus(NodaTime.LocalDate today)
 {
     return(_status switch {
         GetSchools.SchoolStatus.Unknown => GetSchools.SchoolStatus.Unknown,
         GetSchools.SchoolStatus.HasAgreedInitially => GetSchools.SchoolStatus.HasAgreedInitially,
         GetSchools.SchoolStatus.HasResigned => HasResignedEffectively(today) ? GetSchools.SchoolStatus.HasResigned : GetSchools.SchoolStatus.Unknown,
         GetSchools.SchoolStatus.HasSignedAgreement => IsAgreementEffective(today) ? GetSchools.SchoolStatus.HasSignedAgreement : GetSchools.SchoolStatus.Unknown,
         _ => GetSchools.SchoolStatus.Unknown
     });
Exemplo n.º 3
0
 public TestDataGenerator(int Iterations, NodaTime.LocalDate SDate, NodaTime.LocalDate EDate)
 {
     FirstNames   = new List <string>();
     LastNames    = new List <string>();
     Locations    = new List <GeoEngine_Workspace.Location>();
     ContactTypes = new List <DataObjects.Zombie.ZType>();
     DataSetSize  = Iterations;
     StartDate    = SDate;
     EndDate      = EDate;
     random       = new Random();
     LoadLists();
 }
Exemplo n.º 4
0
        public static String[] GetAllMarkersByDateRange(String StartDate, String EndDate)
        {
            DataObjects.Toolset Tools      = new DataObjects.Toolset();
            NodaTime.LocalDate  ZStartDate = Tools.StringToNodaDate(StartDate);
            NodaTime.LocalDate  ZEndDate   = Tools.StringToNodaDate(EndDate);
            using (DataAccessClass.DataAccessClass TheDatabase = new DataAccessClass.DataAccessClass())
            {
                MasterZombieList = TheDatabase.GetAllZombiesByDateRange(ZStartDate, ZEndDate);
            }
            String[] ZombieArray = Tools.ConvertZombieListToStringArray(MasterZombieList);

            return(ZombieArray);
        }
Exemplo n.º 5
0
 public ArticleMetadataModel(
     ArticleStatus status,
     Version version,
     NodaTime.LocalDate firstRevision,
     NodaTime.LocalDate lastRevision,
     NodaTime.LocalDate lastReview,
     NodaTime.LocalDate nextReview)
 {
     Status        = status;
     Version       = version;
     FirstRevision = firstRevision;
     LastRevision  = lastRevision;
     LastReview    = lastReview;
     NextReview    = nextReview;
 }
Exemplo n.º 6
0
        private DataObjects.Zombie RandomZombie()
        {
            NodaTime.Period P    = NodaTime.Period.Between(StartDate, EndDate);
            int             Days = random.Next(0, P.Days);

            NodaTime.LocalDate ZDate = StartDate.PlusDays(Days);
            DataObjects.Zombie Z     = new DataObjects.Zombie();
            Z.ContactLocation.SetDate(ZDate.Year, ZDate.Month, ZDate.Day);
            Z.ContactName = FirstNames[random.Next(0, FirstNames.Count - 1)] + " " + LastNames[random.Next(0, LastNames.Count - 1)];
            Z.ContactType = ContactTypes[random.Next(0, ContactTypes.Count - 1)];
            Z.ContactLocation.SetLatitude(Convert.ToDouble(random.Next(0, 90)));
            Z.ContactLocation.SetLongitude(Convert.ToDouble(random.Next(-180, 0)));
            Z.ContactLocation.SetElevation(Convert.ToDouble(random.Next(0, 250)));

            return(Z);
        }
Exemplo n.º 7
0
        public static int CreateMarker(String Name, Double Elevation, String Date, int Serial, String ContactType, Double Lat, Double Long)
        {
            //We are going to have to some syntax acrobatics to get the Zombie in the database.
            //Lets try to figure the date out

            DataObjects.Toolset Tools = new DataObjects.Toolset();

            NodaTime.LocalDate           D   = Tools.StringToNodaDate(Date);
            GeoEngine_Workspace.Location Loc = new GeoEngine_Workspace.Location(Lat, Long, Elevation);
            Loc.SetDate(D.Year, D.Month, D.Day);

            DataObjects.Zombie Z = new DataObjects.Zombie(Loc, Name, DataObjects.Zombie.ZType.Slow);
            Z.SetZType(ContactType);
            DataObjects.Zombie ReturnZombie = new DataObjects.Zombie();
            using (DataAccessClass.DataAccessClass TheDatabase = new DataAccessClass.DataAccessClass())
            {
                ReturnZombie = TheDatabase.InsertZombie(Z);
            }
            return(ReturnZombie.ZombieSerialNumber);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Date        Coder       Vers        Notes
        /// 2020-02-06  Clay        1.0         Initial
        ///
        /// Get all the zombies from the database based on a date range
        /// </summary>
        /// <returns></returns>
        public List <DataObjects.Zombie> GetAllZombiesByDateRange(NodaTime.LocalDate StartDate, NodaTime.LocalDate EndDate)
        {
            MasterZombieList = new List <DataObjects.Zombie>();

            try
            {
                System.Data.SqlClient.SqlDataReader t = PDM.Data.SqlHelper.ExecuteReader(GetConnectionString(), "sp_GetAllZombiesByDateRange", StartDate.ToString(), EndDate.ToString());

                if (t.HasRows)
                {
                    while (t.Read())
                    {
                        //I copied my query from the database so I can get the order right. :)

                        //SELECT L.LocationID, L.Elevation, L.Latitude, L.Longitude, DATEPART(YEAR, L.OccurenceDate), DATEPART(MONTH, L.OccurenceDate), DATEPART(DAY, L.OccurenceDate), CT.[Name] FROM tbl_ContactLocation CL
                        //JOIN tbl_Location L ON L.LocationID = CL.LocationFK
                        //JOIN tbl_ContactType CT ON CT.ContactTypeID = CL.ContactTypeFK
                        DataObjects.Zombie NewZombie = new DataObjects.Zombie(Convert.ToInt32(t[0]));
                        NewZombie.ContactLocation = new GeoEngine_Workspace.Location(Convert.ToDouble(t[2]), Convert.ToDouble(t[3]), Convert.ToInt32(t[1]));
                        //I really should add a new Location Constructor to include the date.
                        NewZombie.ContactLocation.SetDate(Convert.ToInt32(t[4]), Convert.ToInt32(t[5]), Convert.ToInt32(t[6]));
                        NewZombie.SetZType(t[7].ToString());
                        NewZombie.ContactName = (t[8].ToString());
                        MasterZombieList.Add(NewZombie);
                    }
                }
            }

            //This is the catch block
            catch (SqlException SQLE)
            {
            }
            catch (Exception e)
            {
            }
            finally
            {
            }
            return(MasterZombieList);
        }
        public FixedTermAgreementSigned(
            Guid id,
            byte[] scannedDocument,
            string scannedDocumentExtension,
            string scannedDocumentContentType,
            NodaTime.LocalDate agreementEndDate,
            Guid recordingUserId,
            string?additionalNotes)
        {
            Guard.Against.Default(id, nameof(id));
            Guard.Against.Empty(scannedDocument, nameof(scannedDocument));
            Guard.Against.NullOrWhiteSpace(scannedDocumentExtension, nameof(scannedDocumentExtension));
            Guard.Against.NullOrWhiteSpace(scannedDocumentContentType, nameof(scannedDocumentContentType));
            Guard.Against.Default(agreementEndDate, nameof(agreementEndDate));
            Guard.Against.Default(recordingUserId, nameof(recordingUserId));

            Id = id;
            ScannedDocument            = scannedDocument;
            ScannedDocumentExtension   = scannedDocumentExtension;
            ScannedDocumentContentType = scannedDocumentContentType;
            AgreementEndDate           = agreementEndDate;
            RecordingUserId            = recordingUserId;
            AdditionalNotes            = additionalNotes;
        }
Exemplo n.º 10
0
 public IHttpActionResult GetByDate3([FromUri] NodaTime.LocalDate date)
 {
     return(Ok(date.ToString()));
 }
Exemplo n.º 11
0
 private LocalDate(NodaTime.LocalDate localDate)
 {
     this.localDate = localDate;
 }
Exemplo n.º 12
0
 public LocalDate(int year, int month, int day)
 {
     this.localDate = new NodaTime.LocalDate(year, month, day);
 }
Exemplo n.º 13
0
 public static string ToSimpleDateString(this NodaTime.LocalDate date) => date.AtMidnight().ToDateTimeUnspecified().ToString("yyyy-MM-dd");
Exemplo n.º 14
0
 internal LocalDate(NodaTime.LocalDate localDate)
 {
     Day   = localDate.Day;
     Month = localDate.Month;
     Year  = localDate.Year;
 }