Exemplo n.º 1
0
        public string GetDatabasePassword(string databaseName)
        {
            Debug.Assert(!String.IsNullOrEmpty(databaseName));
            using (DataClassesTestorCoreDataContext dataContext = new DataClassesTestorCoreDataContext(TestorSecurityProvider.ConnectionString))
            {
                SystemEventsLog logMessage = new SystemEventsLog();
                logMessage.EventCode = (short)LogEventCodes.GetDatabasePassword;
                logMessage.EventTime = DateTime.Now;
                logMessage.Login     = String.Empty;
                logMessage.EventText = "GetDatabasePassword";
                dataContext.SystemEventsLogs.InsertOnSubmit(logMessage);
                dataContext.SubmitChanges();

                Dictionary <string, string> databases = new Dictionary <string, string>();
                databases.Add("master", "JHUIOPitr&*$*&gYIr%$%*()&*");
                databases.Add("model", "njpi[#EHpjkhnn98)I");
                databases.Add("msdb", "HBJhb&^gUIFf)&T()&*(");
                databases.Add("tempdb", "06478523-9316-465a-A2EB-3C3FDCE7717A");
                databases.Add("ReportServer$SQLEXPRESS", "test");
                databases.Add("ReportServer$SQLEXPRESSTempDB", "report123CFSDfv#");
                databases.Add("Northwind", "adminadmin");
                databases.Add("testdb", "passwordtestdbQWERTY12345!@#$%^");
                databases.Add("testdbBackup", "passwordtestdbQWERTY12345!@#$%^BACKUP");
                return(databases[databaseName]);
            }
        }
Exemplo n.º 2
0
        public string[] GetDatabaseNamesList()
        {
            using (DataClassesTestorCoreDataContext dataContext = new DataClassesTestorCoreDataContext(TestorSecurityProvider.ConnectionString))
            {
                SystemEventsLog logMessage = new SystemEventsLog();
                logMessage.EventCode = (short)LogEventCodes.GetDatabaseNamesList;
                logMessage.EventTime = DateTime.Now;
                logMessage.Login     = String.Empty;
                logMessage.EventText = "GetDatabaseNamesList";
                dataContext.SystemEventsLogs.InsertOnSubmit(logMessage);
                dataContext.SubmitChanges();

                Dictionary <string, string> databases = new Dictionary <string, string>();
                databases.Add("master", "JHU&*");
                databases.Add("model", "n98)I");
                databases.Add("msdb", "HBJhb&^g");
                databases.Add("tempdb", "0647EB-3C3FDCE7717A");
                databases.Add("ReportServer$SQLEXPRESS", "tsd;fk");
                databases.Add("ReportServer$SQLEXPRESSTempDB", "repoDfv#");
                databases.Add("Northwind", "adminadmin");
                databases.Add("testdb", "passwors;ldkasdfka;sd;SDKWPO^");
                databases.Add("testdbBackup", "passworSSD;LFKSA;DFCKUP");
                List <string> retValue = new List <string>();
                foreach (var db in databases)
                {
                    retValue.Add(db.Key);
                }
                return(retValue.ToArray());
            }
        }
Exemplo n.º 3
0
        public void ChangeSessionScore(int sessionId, double score)
        {
            Debug.Assert(sessionId > 0);
            Debug.Assert(score >= 0);

            Provider.TestRoles(TestorUserRole.Administrator, TestorUserRole.Teacher, TestorUserRole.Laboratorian);

            using (DataClassesTestorCoreDataContext dataContext = new DataClassesTestorCoreDataContext(TestorSecurityProvider.ConnectionString))
            {
                var currentSession = dataContext.TestSessions.Where(c => c.TestSessionId == sessionId).First();

                SystemEventsLog logMessage = new SystemEventsLog();
                logMessage.EventCode = (short)LogEventCodes.ChangeSessionScore;
                logMessage.EventTime = DateTime.Now;
                logMessage.Login     = Provider.CurrentUser.Login;
                logMessage.EventText = String.Format("ChangeSessionScore. SessionId: {0}; UserId={1}; Score: {2}; NewScore: {3}",
                                                     sessionId, currentSession.UserId, currentSession.Score, score);
                dataContext.SystemEventsLogs.InsertOnSubmit(logMessage);

                currentSession.Score = score;
                double passingScore = currentSession.CoreTest.PassingScore;
                if (passingScore != 0)
                {
                    if (currentSession.Score >= passingScore)
                    {
                        currentSession.IsPassed = true;
                    }
                    else
                    {
                        currentSession.IsPassed = false;
                    }
                }
                else
                {
                    currentSession.IsPassed = true;
                }

                dataContext.SubmitChanges();
            }
        }
Exemplo n.º 4
0
        public void DeleteSession(int sessionId)
        {
            Debug.Assert(sessionId > 0);

            Provider.TestRoles(TestorUserRole.Administrator, TestorUserRole.Teacher, TestorUserRole.Laboratorian);

            using (DataClassesTestorCoreDataContext dataContext = new DataClassesTestorCoreDataContext(TestorSecurityProvider.ConnectionString))
            {
                var testSession = dataContext.TestSessions.Where(c => c.TestSessionId == sessionId).First();

                SystemEventsLog logMessage = new SystemEventsLog();
                logMessage.EventCode = (short)LogEventCodes.SessionDeleted;
                logMessage.EventTime = DateTime.Now;
                logMessage.Login     = Provider.CurrentUser.Login;
                logMessage.EventText = String.Format("Session deleted: UserId:{0};Score:{1};Test:{2}", testSession.UserId, testSession.Score, testSession.TestId);
                dataContext.SystemEventsLogs.InsertOnSubmit(logMessage);

                dataContext.TestSessionQuestions.DeleteAllOnSubmit(testSession.TestSessionQuestions);
                dataContext.TestSessions.DeleteOnSubmit(testSession);
                dataContext.SubmitChanges();
            }
        }