public AddEvent()



        {
            InitializeComponent();

            coloursforevent           = new ListHelper("COLOURS", -1, "");
            Task_colour.ItemsSource   = coloursforevent.DisplayList;
            Task_colour.SelectedIndex = coloursforevent.CurrentIndex;
            string colorName2 = Task_colour.Items[Task_colour.SelectedIndex];


            Task_colour.SelectedIndexChanged += (sender, args) =>
            {
                if (Task_colour.SelectedIndex == -1)
                {
                    Task_colour.BackgroundColor = Color.Default;
                }
                else
                {
                    string    colorName = Task_colour.Items[Task_colour.SelectedIndex];
                    ListEntry test      = coloursforevent.ListEntryList[Task_colour.SelectedIndex];
                    string    lilcolour = test.Code;
                    Task_colour.BackgroundColor = getColor(lilcolour);
                }
            };



            timeconsuminglevel = new ListHelper("TASK_COMPLEXITIES", -1, "");

            Task_consuming.ItemsSource = timeconsuminglevel.DisplayList;

            Task_consuming.SelectedIndex = timeconsuminglevel.CurrentIndex;

            if (Device.RuntimePlatform != "UWP")
            {
                Close.IsVisible = false;
            }
        }
示例#2
0
        public static void Initiate()
        {
            // Get a collection (or create, if doesn't exist)
            var col = Database.db.GetCollection <User>("Users");

            // Index document using these properties
            //col.EnsureIndex(x => x.AccomodationType);

            /* Create initial data*/
            col.Insert(
                new User
            {
                Name             = "User Name",
                AccomodationType = ListEntry.getEntryfromTypeAndCode("ACCOMODATION_TYPES", "ALONE"),
                EmailAddress     = "*****@*****.**",
                ShoppingDay      = "MON", // Lundi
                CleaningDay      = "SAT",
                RestDay          = "SUN"
            }
                );
        }
示例#3
0
        //________________________________________________________________
        //________________________________________________________________

        public static void Initiate()
        {
            // Get a collection (or create, if doesn't exist)
            var col = Database.db.GetCollection <Workout>("AllWorkouts");

            // Index document using these properties
            col.EnsureIndex(x => x.Exercice1);
            col.EnsureIndex(x => x.Exercice2);
            col.EnsureIndex(x => x.Exercice3);
            col.EnsureIndex(x => x.Exercice4);
            col.EnsureIndex(x => x.Exercice5);
            col.EnsureIndex(x => x.Exercice6);
            col.EnsureIndex(x => x.Exercice7);
            col.EnsureIndex(x => x.Exercice8);
            col.EnsureIndex(x => x.Exercice9);
            col.EnsureIndex(x => x.Exercice10);
            col.EnsureIndex(x => x.DueDate);
            col.EnsureIndex(x => x.Type);


            col.Insert(
                new Workout
            {
                Exercice1  = ListEntry.getEntryfromTypeAndCode("Abs1", "JumpSquat"),
                Exercice2  = ListEntry.getEntryfromTypeAndCode("Abs1", "PushUps"),
                Exercice3  = ListEntry.getEntryfromTypeAndCode("Abs1", "JumpingLunges"),
                Exercice4  = ListEntry.getEntryfromTypeAndCode("Abs1", "Punches"),
                Exercice5  = ListEntry.getEntryfromTypeAndCode("Abs1", "Plank"),
                Exercice6  = ListEntry.getEntryfromTypeAndCode("Abs1", "Lunge"),
                Exercice7  = ListEntry.getEntryfromTypeAndCode("Abs1", "SideLunge"),
                Exercice8  = ListEntry.getEntryfromTypeAndCode("Abs1", "Squat"),
                Exercice9  = ListEntry.getEntryfromTypeAndCode("Abs1", "JumpSquat"),
                Exercice10 = ListEntry.getEntryfromTypeAndCode("Abs1", "PushUps"),
                DueDate    = DateTime.Now.AddDays(-1),
                Type       = "Workout 1",
            }
                );
        }
        // ----------------------------------------------------

        public static void InsertSchoolTask(User TaskUser,
                                            ListEntry TaskCategory,
                                            ListEntry TaskCategoryColour,
                                            ListEntry TaskComplexity,
                                            ListEntry TaskSubType,
                                            string Description,
                                            string SubDesc,
                                            bool IsComplete,
                                            DateTime DueDate)
        {
            // Get a collection (or create, if doesn't exist)
            var col = Database.db.GetCollection <SchoolTask>("SchoolTasks");

            // Index document using these properties
            col.EnsureIndex(x => x.TaskUser);
            col.EnsureIndex(x => x.TaskCategory);
            col.EnsureIndex(x => x.IsComplete);
            col.EnsureIndex(x => x.DueDate);
            col.EnsureIndex(x => x.TaskSubType);

            // Create initial data
            col.Insert(
                new SchoolTask
            {
                TaskUser           = MyUser.me,
                TaskCategory       = TaskCategory,
                TaskCategoryColour = TaskCategoryColour,
                TaskComplexity     = TaskComplexity,
                TaskSubType        = TaskSubType,
                Description        = Description,
                SubDesc            = SubDesc,
                IsComplete         = IsComplete,
                DueDate            = DueDate
            }
                );
        }
示例#5
0
 public SaveWorkoutLater(ListEntry ex1, ListEntry ex2, ListEntry ex3, ListEntry ex4, ListEntry ex5, ListEntry ex6, ListEntry ex7, ListEntry ex8, ListEntry ex9, ListEntry ex10, string type)
 {
     InitializeComponent();
     exo1  = ex1;
     exo2  = ex2;
     exo3  = ex3;
     exo4  = ex4;
     exo5  = ex5;
     exo6  = ex6;
     exo7  = ex7;
     exo8  = ex8;
     exo9  = ex9;
     exo10 = ex10;
     Type  = type;
 }
        public static ListEntry IntelligentColor(ListEntry TaskCategoryColour)
        {
            ListEntry newColor = TaskCategoryColour;

            switch (TaskCategoryColour.Code)
            {
            case "BLUE":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "LIGHTBLUE");
                break;

            case "GREEN":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "LIGHTGREEN");
                break;

            case "RED":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "MEDIUMVIOLETRED");
                break;

            case "PURPLE":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "BLUEVIOLET");
                break;

            case "BEIGE":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "BISQUE");
                break;

            case "BLUEVIOLET":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "CADETBLUE");
                break;

            case "BROWN":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "SANDYBROWN");
                break;

            case "CORAL":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "LIGHTSALMON");
                break;

            case "DARKBLUE":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "MIDNIGHTBLUE");
                break;

            case "DARKMAGERNTA":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "MAGENTA");
                break;

            case "FORESTGREEN":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "LAWNGREEN");
                break;

            case "FUCHSIA":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "LIGHTPRINK");
                break;

            case "GOLD":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "PALEGOLDENROD");
                break;

            case "GRAY":
                newColor = ListEntry.getEntryfromTypeAndCode("SUBCOLOURS", "LIGHTGRAY");
                break;
            }


            return(newColor);
        }
        public static void Intelligent(User TaskUser,
                                       ListEntry TaskCategory,
                                       ListEntry TaskCategoryColour,
                                       ListEntry TaskComplexity,
                                       ListEntry TaskSubType,
                                       string Description,
                                       string SubDesc,
                                       bool IsComplete,
                                       DateTime DueDate)
        {
            //debut de la nouvelle classe (pas sur qu'on initialse tout ici car pas sur qu'il y ai qu'une sous tache en plus

            ListEntry tcat = new ListEntry(); //ca pas de nouvelles non plus ? a moins qu'on en fasse un sous task mais bon chaud
            ListEntry tcol = new ListEntry(); //couleur plus clair que l'autre
            ListEntry tomp = new ListEntry(); //pas sur qu'il faille modifier ( reprendre celle de base surement)
            ListEntry tsub = new ListEntry(); // la pareil pas de modif en fait


            string   taskcomplex = TaskComplexity.Code;
            TimeSpan daysleft    = (DueDate.Date - DateTime.Now.Date);
            int      p           = daysleft.Days;
            DateTime date        = DateTime.Now.Date;

            //A LA FIN INSERTSCHOOLTASK D'un ou plusieurs (pas sur a la fin surement au fur et à mesure mais bon bref

            //SCHOOL
            //__________________________________Exercice_________________________
            if (TaskCategory.Code == "SCHOOL" && TaskSubType.Code == "EXERCICE")
            {
                //dans tous les cas l'exos doit etre traité le soir meme
                if (p >= 1)
                {
                    InsertSchoolTask(TaskUser, TaskCategory,
                                     IntelligentColor(TaskCategoryColour),
                                     TaskComplexity,
                                     TaskSubType,
                                     Description,
                                     "Start working on this today: " + '\n' + SubDesc,
                                     IsComplete,
                                     date.AddDays(1));
                }

                if (taskcomplex == "MEDIUM" || taskcomplex == "HIGH" || taskcomplex == "VERY_HIGH")
                {
                    if (p > 3)
                    {
                        InsertSchoolTask(TaskUser, TaskCategory,
                                         IntelligentColor(TaskCategoryColour),
                                         TaskComplexity,
                                         TaskSubType,
                                         Description,
                                         "Start working on this today: " + '\n' + SubDesc,
                                         IsComplete,
                                         date.AddDays(p / 4 + 1));
                    }
                    else
                    {
                        InsertSchoolTask(TaskUser, TaskCategory,
                                         IntelligentColor(TaskCategoryColour),
                                         TaskComplexity,
                                         TaskSubType,
                                         Description,
                                         "Start working on this today: " + '\n' + SubDesc,
                                         IsComplete,
                                         date.AddDays(2));
                    }
                }
                if (taskcomplex == "HIGH" || taskcomplex == "VERY_HIGH")
                {
                    if (p > 4)
                    {
                        InsertSchoolTask(TaskUser, TaskCategory,
                                         IntelligentColor(TaskCategoryColour),
                                         TaskComplexity,
                                         TaskSubType,
                                         Description,
                                         "Continue working on this today: " + '\n' + SubDesc,
                                         IsComplete,
                                         date.AddDays(p / 3 + 1));
                    }
                }

                if (taskcomplex == "VERYHIGH")
                {
                    if (p > 5)
                    {
                        InsertSchoolTask(TaskUser, TaskCategory,
                                         IntelligentColor(TaskCategoryColour),
                                         TaskComplexity,
                                         TaskSubType,
                                         Description,
                                         "Continue working on this today (you can be proud of yourself for all your hard work): " + '\n' + SubDesc,
                                         IsComplete,
                                         date.AddDays(p / 2));
                    }
                }
            }

            //__________________________________Par coeur_________________________
            if (TaskCategory.Code == "SCHOOL" && TaskSubType.Code == "BY_HEART")
            {
                if (p >= 1 && taskcomplex == "LOW")
                {
                    InsertSchoolTask(TaskUser, TaskCategory,
                                     IntelligentColor(TaskCategoryColour),
                                     TaskComplexity,
                                     TaskSubType,
                                     Description,
                                     "Start learning: " + '\n' + SubDesc,
                                     IsComplete,
                                     date.AddDays(1 + p / 2));
                }
                if (p >= 1 && taskcomplex == "MEDIUM")
                {
                    if (p == 1)
                    {
                        InsertSchoolTask(TaskUser, TaskCategory,
                                         IntelligentColor(TaskCategoryColour),
                                         TaskComplexity,
                                         TaskSubType,
                                         Description,
                                         "Start learning: " + '\n' + SubDesc,
                                         IsComplete,
                                         date.AddDays(1));
                    }

                    if (p == 3)
                    {
                        InsertSchoolTask(TaskUser, TaskCategory,
                                         IntelligentColor(TaskCategoryColour),
                                         TaskComplexity,
                                         TaskSubType,
                                         Description,
                                         "Start learning: " + '\n' + SubDesc,
                                         IsComplete,
                                         date.AddDays(2));
                    }

                    if (p >= 3)
                    {
                        InsertSchoolTask(TaskUser, TaskCategory,
                                         IntelligentColor(TaskCategoryColour),
                                         TaskComplexity,
                                         TaskSubType,
                                         Description,
                                         "Start learning: " + '\n' + SubDesc,
                                         IsComplete,
                                         date.AddDays(p));

                        InsertSchoolTask(TaskUser, TaskCategory,
                                         IntelligentColor(TaskCategoryColour),
                                         TaskComplexity,
                                         TaskSubType,
                                         Description,
                                         "Continue learning: " + '\n' + SubDesc,
                                         IsComplete,
                                         date.AddDays(p * 2));
                    }
                }
                if (taskcomplex == "HIGH" || taskcomplex == "VERY_HIGH")
                {
                    if (p >= 1)
                    {
                        InsertSchoolTask(TaskUser, TaskCategory,
                                         IntelligentColor(TaskCategoryColour),
                                         TaskComplexity,
                                         TaskSubType,
                                         Description,
                                         "Start making notes and doing exercices for: " + '\n' + SubDesc,
                                         IsComplete,
                                         date.AddDays(1));
                    }

                    for (int i = 2; i < p; i += 2)
                    {
                        InsertSchoolTask(TaskUser, TaskCategory,
                                         IntelligentColor(TaskCategoryColour),
                                         TaskComplexity,
                                         TaskSubType,
                                         Description,
                                         "Continue learning and don't forget, consistency is the key to sucess! : " + '\n' + SubDesc,
                                         IsComplete,
                                         date.AddDays(i));
                    }
                }
            }

            //__________________________________Projet_________________________
            // POUR TOUT LES WEEKEND JUSQU'A DUE DATE ON MET UN RAPPEL DE CONTINUER LE PROJET AVEC LE TEMPS LIBRE SI TRES COMPLIQUE
            // RAPEL QUE LE DIMANCHE SI COMPLIQUE
            // RAPPEL UN DIMANCHE SUR DEUX SI PEU COMPLIQUE

            string restday = MyUser.me.RestDay;

            daysleft = (DueDate.Date - date.Date);
            if (TaskCategory.Code == "SCHOOL" && TaskSubType.Code == "PROJECT")
            {
                if (taskcomplex == "VERY_HIGH")
                {
                    for (int i = 1; i < p; i += 1)
                    {
                        DateTime thisday = date.Date.AddDays(i);
                        if (IsDay(thisday.DayOfWeek) || thisday.DayOfWeek == DayOfWeek.Wednesday)
                        {
                            InsertSchoolTask(TaskUser, TaskCategory,
                                             IntelligentColor(TaskCategoryColour),
                                             TaskComplexity,
                                             TaskSubType,
                                             Description,
                                             "Don't forget to work on this projet: " + '\n' + SubDesc,
                                             IsComplete,
                                             date.AddDays(i));
                            i += 1;
                        }
                    }
                }

                if (taskcomplex == "HIGH")
                {
                    for (int i = 1; i < p; i += 1)
                    {
                        DateTime thisday = DateTime.Now.Date.AddDays(i);
                        if (IsDay(thisday.DayOfWeek))
                        {
                            InsertSchoolTask(TaskUser, TaskCategory,
                                             IntelligentColor(TaskCategoryColour),
                                             TaskComplexity,
                                             TaskSubType,
                                             Description,
                                             "Weekend means more time to work on this projet: " + '\n' + SubDesc,
                                             IsComplete,
                                             date.AddDays(i));
                            i += 6;
                        }
                    }
                }

                if (taskcomplex == "LOW" || taskcomplex == "MEDIUM")
                {
                    int lastweek = 0;
                    for (int i = 1; i < p; i += 1)
                    {
                        DateTime thisday = DateTime.Now.Date.AddDays(i);
                        if (IsDay(thisday.DayOfWeek))
                        {
                            if (lastweek == 0)
                            {
                                InsertSchoolTask(TaskUser, TaskCategory,
                                                 IntelligentColor(TaskCategoryColour),
                                                 TaskComplexity,
                                                 TaskSubType,
                                                 Description,
                                                 "Weekend means more time to work on this projet, work today and have more free time next weekend: " + '\n' + SubDesc,
                                                 IsComplete,
                                                 date.AddDays(i));

                                lastweek = 1;
                            }
                            else
                            {
                                lastweek = 0;
                            }
                            i += 13;
                        }
                    }
                }
            }
        }
        // Use: example for Picker:
        //
        //ListHelper lh = new ListHelper("ACCOMODATION_TYPES", MyUser.me.AccomodationType.Id, "");
        //Accomodation_type.ItemsSource = lh.DisplayList;
        //Accomodation_type.SelectedIndex = lh.CurrentIndex;
        //
        // When item selected in Picker list then can get details using:
        // int selectedId = lh.IdList(picker.SelectedIndex);
        // string selectedCode = lh.CodeList(picker.SelectedIndex);
        // string selectedDisplay = lh.DisplayList(picker.SelectedIndex);

        public ListHelper(string pListType, int pCurrentId, string pCurrentCode)
        {
            if (pListType == "DAYS")
            {
                DisplayList = DayDescList;
                CodeList    = DayCodeList;
                IdList      = new List <int>();

                CurrentCode = pCurrentCode;

                switch (pCurrentCode)
                {
                case "MON": CurrentIndex = 0; break;

                case "TUE": CurrentIndex = 1; break;

                case "WED": CurrentIndex = 2; break;

                case "THU": CurrentIndex = 3; break;

                case "FRI": CurrentIndex = 4; break;

                case "SAT": CurrentIndex = 5; break;

                case "SUN": CurrentIndex = 6; break;

                default: CurrentIndex = -1; break;
                }

                CurrentDesc = DayDescList [CurrentIndex];
            }
            else
            {
                DisplayList   = new List <string>();
                CodeList      = new List <string>();
                IdList        = new List <int>();
                ListEntryList = new List <ListEntry>();

                var col     = Database.db.GetCollection <ListEntry>("ListEntries");
                var results = col.Find(Query.EQ("Type", pListType)).OrderBy(x => x.Description);
                int i       = 0;

                foreach (var entry in results)
                {
                    if (!(CodeList.Contains(entry.Code)))
                    {
                        CodeList.Add(entry.Code);
                    }

                    if (!(DisplayList.Contains(entry.Description)))
                    {
                        DisplayList.Add(entry.Description);
                    }

                    if (!(ListEntryList.Contains(entry)))
                    {
                        ListEntryList.Add(entry);
                    }

                    if (entry.Id == pCurrentId)
                    {
                        CurrentIndex     = i;
                        CurrentCode      = entry.Code;
                        CurrentDesc      = entry.Description;
                        CurrentListEntry = entry;
                    }

                    i++;
                }
            }
        }
 public void GetDescAndColour(Entry Name, String CodeForEntry)
 {
     Name.Text = ListEntry.getEntryfromTypeAndCode("COLOURS", CodeForEntry).Description;
     ListEntry.getEntryfromTypeAndCode("COLOURS", CodeForEntry).Description = Name.Text;
 }
示例#10
0
        public static void InsertWorkout(
            ListEntry ex1,
            ListEntry ex2,
            ListEntry ex3,
            ListEntry ex4,
            ListEntry ex5,
            ListEntry ex6,
            ListEntry ex7,
            ListEntry ex8,
            ListEntry ex9,
            ListEntry ex10,
            DateTime DueDate,
            String Type)
        {
            // Get a collection (or create, if doesn't exist)
            var col = Database.db.GetCollection <Workout>("AllWorkouts");

            // Index document using these properties
            col.EnsureIndex(x => x.Exercice1);
            col.EnsureIndex(x => x.Exercice2);
            col.EnsureIndex(x => x.Exercice3);
            col.EnsureIndex(x => x.Exercice4);
            col.EnsureIndex(x => x.Exercice5);
            col.EnsureIndex(x => x.Exercice6);
            col.EnsureIndex(x => x.Exercice7);
            col.EnsureIndex(x => x.Exercice8);
            col.EnsureIndex(x => x.Exercice9);
            col.EnsureIndex(x => x.Exercice10);
            col.EnsureIndex(x => x.DueDate);
            col.EnsureIndex(x => x.Type);

            // Create initial data
            col.Insert(
                new Workout
            {
                Exercice1  = ex1,
                Exercice2  = ex2,
                Exercice3  = ex3,
                Exercice4  = ex4,
                Exercice5  = ex5,
                Exercice6  = ex6,
                Exercice7  = ex7,
                Exercice8  = ex8,
                Exercice9  = ex9,
                Exercice10 = ex10,
                DueDate    = DueDate,
                Type       = Type
            }
                );

            SchoolTask.InsertSchoolTask(MyUser.me, ListEntry.getEntryfromTypeAndCode("TASK_CATEGORIES", "PERSONAL"), ListEntry.getEntryfromTypeAndCode("COLOURS", "WHITE"),
                                        ListEntry.getEntryfromTypeAndCode("TASK_COMPLEXITIES", "MEDIUM"), ListEntry.getEntryfromTypeAndCode("TASK_SUBTYPE_PERS", "SPORT"), "My workout", "Your very own workout session is waiting for you, go to My workouts", false, DueDate);
        }