Esempio n. 1
0
        public void ActivateUser()
        {
            UserManagementService ums    = new UserManagementService();
            Result <OlescUser>    result = ums.Activate("*****@*****.**", "The Master");

            Console.WriteLine(result.message);
        }
Esempio n. 2
0
        protected void lblActivate_Click(object sender, EventArgs e)
        {
            if (IsLoggedIn)
            {
                String message = String.Empty;
                try
                {
                    LinkButton lblActivate;
                    lblActivate = ((LinkButton)sender);
                    LinkButton lblDeactivate;
                    lblDeactivate = (LinkButton)lblActivate.NamingContainer.FindControl("lblDeactivate");
                    HiddenField rowHdnEmail;
                    //Naming container is the container whe` the LinkButton is placed in on screen
                    rowHdnEmail = (HiddenField)lblActivate.NamingContainer.FindControl("hdnEmail");
                    if (rowHdnEmail != null)
                    {
                        // ISessionManagementService sms = new SessionManagementService();
                        // Result<SessionStudent> result = sms.EnrollStudentInSession(CurrentUser.Email, sessionID);
                        IUserManagementService ums = new UserManagementService();

                        Result <OlescUser> result = ums.Activate(rowHdnEmail.Value, CurrentUser.Email);
                        cvGeneral.ErrorMessage = result.message;
                        cvGeneral.IsValid      = false;
                        if (result.isSuccess)
                        {
                            lblActivate.Visible   = false;
                            lblDeactivate.Visible = true;
                            message = "User is activated successfully";
                        }
                        else
                        {
                            lblActivate.Visible   = true;
                            lblDeactivate.Visible = false;
                            message = result.message;
                        }
                    }
                }
                catch (Exception ex)
                {
                    message = ex.Message;
                }
                finally
                {
                    ShowMessage(message);
                }
            }
        }