internal void Delete() { DatabaseCall dbc = new DatabaseCall("Courses_DeleteCourse", DBCallType.Execute); dbc.AddParameter("@CourseID", this._courseID); dbc.Execute(); }
public void ClearStarter() { DatabaseCall dbc = new DatabaseCall("Assignments_ClearStarter", DBCallType.Execute); dbc.AddParameter("@AssignmentID", _assignmentID); dbc.Execute(); }
public void DeleteResource(int resourceID) { DatabaseCall dbc = new DatabaseCall("Courses_DeleteResource", DBCallType.Execute); dbc.AddParameter("@CourseResourceID", resourceID); dbc.Execute(); }
internal static void Delete(int assignid) { DatabaseCall dbc = new DatabaseCall("Assignments_Purge", DBCallType.Execute); dbc.AddParameter("@AssignmentID", assignid); dbc.Execute(); }
public static void RemoveFromCourse(int userID, int courseID) { DatabaseCall dbc = new DatabaseCall("Users_Purge", DBCallType.Execute); dbc.AddParameter("@UserID", userID); dbc.AddParameter("@CourseID", courseID); dbc.Execute(); }
private void AddFile(string filename) { DatabaseCall dbc = new DatabaseCall("StudentAssignments_AddFile", DBCallType.Execute); dbc.AddParameter("@UserAssignmentID", _userAssignmentID); dbc.AddParameter("@FileName", filename); dbc.Execute(); }
internal static void AbortImport(string importID) { DatabaseCall dbc = new DatabaseCall("Import_AbortImport", DBCallType.Execute); dbc.AddParameter("@ImportID", importID); dbc.Execute(); }
public void ImportToCourse(int courseID, string importID) { DatabaseCall dbc = new DatabaseCall("Users_ImportToCourse", DBCallType.Execute); dbc.AddParameter("@UserID", _userID); dbc.AddParameter("@CourseID", courseID); dbc.AddParameter("@ImportID", importID); dbc.Execute(); }
internal void AddToCourse(int courseID, PermissionsID roleID) { DatabaseCall dbc = new DatabaseCall("Users_AddToCourse", DBCallType.Execute); dbc.AddParameter("@UserID", _userID); dbc.AddParameter("@CourseID", courseID); dbc.AddParameter("RoleID", (int)roleID); dbc.Execute(); }
public void AddResource(string name, string resourceValue) { DatabaseCall dbc = new DatabaseCall("Courses_AddResource", DBCallType.Execute); dbc.AddParameter("@CourseID", _courseID); dbc.AddParameter("@Name", name); dbc.AddParameter("@ResourceValue", resourceValue); dbc.Execute(); }
public void ClearSubmissions() { DatabaseCall dbc = new DatabaseCall("StudentAssignments_ClearSubmissions", DBCallType.Execute); dbc.AddParameter("@UserID", _userID); dbc.AddParameter("@AssignmentID", _assignmentID); dbc.Execute(); }
public static void SetRoleInCourse(int userID, int courseID, int roleID) { DatabaseCall dbc = new DatabaseCall("Roles_UpdateRoleInCourse", DBCallType.Execute); dbc.AddParameter("@UserID", userID); dbc.AddParameter("@CourseID", courseID); dbc.AddParameter("@RoleID", roleID); dbc.Execute(); }
private int SaveAssignmentToDatabase(StoredProcType procType) { int retID = 0; DatabaseCall dbc = null; switch (procType) { case StoredProcType.New: dbc = new DatabaseCall("Assignments_AddNewAssignment", DBCallType.Execute); dbc.AddOutputParameter("@AssignmentID"); dbc.AddOutputParameter("@CourseAssignmentID"); break; case StoredProcType.Update: dbc = new DatabaseCall("Assignments_UpdateExistingAssignment", DBCallType.Execute); dbc.AddParameter("@AssignmentID", this.AssignmentID); break; default: throw new Exception("Invalid Stored Procedure"); } dbc.AddParameter("@ShortName", this.ShortName); dbc.AddNTextParameter("@Description", this.Description); dbc.AddParameter("@LastUpdatedDate", this.LastUpdatedDate); dbc.AddParameter("@LastUpdatedUserID", this.LastUpdatedUserID); dbc.AddParameter("@StarterProjectFlag", this.StarterProjectFlag); dbc.AddParameter("@MakeFile", this.MakeFile); dbc.AddParameter("@CompilerType", this.CompilerType); dbc.AddParameter("@CourseID", this.CourseID); dbc.AddParameter("@DueDate", this.DueDate); dbc.AddParameter("@MultipleSubmitsFlag", this.MultipleSubmitsFlag); dbc.AddParameter("@SendReminders", this.SendReminders); dbc.AddParameter("@AutoGradeFlag", this.AutoGradeFlag); dbc.AddParameter("@InputFile", this.InputFile); // set to either DBNull or String Valu); dbc.AddParameter("@OutputFile", this.OutputFile); // set to either DBNull or String Valu); dbc.AddParameter("@GradeType", this.GradeType); dbc.AddParameter("@AutoCompileFlag", this.AutoCompileFlag); dbc.AddParameter("@AssignmentURL", this.AssignmentURL); // set to either DBNull or String Valu); dbc.AddParameter("@CommandLineArgs", this.CommandLineArgs); dbc.AddParameter("@SendPastDue", this.SendPastDue); dbc.AddParameter("@SendNewProject", this.SendNewProject); dbc.AddParameter("@SendUpdatedProject", this.SendUpdatedProject); dbc.AddParameter("@PastDueWarningDays", this.PastDueWarningDays); dbc.AddParameter("@ReminderWarningDays", this.ReminderWarningDays); dbc.Execute(); if (procType == StoredProcType.New) { retID = Convert.ToInt32(dbc.GetOutputParam("@AssignmentID")); _courseAssignmentID = Convert.ToInt32(dbc.GetOutputParam("@CourseAssignmentID")); } return(retID); }
public void SetPassword(string password, bool hasChanged) { Byte[] passwd = SharedSupport.ConvertStringToByteArray(password.Trim()); byte[] hashValue = ((HashAlgorithm)CryptoConfig.CreateFromName(Constants.HashMethod)).ComputeHash(passwd); string hashedPassword = BitConverter.ToString(hashValue); DatabaseCall dbc = new DatabaseCall("Users_ChangePassword", DBCallType.Execute); dbc.AddParameter("@UserID", _userID); dbc.AddParameter("@Password", hashedPassword); dbc.AddParameter("@ChangedPassword", hasChanged); dbc.Execute(); // This is only true when a faculty member updated someone else's password if (!hasChanged) { SendPasswordToUser(password); } }
private void SaveToDatabase(StoredProcType procType) { DatabaseCall dbc; switch (procType) { case StoredProcType.New: dbc = new DatabaseCall("StudentAssignments_AddNewAssignment", DBCallType.Execute); dbc.AddOutputParameter("@UserAssignmentID"); break; case StoredProcType.Update: dbc = new DatabaseCall("StudentAssignments_UpdateExistingAssignment", DBCallType.Execute); break; default: throw new Exception("Invalid Stored Procedure"); } dbc.AddParameter("@UserID", this._userID); dbc.AddParameter("@AssignmentID", this._assignmentID); dbc.AddParameter("@LastSubmitDate", this._lastSubmitDate); dbc.AddParameter("@LastUpdatedDate", this._lastUpdatedDate); dbc.AddParameter("@OverallGrade", this._overallGrade); dbc.AddNTextParameter("@GradeComments", this._gradeComments); dbc.AddParameter("@AutoCompileStatus", this._autoCompileStatus); dbc.AddParameter("@AutoGradeStatus", this._autoGradeStatus); dbc.AddNTextParameter("@BuildDetails", this._buildDetails); dbc.AddNTextParameter("@CheckDetails", this._checkDetails); dbc.AddParameter("@BuildResultCode", this._buildResultCode); dbc.AddParameter("@CheckResultCode", this._checkResultCode); dbc.Execute(); if (procType == StoredProcType.New) { this._userAssignmentID = Convert.ToInt32(dbc.GetOutputParam("@UserAssignmentID")); } }
/// <summary> /// Sets value in Settings table /// </summary> /// <param name="settingName"> </param> /// <param name="settingValue"> </param> internal static void SetSetting(string settingName, string settingValue) { try { // validate parameters if (settingName.Equals(null) || settingName == String.Empty) { throw new ArgumentNullException(SharedSupport.GetLocalizedString("SharedSupport_SettingNameField"), SharedSupport.GetLocalizedString("SharedSupport_Missing_SettingName")); } if (settingValue.Equals(null) || settingValue == String.Empty) { throw new ArgumentNullException(SharedSupport.GetLocalizedString("SharedSupport_SettingValueField"), SharedSupport.GetLocalizedString("SharedSupport_Missing_SettingValue")); } // if they are changing the AutoBuild/AutoCheck update the Service Status if ((settingName.Equals(Constants.AUTOBUILD_SETTING)) || (settingName.Equals(Constants.AUTOCHECK_SETTING))) { // change the service status if (!changeServiceStatus(settingValue, Constants.ACTION_SERVICE_NAME)) { // throw an exception b/c we couldn't update the service throw new System.Exception(GetLocalizedString("Setting_UnableToUpdateService_Error")); } // no database interaction for the Actions Service } else { //We're changing a setting stored in the database DatabaseCall dbc = new DatabaseCall("Settings_UpdateSetting", DBCallType.Execute); dbc.AddParameter("@Setting", settingName); dbc.AddParameter("@Value", settingValue); dbc.Execute(); } } catch (System.Exception e) { SharedSupport.HandleError(e); } }