void PersonInfo1_OnSuccess(object sender, EventArgs e)
    {
        tblUserActivationRequest request = null;

        try
        {
            request = new tblUserActivationRequest()
            {
                RequestID      = Guid.NewGuid(),
                UserID         = _User.ProviderUserKey.ToString(),
                IsFulfilled    = false,
                ExpirationDate = DateTime.Now.Add(new TimeSpan(48, 0, 0))
            };

            DataContext.NWODC.tblUserActivationRequests.InsertOnSubmit(request);

            DataContext.NWODC.SubmitChanges();

            EmailMessage message = ANWO.Biz.EmailMessageFactory.GetAccountActivation("ACCOUNTACTIVATION", request.RequestID.ToString(), _User.Email);

            EmailSender.SendEmail(message.FromEmail, message.ToEmail, message.Title, message.Message, MailPriority.Normal, MailSendContext.Contact);

            Response.Redirect("~/ANewWebOrder-Account-Success.aspx", false);
        }
        catch (Exception ex)
        {
            ANWOLogger.WriteExceptionLog("Activation Request Failed", ex, LogCategory.Registration, 1);
            ((IMessage)Master).ClearMessage();
            ((IMessage)Master).ShowMessage(ex.Message);
        }
        //Create Activation request.
        //_User.P
        //Response.Redirect("~/Members/CampaignList.aspx");
        //Move to next page
    }
Example #2
0
 protected void ThrowError(object sender, ControlErrorArgs args)
 {
     ANWOLogger.WriteExceptionLog(args.Message, args.InnerException, LogCategory.General);
     if (OnError != null)
     {
         if (!args.LogOnly)
         {
             OnError(sender, args);
         }
     }
 }
    private void GetIDAndActivate()
    {
        try
        {
            _ID = Request.QueryString["ID"];
            if (!string.IsNullOrEmpty(_ID))
            {
                tblUserActivationRequest actReq = (from req in data.NWODC.tblUserActivationRequests
                                                   where req.RequestID.ToString() == _ID && !req.IsFulfilled
                                                   select req).SingleOrDefault <tblUserActivationRequest>();

                if (actReq != null && actReq.IsFulfilled == false)
                {
                    Guid           guid = new Guid(actReq.UserID);
                    MembershipUser user = Membership.GetUser(guid);
                    if (!user.IsApproved)
                    {
                        //Approved user account first
                        user.IsApproved = true;
                        Membership.UpdateUser(user);

                        pnlSuccess.Visible = true;
                    }
                }
                else
                {
                    pnlFailure.Visible = true;
                }
            }
            else
            {
                Exception ex = new Exception("Invalid ID Provided.");
                ANWOLogger.WriteExceptionLog("Account Activation: Invalid ID Provided", ex, LogCategory.General, 3, System.Diagnostics.TraceEventType.Error);
                throw ex;
            }
        }
        catch (Exception ex)
        {
            ((IMessage)this.Master).ClearMessage();
            ((IMessage)this.Master).ShowMessage(ex.Message);
        }
    }