Beispiel #1
0
    /// <summary>
    /// Handles UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionName">Name of the action which should be performed</param>
    /// <param name="actionArgument">ID of the item the action should be performed with</param>
    protected void gridElem_OnAction(string actionName, object actionArgument)
    {
        RaiseOnAction(actionName, actionArgument);
        int projectId = ValidationHelper.GetInteger(actionArgument, 0);

        if (projectId > 0)
        {
            switch (actionName.ToLowerCSafe())
            {
            case "edit":
                SelectedItemID = projectId;
                RaiseOnEdit();
                break;

            case "delete":
                // Set deleted item id
                SetValue("DeletedItemID", projectId);
                if (CheckPermissions("CMS.ProjectManagement", PERMISSION_MANAGE))
                {
                    // Use try/catch due to license check
                    try
                    {
                        // Delete the object
                        ProjectInfoProvider.DeleteProjectInfo(projectId);
                        RaiseOnDelete();
                    }
                    catch (Exception ex)
                    {
                        ShowError(ex.Message);
                    }
                }
                break;
            }
        }
    }
Beispiel #2
0
    /// <summary>
    /// Deletes project. Called when the "Delete project" button is pressed.
    /// Expects the CreateProject method to be run first.
    /// </summary>
    private bool DeleteProject()
    {
        // Get the project
        ProjectInfo deleteProject = ProjectInfoProvider.GetProjectInfo("MyNewProject", SiteContext.CurrentSiteID, 0);

        // Delete the project
        ProjectInfoProvider.DeleteProjectInfo(deleteProject);

        return(deleteProject != null);
    }
Beispiel #3
0
    /// <summary>
    /// Handles UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionName">Name of the action which should be performed</param>
    /// <param name="actionArgument">ID of the item the action should be performed with</param>
    protected void gridElem_OnAction(string actionName, object actionArgument)
    {
        RaiseOnAction(actionName, actionArgument);
        int projectId = ValidationHelper.GetInteger(actionArgument, 0);

        if (projectId > 0)
        {
            switch (actionName.ToLower())
            {
            case "edit":
                this.SelectedItemID = projectId;
                this.RaiseOnEdit();
                break;

            case "delete":
                // Set deleted item id
                this.SetValue("DeletedItemID", projectId);
                if (CheckPermissions("CMS.ProjectManagement", CMSAdminControl.PERMISSION_MANAGE))
                {
                    // Use try/catch due to license check
                    try
                    {
                        // Delete the object
                        ProjectInfoProvider.DeleteProjectInfo(projectId);
                        this.RaiseOnDelete();
                    }
                    catch (Exception ex)
                    {
                        lblError.Visible = true;
                        lblError.Text    = ex.Message;
                    }
                }
                break;
            }
        }
    }