Exemplo n.º 1
0
        public String ReturnForgetPassword(MsSql mssql)
        {
            String ReturnString = "00000000";
            Random rnd          = new Random();

            e.Client.ID.VarPool["password"] = rnd.Next(0, 99999999).ToString().PadRight(8, '0');
            mssql.CommandString             = String.Format("UPDATE Account SET Password='******' WHERE Mail='{1}';", e.Client.ID.VarPool["password"].ToString(), e.Client.ID.VarPool["account"].ToString());
            if (!mssql.MsUpdata())
            {
                ReturnString = mssql.ErrorCode;
            }
            else
            {
                Send emailsend = new Send();
                emailsend.smtpAddress = Login.Properties.Settings.Default.smtpAddress;
                emailsend.portNumber  = Login.Properties.Settings.Default.portNumber;
                emailsend.enableSSL   = Login.Properties.Settings.Default.enableSSL;
                emailsend.emailFrom   = Login.Properties.Settings.Default.EmailFrom;
                emailsend.password    = Login.Properties.Settings.Default.Emailpassword;
                emailsend.emailTo     = e.Client.ID.VarPool["account"].ToString();
                emailsend.subject     = Login.Properties.Settings.Default.subject;
                emailsend.body        = String.Format(Login.Properties.Settings.Default.body, e.Client.ID.VarPool["password"].ToString());
                emailsend.SendEmail();
                if (emailsend.ErrorData.CompareTo("") != 0)
                {
                    ReturnString = emailsend.ErrorData;
                }
            }
            return(ReturnString);
        }