예제 #1
0
        /// <summary>
        /// Adds the status.
        /// </summary>
        /// <param name="s">The s.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void AddStatus(Object s, EventArgs e)
        {
            string newName = txtName.Text.Trim();

            if (newName == String.Empty)
            {
                return;
            }

            var newStatus = new Status {
                ProjectId = ProjectId, Name = newName, ImageUrl = lstImages.SelectedValue, IsClosedState = chkClosedState.Checked
            };

            if (StatusManager.SaveOrUpdate(newStatus))
            {
                txtName.Text = "";
                BindStatus();
                lstImages.SelectedValue = String.Empty;
                chkClosedState.Checked  = false;
            }
            else
            {
                ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("SaveStatusError"));
            }
        }
예제 #2
0
        /// <summary>
        /// Adds the milestone.
        /// </summary>
        /// <param name="s">The s.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void AddMilestone(Object s, EventArgs e)
        {
            var newName = txtName.Text.Trim();

            if (newName == String.Empty)
            {
                return;
            }

            var newMilestone = new Milestone
            {
                ProjectId   = ProjectId,
                Name        = newName,
                ImageUrl    = lstImages.SelectedValue,
                DueDate     = DueDate.SelectedValue,
                ReleaseDate = ReleaseDate.SelectedValue,
                IsCompleted = chkCompletedMilestone.Checked,
                Notes       = txtMilestoneNotes.Text
            };

            if (MilestoneManager.SaveOrUpdate(newMilestone))
            {
                txtMilestoneNotes.Text        = string.Empty;
                txtName.Text                  = string.Empty;
                DueDate.SelectedValue         = null;
                chkCompletedMilestone.Checked = false;
                ReleaseDate.SelectedValue     = null;
                BindMilestones();
                lstImages.SelectedValue = String.Empty;
            }
            else
            {
                ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("SaveMilestoneError"));
            }
        }
예제 #3
0
        /// <summary>
        /// Handles the Click event of the cmdUpdate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void CmdUpdateClick(object sender, EventArgs e)
        {
            try
            {
                GetMembershipData(UserId);

                var user = (CustomMembershipUser)MembershipData;

                if (user != null)
                {
                    //user.IsApproved = Authorized.Checked;
                    user.Email       = Email.Text;
                    user.DisplayName = DisplayName.Text;
                    user.FirstName   = FirstName.Text;
                    user.LastName    = LastName.Text;
                    UserManager.UpdateUser(user);
                    OnAction(new ActionEventArgs {
                        Trigger = ActionTriggers.Save
                    });
                }
                ActionMessage.ShowSuccessMessage(GetLocalResourceObject("UpdateUserMessage").ToString());
            }
            catch
            {
                ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("UpdateUserError"));
            }
        }
예제 #4
0
        /// <summary>
        /// Handles the Click event of the cmdChangePassword control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected void CmdChangePasswordClick(object sender, EventArgs e)
        {
            if (!cvPasswords.IsValid)
            {
                return;
            }

            GetMembershipData(UserId);

            if (MembershipData == null)
            {
                return;
            }

            try
            {
                MembershipData.ChangePassword(MembershipData.ResetPassword(), NewPassword.Text);
                ActionMessage.ShowSuccessMessage(GetLocalResourceObject("PasswordChangeSuccess").ToString());
                GetMembershipData(UserId);
                DataBind();
            }
            catch (Exception ex)
            {
                if (Log.IsErrorEnabled)
                {
                    if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
                    {
                        MDC.Set("user", HttpContext.Current.User.Identity.Name);
                    }

                    Log.Error(LoggingManager.GetErrorMessageResource("PasswordChangeError"), ex);
                }
                ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("PasswordChangeError"));
            }
        }
예제 #5
0
 /// <summary>
 /// Handles the Click event of the UnAuthorizeUser control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void UnAuthorizeUserClick(object sender, EventArgs e)
 {
     try
     {
         AuthorizeUser(false);
         ActionMessage.ShowSuccessMessage(GetLocalResourceObject("UserUnAuthorizedMessage").ToString());
     }
     catch
     {
         ActionMessage.ShowErrorMessage(GetLocalResourceObject("UserUnAuthorizedError").ToString());
     }
 }
예제 #6
0
        /// <summary>
        /// Deletes the status.
        /// </summary>
        /// <param name="s">The s.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param>
        protected void grdStatus_Delete(Object s, DataGridCommandEventArgs e)
        {
            var    id = (int)grdStatus.DataKeys[e.Item.ItemIndex];
            string cannotDeleteMessage;

            if (!StatusManager.Delete(id, out cannotDeleteMessage))
            {
                ActionMessage.ShowErrorMessage(cannotDeleteMessage);
                return;
            }

            BindStatus();
        }
예제 #7
0
        /// <summary>
        /// Handles the DeleteCommand event of the grdMailboxes control.
        /// </summary>
        /// <param name="source">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param>
        protected void dtgMailboxes_Delete(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            var id = (int)grdMailboxes.DataKeys[e.Item.ItemIndex];

            if (!ProjectMailboxManager.Delete(id))
            {
                ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("DeleteMailboxError"));
            }
            else
            {
                BindMailboxes();
            }
        }
예제 #8
0
 /// <summary>
 /// Handles the Click event of the cmdDeleteUser control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void DeleteUserClick(object sender, EventArgs e)
 {
     try
     {
         GetMembershipData(UserId);
         System.Web.Security.Membership.DeleteUser(MembershipData.UserName);
         Response.Redirect("~/Administration/Users/UserList.aspx");
     }
     catch (Exception)
     {
         ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("DeleteUserError"));
     }
 }
예제 #9
0
 /// <summary>
 /// Handles the Click event of the cmdUnauthorizeAccount control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void UnauthorizeAccountClick(object sender, EventArgs e)
 {
     try
     {
         GetMembershipData(UserId);
         MembershipData.IsApproved = false;
         UserManager.UpdateUser(MembershipData);
         Response.Redirect("~/Administration/Users/UserList.aspx");
     }
     catch (Exception)
     {
         ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("UserUnAuthorizedError"));
     }
 }
예제 #10
0
        /// <summary>
        /// Handles the Click event of the UnLockUser control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void UnLockUserClick(object sender, EventArgs e)
        {
            GetMembershipData(UserId);

            if (MembershipData != null)
            {
                try
                {
                    MembershipData.UnlockUser();
                    ActionMessage.ShowSuccessMessage(GetLocalResourceObject("UpdateUserMessage").ToString());
                    BindData();
                }
                catch
                {
                    ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("UpdateUserError"));
                }
            }
        }
예제 #11
0
        /// <summary>
        /// Adds the milestone.
        /// </summary>
        /// <param name="s">The s.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void AddResolution(Object s, EventArgs e)
        {
            var newName = txtName.Text.Trim();

            if (newName == String.Empty)
            {
                return;
            }

            var newResolution = new Resolution {
                ProjectId = ProjectId, Name = newName, ImageUrl = lstImages.SelectedValue
            };

            if (ResolutionManager.SaveOrUpdate(newResolution))
            {
                txtName.Text = "";
                BindResolutions();
                lstImages.SelectedValue = String.Empty;
            }
            else
            {
                ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("SaveResolutionError"));
            }
        }
예제 #12
0
        /// <summary>
        /// Handles the Click event of the cmdUpdate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void CmdUpdateClick(object sender, EventArgs e)
        {
            try
            {
                GetMembershipData(UserId);

                if (MembershipData != null)
                {
                    var profile = new WebProfile().GetProfile(MembershipData.UserName);
                    profile.DisplayName = DisplayName.Text;
                    profile.FirstName   = FirstName.Text;
                    profile.LastName    = LastName.Text;

                    ActionMessage.ShowSuccessMessage(GetLocalResourceObject("UpdateProfile").ToString());
                    OnAction(new ActionEventArgs {
                        Trigger = ActionTriggers.Save
                    });
                }
            }
            catch
            {
                ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("ProfileUpdateError"));
            }
        }
        /// <summary>
        /// Adds the priority.
        /// </summary>
        /// <param name="s">The s.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void AddPriority(Object s, EventArgs e)
        {
            var newName = txtName.Text.Trim();

            if (newName == String.Empty)
            {
                return;
            }

            var newPriority = new Priority {
                ProjectId = ProjectId, Name = newName, ImageUrl = lstImages.SelectedValue
            };

            if (PriorityManager.SaveOrUpdate(newPriority))
            {
                txtName.Text            = "";
                lstImages.SelectedValue = String.Empty;
                BindPriorities();
            }
            else
            {
                ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("SavePriorityError"));
            }
        }