public async Task <bool> CheckInPeriod(IStObjMap stObjMap, IAuthenticationInfo authenticationInfo)
        {
            var sqlDatabase = stObjMap.StObjs.Obtain <SqlDefaultDatabase>();
            var group       = stObjMap.StObjs.Obtain <CustomGroupTable>();
            int userId      = authenticationInfo.ActualUser.UserId;

            using (var ctx = new SqlStandardCallContext())
            {
                GroupQueries       groupQueries       = new GroupQueries(ctx, sqlDatabase);
                TimedPeriodQueries timedPeriodQueries = new TimedPeriodQueries(ctx, sqlDatabase);

                GroupData groupData = await groupQueries.GetIdSchoolByConnectUser(userId);

                PeriodData periodData = await timedPeriodQueries.GetCurrentPeriod(groupData.ZoneId);

                DateTime currentDateTime        = DateTime.UtcNow;
                int      shoulbBeLowerOrEqual   = DateTime.Compare(periodData.BegDate, currentDateTime);
                int      shouldBeGreaterOrEqual = DateTime.Compare(periodData.EndDate, currentDateTime);

                if (shoulbBeLowerOrEqual > 0 || shouldBeGreaterOrEqual < 0)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
        public async Task <bool> isMailExisting(string email, IStObjMap stObjMap)
        {
            try
            {
                SqlDefaultDatabase db = stObjMap.StObjs.Obtain <SqlDefaultDatabase>();
                using (var ctx = new SqlStandardCallContext())
                {
                    UserQueries groupQueries = new UserQueries(ctx, db);
                    int         exists       = await groupQueries.CheckEmail(email);

                    if (exists != 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch
            {
                return(false);
            }
        }
        public async Task <bool> CheckPeriodGivenDate(IStObjMap stObjMap, IAuthenticationInfo authenticationInfo, DateTime begDate, DateTime endDate)
        {
            var sqlDatabase = stObjMap.StObjs.Obtain <SqlDefaultDatabase>();
            var group       = stObjMap.StObjs.Obtain <CustomGroupTable>();
            int userId      = authenticationInfo.ActualUser.UserId;

            using (var ctx = new SqlStandardCallContext())
            {
                GroupQueries       groupQueries       = new GroupQueries(ctx, sqlDatabase);
                TimedPeriodQueries timedPeriodQueries = new TimedPeriodQueries(ctx, sqlDatabase);

                GroupData groupData = await groupQueries.GetIdSchoolByConnectUser(userId);

                PeriodData periodData = await timedPeriodQueries.GetCurrentPeriod(groupData.ZoneId);

                int shouldBeGreater = begDate.CompareTo(periodData.BegDate);
                int shouldBeLower   = endDate.CompareTo(periodData.EndDate);

                if (shouldBeGreater >= 0 && shouldBeLower <= 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Beispiel #4
0
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
        public void Deconstruct(out StObjCollectorResult collector, out IStObjMap map, out StObjContextRoot.ServiceRegister serviceRegister, out ServiceProvider services)
        {
            collector       = CollectorResult;
            map             = Map;
            serviceRegister = ServiceRegister;
            services        = Services;
        }
Beispiel #5
0
        public async Task <int> CheckIfUserExists(IStObjMap stObjMap, IAuthenticationInfo authenticationInfo, string mail, string userName, string firstName, string lastName)
        {
            using (var ctx = new SqlStandardCallContext())
            {
                var sqlDatabase = stObjMap.StObjs.Obtain <SqlDefaultDatabase>();
                var userTable   = stObjMap.StObjs.Obtain <CustomUserTable>();
                var actorEmail  = stObjMap.StObjs.Obtain <ActorEMailTable>();
                var basic       = stObjMap.StObjs.Obtain <IBasicAuthenticationProvider>();

                UserQueries userQueries = new UserQueries(ctx, sqlDatabase);

                int currentIdUser = authenticationInfo.ActualUser.UserId;

                int idUser = await userQueries.CheckEmail(mail);

                if (idUser != 0)
                {
                    return(idUser);
                }
                else
                {
                    string tempPwd     = RandomPassword();
                    string subject     = "Vous êtes invité à rejoindre la plateforme InProject";
                    string mailContent = "Afin de vous connectez a la plateforme InProject voici votre mot de passe provisoire: " + tempPwd + " il est conseillé de modifier ce mot de passe lors de votre première connection";
                    int    newUserId   = await userTable.CreateUserAsync(ctx, currentIdUser, userName, firstName, lastName);

                    await actorEmail.AddEMailAsync(ctx, 1, newUserId, mail, true, false);

                    await basic.CreateOrUpdatePasswordUserAsync(ctx, 1, newUserId, tempPwd);

                    //await _emailSender.SendMessage( mail, subject, mailContent );
                    return(newUserId);
                }
            }
        }
Beispiel #6
0
 /// <summary>
 /// Initializes a new <see cref="StObjMapAccessedEventArgs"/>.
 /// </summary>
 /// <param name="current">The current StObjMap. Must not be null.</param>
 /// <param name="deltaLastAccess">Time span from last access.</param>
 /// <param name="loadedTime">The current loaded time.</param>
 public StObjMapAccessedEventArgs(IStObjMap current, TimeSpan deltaLastAccess, TimeSpan loadedTime)
 {
     Throw.CheckNotNullArgument(current);
     Current             = current;
     DeltaLastAccessTime = deltaLastAccess;
     CurrentLoadedTime   = loadedTime;
 }
Beispiel #7
0
 public AccountController(IOptions <SpaOptions> spaOptions, IAuthenticationTypeSystem typeSystem, IStObjMap stObjMap, IWebFrontAuthLoginService loginService, IAuthenticationInfo authenticationInfo)
 {
     _spaOptions         = spaOptions;
     _typeSystem         = typeSystem;
     _stObjMap           = stObjMap;
     _loginService       = loginService;
     _authenticationInfo = authenticationInfo;
 }
            /// <summary>
            /// Registers the map, the Real objects, singleton services and scoped services.
            /// Caution: this never throws, instead any exception is logged and false is returned.
            /// </summary>
            /// <param name="map">The map to register. Must not be null.</param>
            /// <returns>
            /// True on success, false if any <see cref="LogLevel.Fatal"/> or <see cref="LogLevel.Error"/> has been logged or if an exception has been thrown.
            /// </returns>
            public bool AddStObjMap(IStObjMap map)
            {
                bool result = true;

                using (Monitor.OnError(() => result = false))
                    using (Monitor.OpenInfo("Configuring Service collection from StObjMap."))
                    {
                        try
                        {
                            Throw.CheckNotNullArgument(map);
                            DoRegisterSingletonInstance(typeof(IStObjMap), map, isRealObject: true, isMultiple: false);
                            map.StObjs.ConfigureServices(this);
                            foreach (var o in map.StObjs.FinalImplementations)
                            {
                                DoRegisterSingletonInstance(o.ClassType, o.Implementation, isRealObject: true, isMultiple: false);
                                foreach (var u in o.UniqueMappings)
                                {
                                    DoRegisterSingletonInstance(u, o.Implementation, isRealObject: true, isMultiple: false);
                                }
                                foreach (var mult in o.MultipleMappings)
                                {
                                    DoRegisterSingletonInstance(mult, o.Implementation, isRealObject: true, true);
                                }
                            }
                            foreach (var s in map.Services.SimpleMappingList)
                            {
                                Register(s.ClassType, s.FinalType, s.IsScoped, allowMultipleRegistration: false);
                                foreach (var u in s.UniqueMappings)
                                {
                                    Register(u, s.FinalType, s.IsScoped, allowMultipleRegistration: false);
                                }
                                foreach (var mult in s.MultipleMappings)
                                {
                                    Register(mult, s.FinalType, s.IsScoped, allowMultipleRegistration: true);
                                }
                            }
                            foreach (var s in map.Services.ManualMappingList)
                            {
                                Register(s.ClassType, s.CreateInstance, s.IsScoped, allowMultipleRegistration: false);
                                foreach (var u in s.UniqueMappings)
                                {
                                    Register(u, s.CreateInstance, s.IsScoped, allowMultipleRegistration: false);
                                }
                                foreach (var mult in s.MultipleMappings)
                                {
                                    Register(mult, s.CreateInstance, s.IsScoped, allowMultipleRegistration: true);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Monitor.Error("While registering StObjMap.", ex);
                        }
                    }
                return(result);
            }
 public AutoCreateAccountService(
     IAuthenticationDatabaseService dbAuth,
     IStObjMap stObjMap,
     IAuthenticationTypeSystem typeSystem
     )
 {
     _stObjMap   = stObjMap;
     _dbAuth     = dbAuth;
     _typeSystem = typeSystem;
 }
Beispiel #10
0
        StObjContextRoot.ServiceRegister IStObjEngineTestHelperCore.GetFailedAutomaticServicesConfiguration(StObjCollector c,
                                                                                                            Func <StObjEngineConfiguration, StObjEngineConfiguration>?engineConfigurator,
                                                                                                            SimpleServiceContainer?startupServices)
        {
            IStObjMap map = DoCompileAndLoadStObjMap(c, engineConfigurator, useEmbeddedStObjMapIfPossible: false).Map;
            var       reg = new StObjContextRoot.ServiceRegister(TestHelper.Monitor, new ServiceCollection(), startupServices);

            reg.AddStObjMap(map).Should().BeFalse("Service configuration failed.");
            return(reg);
        }
Beispiel #11
0
        public async Task ForumNumberParser(IStObjMap stObjMap, List <ProjectNumbers> projectNumbers, IAuthenticationInfo authenticationInfo)
        {
            using (var ctx = new SqlStandardCallContext())
            {
                var             sqlDatabase     = stObjMap.StObjs.Obtain <SqlDefaultDatabase>();
                GroupQueries    projectQueries  = new GroupQueries(ctx, sqlDatabase);
                ForumInfosTable forumInfosTable = stObjMap.StObjs.Obtain <ForumInfosTable>();
                int             userId          = authenticationInfo.ActualUser.UserId;
                GroupData       groupData       = await projectQueries.GetIdSchoolByConnectUser(userId);

                foreach (ProjectNumbers projectNumber in projectNumbers)
                {
                    int projectId = await projectQueries.GetSpecificIdGroupByZoneIdAndGroupName(groupData.ZoneId, projectNumber.ProjectName);

                    if (projectId == 0)
                    {
                        Console.WriteLine("-----" + projectNumber.ProjectName);
                    }
                    await forumInfosTable.CreateForumInfo(ctx, projectId, "", -1, -1, 4, 3, projectNumber.ProjectNumber);
                }
            }
        }
Beispiel #12
0
        ServiceProvider DoCreateAutomaticServices(SimpleServiceContainer?startupServices, IStObjMap current)
        {
            var services = new ServiceCollection();
            var reg      = new StObjContextRoot.ServiceRegister(TestHelper.Monitor, services, startupServices);

            var configureArgs = new AutomaticServicesConfigurationEventArgs(current, reg);
            var hIng          = _automaticServicesConfiguring;

            if (hIng != null)
            {
                using (_monitor.Monitor.OpenInfo("Raising Automatic services configuring event."))
                {
                    hIng(this, configureArgs);
                }
            }
            if (!reg.AddStObjMap(current))
            {
                Throw.Exception("AddStObjMap failed. The logs contains detailed information.");
            }
            var hEd = _automaticServicesConfigured;

            if (hEd != null)
            {
                using (_monitor.Monitor.OpenInfo("Raising Automatic services configured event."))
                {
                    hEd(this, configureArgs);
                }
            }
            return(services.BuildServiceProvider());
        }
Beispiel #13
0
 public ForumController(IStObjMap stObjMap, IAuthenticationInfo authenticationInfo)
 {
     _stObjMap           = stObjMap;
     _authenticationInfo = authenticationInfo;
 }
 internal CompileAndLoadResult(GenerateCodeResult c, IStObjMap map)
 {
     GenerateCodeResult = c;
     Map = map;
 }
 public EventController(IStObjMap stObjMap, IAuthenticationInfo authenticationInfo)
 {
     _stObjMap           = stObjMap;
     _authenticationInfo = authenticationInfo;
     _typeEvents         = GetEventType();
 }
        /// <summary>
        /// Configures this <see cref="IServiceCollection"/> by registering the <see cref="IStObjMap.StObjs"/> and
        /// the <paramref name="map"/> itself as Singletons, by calling <see cref="StObjContextRoot.RegisterStartupServicesMethodName"/>
        /// and then <see cref="StObjContextRoot.ConfigureServicesMethodName"/> on all the <see cref="IStObjObjectMap.FinalImplementations"/> that expose
        /// such methods and by registering the <see cref="IStObjServiceMap.SimpleMappings"/> and <see cref="IStObjServiceMap.ManualMappings"/> mappings.
        /// Any attempt to register an already registered service will be ignored and a warning will be emitted.
        /// <para>
        /// If the registration fails for any reason (file not found, type conflicts, etc.), a <see cref="CKException"/> is thrown.
        /// </para>
        /// </summary>
        /// <param name="services">This service collection to configure.</param>
        /// <param name="monitor">The monitor to use. Must not be null.</param>
        /// <param name="map">StObj map to register. Can not be null.</param>
        /// <param name="startupServices">
        /// Optional simple container that may provide startup services. This is not used to build IRealObject
        /// (they must be independent of any "dynamic" services), however registered services become available to
        /// any <see cref="StObjContextRoot.ConfigureServicesMethodName"/> methods by parameter injection.
        /// </param>
        /// <returns>This services collection.</returns>
        public static IServiceCollection AddStObjMap(this IServiceCollection services, IActivityMonitor monitor, IStObjMap map, SimpleServiceContainer?startupServices = null)
        {
            var reg = new StObjContextRoot.ServiceRegister(monitor, services, startupServices);

            if (!reg.AddStObjMap(map))
            {
                throw new CKException("AddStObjMap failed. The logs contains detailed information.");
            }
            return(services);
        }
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
        public void Deconstruct(out StObjCollectorResult result, out IStObjMap map)
        {
            result = CollectorResult;
            map    = Map;
        }
Beispiel #18
0
 public UserController(IStObjMap stObjMap, IAuthenticationInfo authenticationInfo, Emailer emailer)
 {
     _stObjMap           = stObjMap;
     _authenticationInfo = authenticationInfo;
     _emailer            = emailer;
 }
Beispiel #19
0
 public DownloadFile(IStObjMap stObjMap)
 {
     _stObjMap = stObjMap;
 }
Beispiel #20
0
        public static async Task <(bool, string)> RegisterProject(
            string url,
            int projectNumber,
            ProjectStudentTable projectTable,
            int userId,
            SqlDefaultDatabase db,
            CustomGroupTable groupTable,
            IStObjMap stObjMap,
            ProjectUrlTable projectUrlTable
            )
        // given url, we register the project if he can be downloaded and parsed
        {
            string  tomlString;
            Project toml;
            Type    projectType;

            try    // get the type of the project
            {
                projectType = new Type[] { typeof(ProjectPi), typeof(ProjectPfh) }[projectNumber];
            }
            catch
            {
                return(false, "Le numéro pour le type de projet n'est pas bon.");
            }

            try    // to get the ressource
            {
                tomlString = GetOnlineToml(GetTomlFromGoogleDrive.GetUrlRessource(url));
            }
            catch
            {
                return(false, "La ressource n'est pas trouvée, peut-être que le liens n'est pas le bon.");
            }

            try    // parse the toml
            {
                var method = typeof(TomlHelpers).GetMethod("GetInstanceFromToml");
                method = method.MakeGenericMethod(projectType);
                toml   = (Project)method.Invoke(null, new object[] { tomlString });
            }
            catch (Exception e)
            {
                List <string> foo = e.ToString().Split("-->")[1].Split(":").Skip(1).Take(2).ToList();
                foo[1] = foo[1].Split(".")[0];

                return(false, "Impossible de parser le fichier toml, est-ce que le fichier est correctement formaté ?\n" + String.Join(": ", foo));
            }

            (bool isValid, string message) = toml.isValid();
            if (!isValid)               // check if we got fild we want
            {
                return(false, message); // "There is missing or bad field in the toml file");
            }

            toml.logo.url = GetTomlFromGoogleDrive.GetUrlRessource(toml.logo.url);


            if (toml.team.leader != "None" && !await toml.team.isMailExisting(toml.team.leader, stObjMap))
            {
                return(false, "L'e-mail du chef de projet est invalide.");
            }
            foreach (string mail in toml.team.members)
            {
                if (!await toml.team.isMailExisting(mail, stObjMap))
                {
                    return(false, "L'un des e-mails des membres est invalide.");
                }
            }
            ;
            try    // register the project in the bdd
            {
                await RegisterProjectInBDD.SaveProject(projectType, toml, userId, db, projectTable, groupTable, projectUrlTable);
            }
            catch (Exception e)
            {
                return(false, "Impossible de sauvegarder le projet dans la BDD.");
            }

            return(true, "Le projet a été sauvegarde avec succès.");
        }
 /// <summary>
 /// Initializes a new <see cref="AutomaticServicesConfigurationEventArgs"/>.
 /// </summary>
 /// <param name="map">The current StObjMap. Must not be null.</param>
 /// <param name="serviceRegister">The service register.</param>
 public AutomaticServicesConfigurationEventArgs(IStObjMap map, StObjContextRoot.ServiceRegister serviceRegister)
 {
     Throw.CheckNotNullArgument(map);
     StObjMap        = map;
     ServiceRegister = serviceRegister;
 }
 public ProjectController(IStObjMap stObjMap, IAuthenticationInfo authenticationInfo)
 {
     _stObjMap           = stObjMap;
     _authenticationInfo = authenticationInfo;
     _selectorInt        = GetSelectorInt();
 }
Beispiel #23
0
        public async Task <bool> UserParser(List <UserList> studentList, IStObjMap stObjMap, IAuthenticationInfo authenticationInfo, string type)
        {
            using (var ctx = new SqlStandardCallContext())
            {
                var sqlDatabase    = stObjMap.StObjs.Obtain <SqlDefaultDatabase>();
                var userTable      = stObjMap.StObjs.Obtain <CustomUserTable>();
                var userTimedTable = stObjMap.StObjs.Obtain <TimedUserTable>();
                var groupTable     = stObjMap.StObjs.Obtain <CustomGroupTable>();

                GroupQueries groupQueries = new GroupQueries(ctx, sqlDatabase);
                UserQueries  userQueries  = new UserQueries(ctx, sqlDatabase);

                int       currentUserId = authenticationInfo.ActualUser.UserId;
                GroupData groupData     = await groupQueries.GetIdSchoolByConnectUser(currentUserId);

                int zoneId = groupData.ZoneId;


                foreach (var element in studentList)
                {
                    string   userName      = Guid.NewGuid().ToString();
                    string   firstName     = element.FirstName;
                    string   lastName      = element.Name;
                    int      timedUserType = 0;
                    string[] groupName     = new string[1];
                    string   mail          = element.Mail;
                    int      idUser        = await CheckIfUserExists(stObjMap, authenticationInfo, mail, userName, firstName, lastName);

                    timedUserType = GetTimedUserType(type);
                    if (type == "student")
                    {
                        groupName = element.GroupName.Split('-');
                    }
                    else if (type == "staffMember")
                    {
                        groupName[0] = element.GroupName;
                    }
                    int groupId = await groupQueries.GetIdGroupByNameAndPeriod(groupName[0], zoneId);


                    TimedUserData timedUserData = await userQueries.CheckIfTimedUserExists(idUser, zoneId);

                    if (timedUserData == null)
                    {
                        await userTimedTable.CreateOrUpdateTimedUserAsync(ctx, timedUserType, zoneId, idUser);

                        groupTable.AddUser(ctx, currentUserId, groupId, idUser, true);
                        if (type == "student" && groupName[1] != "A")
                        {
                            int sector = await groupQueries.GetIdGroupByNameAndPeriod(groupName[1], zoneId);

                            groupTable.AddUser(ctx, currentUserId, sector, idUser, true);
                        }
                    }
                    else
                    {
                        int isUserInGroup = await groupQueries.GetGroupByNamePeriodUser(groupName[0], idUser, zoneId);

                        if (isUserInGroup == 0)
                        {
                            groupTable.AddUser(ctx, currentUserId, groupId, idUser, true);
                            if (type == "student" && groupName[1] != "A")
                            {
                                int sector = await groupQueries.GetIdGroupByNameAndPeriod(groupName[1], zoneId);

                                groupTable.AddUser(ctx, currentUserId, sector, idUser, true);
                            }
                        }
                    }
                }
            }
            return(true);
        }
Beispiel #24
0
        internal async Task AssignProjectToJury(IStObjMap stObjMap, IAuthenticationInfo authenticationInfo, List <JuryInfos> juryInfos, string type)
        {
            using (var ctx = new SqlStandardCallContext())
            {
                var            sqlDatabase    = stObjMap.StObjs.Obtain <SqlDefaultDatabase>();
                var            groupTable     = stObjMap.StObjs.Obtain <CustomGroupTable>();
                var            userTimedTable = stObjMap.StObjs.Obtain <TimedUserTable>();
                EvaluatesTable evaluatesTable = stObjMap.StObjs.Obtain <EvaluatesTable>();

                int          userId       = authenticationInfo.ActualUser.UserId;
                GroupQueries groupQueries = new GroupQueries(ctx, sqlDatabase);
                GroupData    groupData    = await groupQueries.GetIdSchoolByConnectUser(userId);

                string             userName           = Guid.NewGuid().ToString();
                UserQueries        userQueries        = new UserQueries(ctx, sqlDatabase);
                TimedUserQueries   timedUserQueries   = new TimedUserQueries(ctx, sqlDatabase);
                ProjectQueries     projectQueries     = new ProjectQueries(ctx, sqlDatabase);
                TimedPeriodQueries timedPeriodQueries = new TimedPeriodQueries(ctx, sqlDatabase);
                ForumQueries       forumQueries       = new ForumQueries(ctx, sqlDatabase);
                //get the Begdate of the periode
                DateTime begDate = await timedPeriodQueries.GetBegDateOfPeriod(groupData.ZoneId);

                foreach (JuryInfos juryInfo in juryInfos)
                {
                    if (juryInfo.Mail == "*****@*****.**")
                    {
                        Console.WriteLine("ok");
                    }
                    int    enterpriseId  = 0;
                    string groupName     = "Jury " + juryInfo.Jury + "-" + begDate.Year + "/" + begDate.Month;
                    int    timedUserType = 0;
                    //Check if the jury group exists or not at a moment
                    int groupId = await groupQueries.GetSpecificIdGroupByZoneIdAndGroupName(groupData.ZoneId, groupName);

                    if (groupId == 0)
                    {
                        groupId = await groupTable.CreateGroupAsync(ctx, userId, groupData.ZoneId);

                        await groupTable.Naming.GroupRenameAsync(ctx, userId, groupId, groupName);
                    }

                    //Check if the enterprise group exists or not at a moment
                    enterpriseId = await groupQueries.GetSpecificIdGroupByZoneIdAndGroupName(groupData.ZoneId, juryInfo.Entreprise);

                    if (enterpriseId == 0)
                    {
                        enterpriseId = await groupTable.CreateGroupAsync(ctx, userId, groupData.ZoneId);

                        await groupTable.Naming.GroupRenameAsync(ctx, userId, enterpriseId, juryInfo.Entreprise);
                    }

                    //Check if the user exists
                    int idJury = await CheckIfUserExists(stObjMap, authenticationInfo, juryInfo.Mail, userName, juryInfo.Prenom, juryInfo.Nom);

                    await groupTable.AddUserAsync(ctx, userId, groupId, idJury, true);

                    await groupTable.AddUserAsync(ctx, userId, enterpriseId, idJury, true);

                    //get the timed user type
                    timedUserType = GetTimedUserType(type);

                    //check if the timed user exists
                    TimedUserData timedUserData = await userQueries.CheckIfTimedUserExists(idJury, groupData.ZoneId);

                    if (timedUserData == null)
                    {
                        await userTimedTable.CreateOrUpdateTimedUserAsync(ctx, timedUserType, groupData.ZoneId, idJury);
                    }
                    else
                    {
                        bool isJury = await timedUserQueries.IsJury(timedUserData.TimedUserId);

                        if (!isJury)
                        {
                            await userTimedTable.CreateOrUpdateTimedUserAsync(ctx, timedUserType, groupData.ZoneId, idJury);
                        }
                    }

                    //get the project id by forumnumber
                    ProjectData projectId;
                    string      groupName1 = "Vous êtes libre";
                    string      groupName2 = "Vous êtes libre";
                    string      groupName3 = "Vous êtes libre";
                    string      groupName4 = "Vous êtes libre";
                    TimeSpan    timeSpan1  = new TimeSpan(13, 30, 0);
                    TimeSpan    timeSpan2  = new TimeSpan(14, 15, 0);
                    TimeSpan    timeSpan3  = new TimeSpan(15, 00, 0);
                    TimeSpan    timeSpan4  = new TimeSpan(15, 45, 0);

                    if (juryInfo.Groupe1 != 0)
                    {
                        projectId = await projectQueries.GetProjectIdByForumNumberAndPeriod(juryInfo.Groupe1, groupData.ZoneId);

                        begDate = begDate.Date + timeSpan1;
                        if (await forumQueries.IsProjectJudgedByJury(projectId.ProjectStudentId, groupId) == 0)
                        {
                            await evaluatesTable.EvaluateOrUpdateGradeProject(ctx, groupId, projectId.ProjectStudentId, -1, begDate);
                        }
                        groupName1 = projectId.GroupName;
                    }

                    if (juryInfo.Groupe2 != 0)
                    {
                        projectId = await projectQueries.GetProjectIdByForumNumberAndPeriod(juryInfo.Groupe2, groupData.ZoneId);

                        begDate = begDate.Date + timeSpan2;
                        if (await forumQueries.IsProjectJudgedByJury(projectId.ProjectStudentId, groupId) == 0)
                        {
                            await evaluatesTable.EvaluateOrUpdateGradeProject(ctx, groupId, projectId.ProjectStudentId, -1, begDate);
                        }
                        groupName2 = projectId.GroupName;
                    }

                    if (juryInfo.Groupe3 != 0)
                    {
                        projectId = await projectQueries.GetProjectIdByForumNumberAndPeriod(juryInfo.Groupe3, groupData.ZoneId);

                        begDate = begDate.Date + timeSpan3;
                        if (await forumQueries.IsProjectJudgedByJury(projectId.ProjectStudentId, groupId) == 0)
                        {
                            await evaluatesTable.EvaluateOrUpdateGradeProject(ctx, groupId, projectId.ProjectStudentId, -1, begDate);
                        }
                        groupName3 = projectId.GroupName;
                    }
                    if (juryInfo.Groupe4 != 0)
                    {
                        projectId = await projectQueries.GetProjectIdByForumNumberAndPeriod(juryInfo.Groupe4, groupData.ZoneId);

                        begDate = begDate.Date + timeSpan4;
                        if (await forumQueries.IsProjectJudgedByJury(projectId.ProjectStudentId, groupId) == 0)
                        {
                            await evaluatesTable.EvaluateOrUpdateGradeProject(ctx, groupId, projectId.ProjectStudentId, -1, begDate);
                        }
                        groupName4 = projectId.GroupName;
                    }

                    IEnumerable <ForumData> infoMail = await forumQueries.ForumInfoByJury(groupName);

                    int nbProject = infoMail.Count();

                    string subject     = "Votre participation au Forum PI D'IN'TECH";
                    string mailContent = @"
            <table align = 'center' border='0' cellpadding='0' cellspacing='0' height='100%' width='100%' id='bodyTable'>
  
                            </tr>
                            <tr>
                                <td valign = 'top' id='templateBody'><table border = '0' cellpadding='0' cellspacing='0' width='100%' class='mcnTextBlock' style='min-width:100%;'>
    <tbody class='mcnTextBlockOuter'>
        <tr>
            <td valign = 'top' class='mcnTextBlockInner' style='padding-top:9px;'>
                <!--[if mso]>
				<table align = 'left' border='0' cellspacing='0' cellpadding='0' width='100%' style='width:100%;'>
				<tr>
				<![endif]-->
			    
				<!--[if mso]>
				<td valign = 'top' width='600' style='width:600px;'>
				<![endif]-->
                <table align = 'left' border='0' cellpadding='0' cellspacing='0' style='max-width:100%; min-width:100%;' width='100%' class='mcnTextContentContainer'>
                    <tbody><tr>
                        
                        <td valign = 'top' class='mcnTextContent' style='padding-top:0; padding-right:18px; padding-bottom:9px; padding-left:18px;'>
                        
                            <h1>Bonjour " + juryInfo.Prenom + " " + juryInfo.Nom + @"</h1>

<p>Vous participez au forum des projets informatique de l'école IN'TECH le " + begDate.Day + "/0" + begDate.Month + "/" + begDate.Year + @".</p>

<p>Vous appartenez au jury '" + groupName + @"'.<br>
Au cours de cet évènement vous aurez l'occasion de juger les projets suivants:&nbsp;</p>

<ul>
	<li>"     + groupName1 + " à " + timeSpan1 + @"</li>
	<li>"     + groupName2 + " à " + timeSpan2 + @"</li>
	<li>"     + groupName3 + " à " + timeSpan3 + @"</li>
	<li>"     + groupName4 + " à " + timeSpan4 + @"</li>
</ul>
Nous vous remercions de l’intérêt que vous portez à nos évènements.<br>
Bonne continuation.
                        </td>
                    </tr>
                </tbody></table>
				<!--[if mso]>
				</td>
				<![endif]-->
                
				<!--[if mso]>
				</tr>
				</table>
				<![endif]-->
            </td>
        </tr>
    </tbody>
</table></td>
                            </tr>
                            <tr>
                                <td valign = 'top' id= 'templateFooter' >
        <td align = 'center' style='padding-left:9px;padding-right:9px;'>
            <table border = '0' cellpadding='0' cellspacing='0' width='100%' style='min-width:100%;' class='mcnFollowContent'>
                <tbody><tr>
                    <td align = 'center' valign='top' style='padding-top:9px; padding-right:9px; padding-left:9px;'>
                        <table align = 'center' border='0' cellpadding='0' cellspacing='0'>
                            <tbody><tr>
                                <td align = 'center' valign='top'>
                                    <!--[if mso]>
                                    <table align = 'center' border='0' cellspacing='0' cellpadding='0'>
                                    <tr>
                                    <![endif]-->

                                </td>
                            </tr>
                        </tbody></table>
                    </td>
                </tr>
            </tbody></table>
        </td>
    </tr>
</tbody></table>

            </td>
        </tr>
    </tbody>
</table>
    <tbody class='mcnDividerBlockOuter'>
        <tr>
            <td class='mcnDividerBlockInner' style='min-width: 100%; padding: 10px 18px 25px;'>
                <table class='mcnDividerContent' border='0' cellpadding='0' cellspacing='0' width='100%' style='min-width: 100%;border-top: 2px solid #EEEEEE;'>
                    <tbody><tr>
                        <td>
                            <span></span>
                        </td>
                    </tr>
                </tbody></table>
<!--            
                <td class='mcnDividerBlockInner' style='padding: 18px;'>
                <hr class='mcnDividerContent' style='border-bottom-color:none; border-left-color:none; border-right-color:none; border-bottom-width:0; border-left-width:0; border-right-width:0; margin-top:0; margin-right:0; margin-bottom:0; margin-left:0;' />
-->
            </td>
        </tr>
    </tbody>
</table>
    <tbody class='mcnTextBlockOuter'>
        <tr>
            <td valign = 'top' class='mcnTextBlockInner' style='padding-top:9px;'>
			    
				<!--[if mso]>
				<td valign = 'top' width='600' style='width:600px;'>
				<![endif]-->
                <table align = 'left' border='0' cellpadding='0' cellspacing='0' style='max-width:100%; min-width:100%;' width='100%' class='mcnTextContentContainer'>
                    <tbody><tr>
                        
                        <td valign = 'top' class='mcnTextContent' style='padding-top:0; padding-right:18px; padding-bottom:9px; padding-left:18px;'>
                        
                            <br>
<br>
<strong>Notre adresse:</strong><br>
74 bis Avenue Maurice Thorez, 94200 Ivry-sur-Seine<br>
Metro 7: Pierre et Marie Curie<br>
<br>
IN'TECH Paris
                        </td>
                    </tr>
                </tbody></table>
				<!--[if mso]>
				</td>
				<![endif]-->
                
				<!--[if mso]>
				</tr>
				</table>
				<![endif]-->
            </td>
        </tr>
    </tbody>
</table></td>
                            </tr>
                        </table>
                        <!--[if (gte mso 9)|(IE)]>
                        </td>
                        </tr>
                        </table>
                        <![endif]-->
                        <!-- // END TEMPLATE -->
                    </td>
                </tr>
            </table>
        </center>
    </body>
</html>";

                    await _emailSender.SendMessage(juryInfo.Mail, subject, mailContent);
                }
            }
        }