Example #1
0
        protected void btnSendPassword_Click(object sender, EventArgs e)
        {
            MySqlConnection conn   = CMain.GetConnection(ApplicationSession.DBName);
            string          sEmail = emailInput.Value;
            CMember         member = new CMember(sEmail, conn);

            if (member.IsEmpty())
            {
                MessageBox.Show("UserID/Email has not been registered. Please Register");
            }
            else
            {
                string errMsg = CMain.ChangePassword(member.Name, sEmail, true);
                if (errMsg == "")
                {
                    ApplicationSession.cnt += 1;
                    string msg = (ApplicationSession.cnt > 1) ? "resent" : "sent";

                    MessageBox.Show("A temporary password has been " + msg + " to " + sEmail);
                    //lblStatus.Text = "Have not received it? Please click here to";
                    //linkBtn.Text = "resend";
                }
                else
                {
                    MessageBox.Show("Fail to send email. Please try again");
                    // lblStatus.Text = "";
                    //linkBtn.Text = "";
                }
            }
        }
        private void DoChangePassword(string sName, string sEmail)
        {
            ClearScreen();
            string errMsg = CMain.ChangePassword(sName, sEmail, true);

            if (errMsg == "")
            {
                ApplicationSession.cnt += 1;
                string msg = (ApplicationSession.cnt > 1)? "resent" : "sent";

                lblNotif.Text           = "A temporary password has been " + msg + " to " + sEmail;
                lblStatus.Text          = "Have not received it? Please click here to";
                linkBtn.Text            = "resend";
                linkBtn.CommandName     = "resend";
                linkBtn.CommandArgument = sName;
            }
            else
            {
                lblNotif.Text           = "Fail to send email. Please try again";
                lblStatus.Text          = "";
                linkBtn.Text            = "";
                linkBtn.CommandName     = "";
                linkBtn.CommandArgument = "";
            }
        }