Exemple #1
0
        public static IEnumerable <Week> GetWeekAll(YearWeek yearWeek)
        {
            // Create the CloudTable object that represents the table.
            CloudTable table = _tableClient.GetTableReference("week");

            table.CreateIfNotExists();

            var weeks = from result in table.CreateQuery <Week>()
                        where result.PartitionKey == string.Format("{0}_{1}", yearWeek.Year, yearWeek.Week)
                        select result;

            return(weeks);
        }
Exemple #2
0
        public static Week GetWeek(YearWeek yearWeek, string person)
        {
            // Create the CloudTable object that represents the table.
            CloudTable table = _tableClient.GetTableReference("week");

            table.CreateIfNotExists();

            var week = from result in table.CreateQuery <Week>()
                       where result.PartitionKey == string.Format("{0}_{1}", yearWeek.Year, yearWeek.Week) &&
                       result.RowKey == person
                       select result;

            return(week.FirstOrDefault());
        }
Exemple #3
0
    public static bool TryParse(string s, out YearWeek result)
    {
        var match = parseRegex.Match(s);

        if (match.Success)
        {
            result = new YearWeek(int.Parse(match.Groups["year"].Value),
                                  int.Parse(match.Groups["week"].Value));
            return(true);
        }
        else
        {
            result = default(YearWeek);
            return(false);
        }
    }
 public static DateTime DateOfWeek(YearWeek yearWeek)
 {
     return(DateOfWeek(yearWeek.Year, yearWeek.Week));
 }