Пример #1
0
            public void AddNewShifts(ShiftsEntry item)
            {
                string msg = _context.GetString(Resource.String.app_notify_msg_new) + " " + item.Title;

                _newShifts.Add(msg);
            }
Пример #2
0
            public void AddNewShiftsVersion(ShiftsEntry item)
            {
                string msg = _context.GetString(Resource.String.app_notify_msg_version) + " " + item.Title + " (" + item.LastVersion + ")";

                _newShiftsVersion.Add(msg);
            }
Пример #3
0
        //###################################################################################

        private static bool IsShiftsEntry(FeedEntry item, out ShiftsEntry shiftEntry)
        {
            shiftEntry = null;
            if (item.Attachments.Count != 1)
            {
                return(false);
            }

            string title = item.Title.ToLower().Trim();

            string[] split = title.Split(' ');
            if (split.Count() == 5 && (split[0] == "dp" || split[0] == "dienstplan") && split[3].StartsWith("ver"))  //DP/MONAT/JAHR/VERSION/NUMMER
            {
                //Monat
                int month = -1;
                switch (split[1].Substring(0, 3))
                {
                case "jan":
                    month = 1;
                    break;

                case "feb":
                    month = 2;
                    break;

                case "mär":
                case "mae":
                    month = 3;
                    break;

                case "apr":
                    month = 4;
                    break;

                case "mai":
                    month = 5;
                    break;

                case "jun":
                    month = 6;
                    break;

                case "jul":
                    month = 7;
                    break;

                case "aug":
                    month = 8;
                    break;

                case "sep":
                    month = 9;
                    break;

                case "okt":
                    month = 10;
                    break;

                case "nov":
                    month = 11;
                    break;

                case "dez":
                    month = 12;
                    break;
                }
                if (month <= 0)
                {
                    return(false);
                }

                //Jahr
                if (Helper.Converter.IsTextInteger(split[2]) && split[2].Length == 4)
                {
                    int year = int.Parse(split[2]);
                    if (month == item.Date.Month && year != item.Date.Year)
                    {
                        year = item.Date.Year;
                    }                                                                                  //Tippfehler ausmerzen

                    string version = split[4].Trim('.').Trim(' ');

                    shiftEntry = new ShiftsEntry(month, year, item.Date, version, item.Attachments.First());
                    return(true);
                }
            }
            else if (split.Count() == 4 && (split[0] == "dp" || split[0] == "dienstplan") && split[2].StartsWith("ver") && split[3].Contains("."))
            {
                //Monat
                int month = -1;
                switch (split[1].Substring(0, 3))
                {
                case "jan":
                    month = 1;
                    break;

                case "feb":
                    month = 2;
                    break;

                case "mär":
                case "mae":
                    month = 3;
                    break;

                case "apr":
                    month = 4;
                    break;

                case "mai":
                    month = 5;
                    break;

                case "jun":
                    month = 6;
                    break;

                case "jul":
                    month = 7;
                    break;

                case "aug":
                    month = 8;
                    break;

                case "sep":
                    month = 9;
                    break;

                case "okt":
                    month = 10;
                    break;

                case "nov":
                    month = 11;
                    break;

                case "dez":
                    month = 12;
                    break;
                }
                if (month <= 0)
                {
                    return(false);
                }

                //Jahr
                int year = item.Date.Year;
                if ((item.Date.AddMonths(3) < new DateTime(year, month, item.Date.Day)))
                {
                    year -= 1;
                }

                string version = split[3].Trim('.').Trim(' ');

                shiftEntry = new ShiftsEntry(month, year, item.Date, version, item.Attachments.First());
                return(true);
            }

            return(false);
        }