コード例 #1
0
 public OperationStatus ForgotPassword(ForgotPasswordCustomModel model)
 {
     using (_IMemberRepo = new MemberRepo())
     {
         return(_IMemberRepo.ForgotPassword(model));
     }
 }
コード例 #2
0
        public OperationStatus ForgotPassword(ForgotPasswordCustomModel model)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new ChatApplicationEntities())
                {
                    var rs = dbcontext.tblApplicationUsers.FirstOrDefault(x => x.UserName == model.UserName);
                    if (rs != null)
                    {
                        string from = "*****@*****.**";  //any valid GMail ID
                        string to   = Convert.ToString(rs.EmailId); //any valid GMail ID
                        using (MailMessage mail = new MailMessage(from, to))
                        {
                            mail.Subject = "SFS Management Forgot Password";
                            mail.Body    = "Dear " + rs.Name + " <br><br>Please use this password to login: "******"<br><br>Thanks,<br>Team";

                            mail.IsBodyHtml = true;
                            SmtpClient smtp = new SmtpClient();
                            smtp.Host = "smtp.gmail.com";
                            smtp.Port = 587;
                            smtp.UseDefaultCredentials = false;
                            smtp.Credentials           = new System.Net.NetworkCredential
                                                             ("*****@*****.**", "shally123");// Enter seders User name and password
                            smtp.EnableSsl = true;
                            smtp.Send(mail);

                            status = OperationStatus.Success;
                        }
                    }
                    else
                    {
                        status = OperationStatus.Duplicate;
                    }
                }
            }
            catch (Exception ex)
            {
                dbcontext.Dispose();
                status = OperationStatus.Exception;
                throw ex;
            }

            return(status);
        }
コード例 #3
0
 public Response ForgotPassword(ForgotPasswordCustomModel model)
 {
     _response = new Response();
     try
     {
         MemberBusiness memberService = new MemberBusiness();
         _response.responseData = memberService.ForgotPassword(model);
         _response.message      = "Records loaded successfully !!";
         _response.success      = true;
     }
     catch (Exception ex)
     {
         _response.success = false;
         _response.message = ex.Message.ToString();
     }
     finally
     {
         MemberService = null;
     }
     return(_response);
 }