private void SendPasswordToUser(string password) { // email if new user if (SharedSupport.UsingSmtp) { string subject = SharedSupport.GetLocalizedString("ChangePassword_NewPasswordEmailSubject"); string body = SharedSupport.GetLocalizedString("ChangePassword_NewPassword_UsernameMessage") + " " + this._username + "\n"; body += SharedSupport.GetLocalizedString("ChangePassword_NewPassword_Message") + " " + password; UserM amsaUser = UserM.Load(Constants.ASSIGNMENTMANAGER_SYSTEM_ADMIN_USERID); MessageM.SendMessage(amsaUser.EmailAddress, this._emailAddress, subject, body); } }
public void SendPasswordToUser() { // use Assignment Manager sysadmin email UserM amsaUser = UserM.Load(Constants.ASSIGNMENTMANAGER_SYSTEM_ADMIN_USERID); string sentByEmail = amsaUser.EmailAddress; string emailSubject = SharedSupport.GetLocalizedString("User_EmailSubject"); string[] replacements = new string[2] { this._username, this._password }; string emailBody = SharedSupport.GetLocalizedString("User_EmailBody", replacements); MessageM.SendMessage(sentByEmail, this._emailAddress, emailSubject, emailBody); }
public bool SubmitStarter(string xmlFileListing, string pathGuid) { if (this.IsValid) { bool submitSuccess = true; try { System.Data.DataSet dsXmlFileListing = new System.Data.DataSet(); System.IO.StringReader reader = new System.IO.StringReader(xmlFileListing); try { System.Xml.XmlTextReader xmlReader = new System.Xml.XmlTextReader(reader); dsXmlFileListing.ReadXml(xmlReader); } catch (Exception ex) { throw new Exception(SharedSupport.GetLocalizedString("UploadDownload_UnableToCopyToServer"), ex); } this.ClearStarter(); string uploadPath = SharedSupport.AddBackSlashToDirectory(System.Web.HttpContext.Current.Request.MapPath(String.Empty, Constants.ASSIGNMENTMANAGER_UPLOAD_DIRECTORY, true)); uploadPath += SharedSupport.AddBackSlashToDirectory(pathGuid); string destinationPath = SharedSupport.AddBackSlashToDirectory(this.StorageDirectory + Constants.STARTER_PROJECT_PATH); try { //Clear old directory if (Directory.Exists(destinationPath)) { Directory.Delete(destinationPath, true); } Directory.CreateDirectory(destinationPath); } catch { } //Save all files and relative paths to assignmentfile table for (int i = 0; i < dsXmlFileListing.Tables[0].Rows.Count; i++) { string filename = dsXmlFileListing.Tables[0].Rows[i]["FileName"].ToString(); if (filename.StartsWith(@"\") || filename.StartsWith(@"/")) { filename = filename.Remove(0, 1); } string sourceFile = String.Empty; string destinationFile = String.Empty; sourceFile = SharedSupport.RemoveIllegalFilePathCharacters(uploadPath + filename); destinationFile = SharedSupport.RemoveIllegalFilePathCharacters(destinationPath + filename); //check to make sure the target directory exists string targetDirectory = destinationFile.Substring(0, destinationFile.LastIndexOf("\\")); if (!Directory.Exists(targetDirectory)) { Directory.CreateDirectory(targetDirectory); } //check if file is there if (System.IO.File.Exists(sourceFile)) { System.IO.File.Copy(sourceFile, destinationFile, true); } else { throw new System.IO.FileNotFoundException(SharedSupport.GetLocalizedString("Assignment_UploadedFileNotFound")); } this.AddFile(filename); } try { Directory.Delete(uploadPath, true); } catch { } // Send new Starter project notice. if (_sendNewProject && SharedSupport.UsingSmtp) { string[] AssignmentName = new string[] { _shortName }; string subject = SharedSupport.GetLocalizedString("Notification_UpdatedProjectSubject", AssignmentName); string body = SharedSupport.GetLocalizedString("Notification_UpdatedProjectBody", AssignmentName); MessageM.sendEmailMessageToCourse(subject, body, String.Empty, _courseId); } } catch (Exception ex) { SharedSupport.HandleError(ex); submitSuccess = false; } if (submitSuccess) { this.StarterProjectFlag = true; this.Update(); } return(submitSuccess); } else { return(false); } }