示例#1
0
        public void getRetailerPassword(string phone, string clientID)
        {
            try
            {
                MySQLBusinessLogic bl = new MySQLBusinessLogic();
                DataTable dt = new DataTable();
                dt = bl.GetPassword(phone);
                if (dt.Rows.Count == 1)
                {
                    //Send Email
                    string pwd = Decrypt(dt.Rows[0].ItemArray[0].ToString());

                    string fname = dt.Rows[0].ItemArray[1].ToString();
                    string email = dt.Rows[0].ItemArray[2].ToString();
                    string loginRedirect = System.Configuration.ConfigurationManager.AppSettings.GetValues("LoginRedirect").FirstOrDefault().ToString();
                    //Mail section

                    string userText = "Dear " + fname + ",<br> Your password has been sent to your registered mobile number ending with XXXXXXX" + phone.Substring(7) + ".<br>";

                    string adminText = "Username of:  " + fname + ",<br>  have requested for password. Please find the password below<br>Username: "******"<br>Password: "******"<br>";

                    string subject = "Lukpik - Forgot Password.";
                    Clients.Client(clientID).gotPassword("1");
                    //user body
                    string body = AttachTexttoMailTemplate(userText, loginRedirect, "Here is your password !", false);

                    //admin body
                    string adminBody = AttachTexttoMailTemplate(userText, loginRedirect, "Here is your password !", false);

                    if (email != "" || email != null)
                        SendEMail("*****@*****.**", email, subject, body);
                    SendEMail("*****@*****.**", "*****@*****.**", "User :"******": Requested for password", adminBody);

                    //SMS section
                    string userSMSText = "Hi " + fname + ", Your password is  : " + pwd;
                    SendSMS(userSMSText, phone);
                }
                else
                {
                    //Email ID doesnt exists
                    Clients.Client(clientID).gotPassword("2");
                }
            }
            catch (Exception ex)
            {
                Clients.Client(clientID).gotPassword("0");
            }
        }