internal static AssignmentM Load(int assignmentID)
        {
            //set courseID = 0, it will get overwritten when we load.
            AssignmentM retVal = new AssignmentM(0);

            DatabaseCall dbc = new DatabaseCall("Assignments_LoadAssignment", DBCallType.Select);

            dbc.AddParameter("@AssignmentID", assignmentID);

            DataSet ds = new DataSet();

            dbc.Fill(ds);

            if (ds.Tables.Count <= 0)
            {
                return(null);
            }

            // Populate the return value.
            retVal._assignmentID       = assignmentID;
            retVal.Description         = ds.Tables[0].Rows[0]["Description"].ToString();
            retVal.StarterProjectFlag  = Convert.ToBoolean(ds.Tables[0].Rows[0]["StarterProjectFlag"]);
            retVal.ShortName           = ds.Tables[0].Rows[0]["ShortName"].ToString();
            retVal.CompilerType        = ds.Tables[0].Rows[0]["CompilerType"].ToString();
            retVal.LastUpdatedDate     = Convert.ToDateTime(ds.Tables[0].Rows[0]["LastUpdatedDate"].ToString());
            retVal.LastUpdatedUserID   = Convert.ToInt32(ds.Tables[0].Rows[0]["LastUpdatedUserID"]);
            retVal.DueDate             = Convert.ToDateTime(ds.Tables[0].Rows[0]["DueDate"].ToString());
            retVal.AssignmentURL       = ds.Tables[0].Rows[0]["AssignmentURL"].ToString();
            retVal.CommandLineArgs     = ds.Tables[0].Rows[0]["CommandLineArgs"].ToString();
            retVal.InputFile           = ds.Tables[0].Rows[0]["InputFile"].ToString();
            retVal.OutputFile          = ds.Tables[0].Rows[0]["OutputFile"].ToString();
            retVal.MultipleSubmitsFlag = Convert.ToBoolean(ds.Tables[0].Rows[0]["MultipleSubmitsFlag"]);
            retVal.AutoGradeFlag       = Convert.ToBoolean(ds.Tables[0].Rows[0]["AutoGradeFlag"]);
            retVal.AutoCompileFlag     = Convert.ToBoolean(ds.Tables[0].Rows[0]["AutoCompileFlag"]);
            retVal.SendReminders       = Convert.ToBoolean(ds.Tables[0].Rows[0]["SendReminders"]);
            retVal.SendPastDue         = Convert.ToBoolean(ds.Tables[0].Rows[0]["SendPastDue"]);
            retVal.SendNewProject      = Convert.ToBoolean(ds.Tables[0].Rows[0]["SendNewProject"]);
            retVal.SendUpdatedProject  = Convert.ToBoolean(ds.Tables[0].Rows[0]["SendUpdatedProject"]);
            retVal.GradeType           = Convert.ToByte(ds.Tables[0].Rows[0]["GradeType"]);
            retVal.CourseAssignmentID  = Convert.ToInt32(ds.Tables[0].Rows[0]["CourseAssignmentID"]);
            retVal.ReminderWarningDays = Convert.ToInt32(ds.Tables[0].Rows[0]["ReminderWarningDays"]);
            retVal.PastDueWarningDays  = Convert.ToInt32(ds.Tables[0].Rows[0]["PastDueWarningDays"]);

            retVal.CourseID = Convert.ToInt32(ds.Tables[0].Rows[0]["CourseID"]);
            return(retVal);
        }
Example #2
0
        public void RetrieveElements()
        {
            try
            {
                sourceLocation      = string.Empty;
                projectFileLocation = string.Empty;
                projectName         = String.Empty;
                processTime         = 0;
                buildType           = String.Empty;
                buildPath           = String.Empty;

                AssignmentM assign = AssignmentM.Load(studentAssignment.AssignmentID);

                sourceLocation = assign.StorageDirectory + studentAssignment.UserID;
                sourceLocation = SharedSupport.AddBackSlashToDirectory(sourceLocation.Trim());

                //Get the allowable time to compile
                processTime = Convert.ToInt32(SharedSupport.GetSetting(Constants.MAX_PROCESS_SETTING));

                // get project file location and project name
                ProjectInfo objPI = new ProjectInfo(sourceLocation);
                projectFileLocation = objPI.ProjectFile.Trim();
                projectName         = objPI.ProjectName.Trim();
                buildType           = objPI.ConfigName.Trim();
                buildPath           = objPI.BuildPath.Trim();

                //Copy UserAssignment files to temp location
                ServerAction.CopyDirectories(sourceLocation, workingDirectory, true, true);

                // get the projectFile from the path
                string projectFile = Path.GetFileName(projectFileLocation);

                // change the projectFileLocation because we copied to the working directory
                projectFileLocation = SharedSupport.AddBackSlashToDirectory(workingDirectory) + projectFile;
            }
            catch (Exception ex)
            {
                SharedSupport.HandleError(ex);
            }
        }
Example #3
0
        public void RetrieveElements()
        {
            try
            {
                AssignmentM assign = AssignmentM.Load(studentAssignment.AssignmentID);
                processTime = Convert.ToInt32(SharedSupport.GetSetting(Constants.MAX_PROCESS_SETTING));

                // student source location
                sourceLocation = assign.StorageDirectory + studentAssignment.UserID;

                // get compiled file name (already built by build process)
                ProjectInfo objPI = new ProjectInfo(sourceLocation);
                compiledFileName = objPI.OutputFile;

                inputFileLocation          = assign.InputFile;
                expectedOutputFileLocation = assign.OutputFile;
                actualOutputFile           = expectedOutputFileLocation;
                commandLineParams          = assign.CommandLineArgs;

                compiledFileLocation       = SharedSupport.AddBackSlashToDirectory(workingDirectory) + compiledFileName;
                expectedOutputFileLocation = assign.StorageDirectory + expectedOutputFileLocation;

                //change to use inputFileLocation in tempworkarea
                inputFileLocation = SharedSupport.AddBackSlashToDirectory(assign.StorageDirectory) + inputFileLocation;

                //Get the user's submission folder location
                string userSubmissionRootFolder = SharedSupport.AddBackSlashToDirectory(sourceLocation);

                //Copy all files under the student's submission directory, to the working area.
                ServerAction.CopyDirectories(userSubmissionRootFolder, workingDirectory, true, true);
            }
            catch (Exception ex)
            {
                SharedSupport.HandleError(ex);
            }
        }