Пример #1
0
        internal static bool CommitImport(string importID)
        {
            DatabaseCall dbc = new DatabaseCall("Import_LoadPendingImport", DBCallType.Select);

            dbc.AddParameter("@ImportID", importID);
            System.Data.DataSet ds = new System.Data.DataSet();
            dbc.Fill(ds);

            if ((ds.Tables.Count <= 0) || (ds.Tables[0].Rows.Count <= 0))
            {
                return(false);
            }

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                try
                {
                    UserM user = UserM.Load(Convert.ToInt32(ds.Tables[0].Rows[i]["UserID"]));
                    user.GenerateNewPassword();
                    user.AddToCourse(Convert.ToInt32(ds.Tables[0].Rows[i]["CourseID"]));
                }
                catch
                {
                }
            }
            return(true);
        }
Пример #2
0
 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);
     }
 }
Пример #3
0
        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 static void sendEmailMessageToCourse(string subject, string body, string link, int courseId)
        {
            if (!Convert.ToBoolean(SharedSupport.UsingSmtp))
            {
                throw (new System.Exception(SharedSupport.GetLocalizedString("Global_NoSMTP")));
            }

            try
            {
                // validation
                if (body.Equals(String.Empty))
                {
                    throw new  ArgumentException(SharedSupport.GetLocalizedString("SendEmailMessage_InvalidBody"));
                }
                if (subject.Equals(String.Empty))
                {
                    throw new  ArgumentException(SharedSupport.GetLocalizedString("SendEmailMessage_InvalidSubject"));
                }

                string mailTo          = "";
                System.Data.DataSet ds = new System.Data.DataSet();

                //use generic Assignment Manager From
                string sentByEmail = string.Empty;

                UserList ul      = UserList.GetListFromCourse(courseId);
                int[]    userIDs = ul.UserIDList;
                for (int i = 0; i < userIDs.Length; i++)
                {
                    UserM user = UserM.Load(userIDs[i]);
                    mailTo += user.EmailAddress + ";";
                }

                // use Assignment Manager sysadmin email
                UserM amsaUser = UserM.Load(Constants.ASSIGNMENTMANAGER_SYSTEM_ADMIN_USERID);
                sentByEmail = amsaUser.EmailAddress;
                // add the formatting and action link
                body += "\n" + "\n" + link;
                // send email
                SendMessage(sentByEmail, mailTo, subject, body);
            }
            catch (System.Exception ex)
            {
                SharedSupport.HandleError(ex);
            }
        }