示例#1
0
    protected void ImgSubmitForgot_Click(object sender, ImageClickEventArgs e)
    {
        divForgot.Attributes.Add("Style", "display:none");
        DivlnkForgot.Attributes.Add("Style", "display:block");
        divlblForgotmessage.Attributes.Add("Style", "display:block");
        Global  ObjPassword = new Global();
        DataSet ds          = new DataSet();

        ds = ObjPassword.GetPasswordAdmin(txtforgotUsername.Text.Trim());
        if (ds.Tables[0].Rows.Count > 0)
        {
            lblForgotmessage.Text = "<br> Please check your mail account <br> for username and password";

            string Message = " <table cellpadding='5' cellspacing='0' width='50%' border='1' style='background:#F1EBE2;'>" +
                             "<tr><td colspan='2'><h1 style='font-size:20px; color:#503414;'>Forgot Password</h1></td>" +
                             "</tr><tr><td style='width:20%;'>Username :</td>" +
                             "<td> " + txtforgotUsername.Text.Trim() + "</td>" +
                             "</tr><tr><td>Password :</td>" +
                             "<td> " + ds.Tables[0].Rows[0]["Password"].ToString() + "</td></tr></table>";

            SendMails ObjMai = new SendMails();
            ObjMai.SendEmails(ConfigurationManager.AppSettings["FromEmail"], txtforgotUsername.Text.Trim(), "Fritzy's : Password detail", Message);
        }
        else
        {
            lblForgotmessage.Text = "<br> Please enter valid username.<br> ";
        }
        DivlnkForgot.Attributes.Add("Style", "display:none");
        ModalLogin.CancelControlID = "closeLoginWindow";
        ModalLogin.Show();
        txtforgotUsername.Text = "";
    }
    /*
     * Forgot password click will validate user mailid from database and send mail to this mailid which include Username and password
     * else show the message invalid user
     *
     */
    protected void ImgSubmitForgot1_Click(object sender, ImageClickEventArgs e)
    {
        divForgot.Attributes.Add("Style", "display:none");
        DivlnkForgot.Attributes.Add("Style", "display:block");
        divlblForgotmessage.Attributes.Add("Style", "display:block");
        Global  ObjPassword = new Global();
        DataSet ds          = new DataSet();

        ds = ObjPassword.GetPasswordAdmin(txtforgotUsername.Text.Trim());
        if (ds.Tables[0].Rows.Count > 0)
        {
            lblForgotmessage.Text = "<br> Please check your mail account <br> for username and password";


            string Message = ContentManager.GetStaticeContentEmail("ForgotPassword.htm").Replace("~", "#");
            Message = Message.Replace("<!-- Username -->", txtforgotUsername.Text.Trim());
            Message = Message.Replace("<!-- Password -->", ds.Tables[0].Rows[0]["Password"].ToString());

            SendMails ObjMai = new SendMails();
            ObjMai.SendEmails(ConfigurationManager.AppSettings["FromEmail"], txtforgotUsername.Text.Trim(), "Password Help from Fritzy's Pet Care Pros.", Message);
        }
        else
        {
            lblForgotmessage.Text = "<br> Please enter valid username.<br> ";
        }
        DivlnkForgot.Attributes.Add("Style", "display:none");
        ModalLogin.CancelControlID = "closeLoginWindow";
        ModalLogin.Show();
        txtforgotUsername.Text = "";
    }