Exemple #1
0
    private void gridViews_OnAction(string actionName, object actionArgument)
    {
        string objName;

        switch (actionName)
        {
        // Editing of the item was fired
        case "edit":
            if (!String.IsNullOrEmpty(EditPage))
            {
                // Get object name
                objName = ValidationHelper.GetString(actionArgument, null);
                if (!String.IsNullOrEmpty(objName))
                {
                    string url  = URLHelper.AddParameterToUrl(EditPage, "objname", HTMLHelper.HTMLEncode(objName));
                    string hash = QueryHelper.GetHash(objName, true);
                    URLHelper.Redirect(UrlResolver.ResolveUrl(URLHelper.AddParameterToUrl(url, "hash", hash)));
                }
            }

            break;

        // Deleting of the item was fired
        case "delete":
            var parameters = ValidationHelper.GetString(actionArgument, String.Empty).Split(';');
            if (SystemContext.DevelopmentMode || ValidationHelper.GetBoolean(parameters[1], false))
            {
                objName = parameters[0];
                try
                {
                    TableManager tm = new TableManager(null);

                    tm.DeleteObject(objName, Views);

                    ReloadData();
                    ShowConfirmation(GetString("sysdev.views.objectdeleted"));
                }
                catch (Exception e)
                {
                    ShowError(e.Message);
                }
            }
            break;

        case "refresh":
            objName = ValidationHelper.GetString(actionArgument, null);
            if (!String.IsNullOrEmpty(objName))
            {
                TableManager tm = new TableManager(null);

                tm.RefreshView(objName);

                ShowConfirmation(GetString("sysdev.views.viewrefreshed"));
            }
            break;

        default:
            return;
        }
    }
Exemple #2
0
    private void gridViews_OnAction(string actionName, object actionArgument)
    {
        string objName = null;

        switch (actionName)
        {
        // Editing of the item was fired
        case "edit":
            if (!String.IsNullOrEmpty(EditPage))
            {
                // Get object name
                objName = ValidationHelper.GetString(actionArgument, null);
                if (!String.IsNullOrEmpty(objName))
                {
                    string query = "?objname=" + HTMLHelper.HTMLEncode(objName);
                    query += "&hash=" + QueryHelper.GetHash(query, true);
                    URLHelper.Redirect(EditPage + query);
                }
            }

            break;

        // Deleting of the item was fired
        case "delete":
            objName = ValidationHelper.GetString(actionArgument, null);
            try
            {
                TableManager tm = new TableManager(null);

                tm.DeleteObject(objName, Views);

                ReloadData();
                ShowConfirmation(GetString("sysdev.views.objectdeleted"));
            }
            catch (Exception e)
            {
                ShowError(e.Message);
            }
            break;

        case "refresh":
            objName = ValidationHelper.GetString(actionArgument, null);
            if (!String.IsNullOrEmpty(objName))
            {
                TableManager tm = new TableManager(null);

                tm.RefreshView(objName);

                ShowConfirmation(GetString("sysdev.views.viewrefreshed"));
            }
            break;

        default:
            return;
        }
    }
    private void gridViews_OnAction(string actionName, object actionArgument)
    {
        string objName;

        switch (actionName)
        {
                // Editing of the item was fired
            case "edit":
                if (!String.IsNullOrEmpty(EditPage))
                {
                    // Get object name
                    objName = ValidationHelper.GetString(actionArgument, null);
                    if (!String.IsNullOrEmpty(objName))
                    {
                        string url = URLHelper.AddParameterToUrl(EditPage, "objname", HTMLHelper.HTMLEncode(objName));
                        string hash = QueryHelper.GetHash(objName, true);
                        URLHelper.Redirect(URLHelper.AddParameterToUrl(url, "hash", hash));
                    }
                }

                break;

                // Deleting of the item was fired
            case "delete":
                objName = ValidationHelper.GetString(actionArgument, null);
                try
                {
                    TableManager tm = new TableManager(null);

                    tm.DeleteObject(objName, Views);

                    ReloadData();
                    ShowConfirmation(GetString("sysdev.views.objectdeleted"));
                }
                catch (Exception e)
                {
                    ShowError(e.Message);
                }
                break;

            case "refresh":
                objName = ValidationHelper.GetString(actionArgument, null);
                if (!String.IsNullOrEmpty(objName))
                {
                    TableManager tm = new TableManager(null);

                    tm.RefreshView(objName);

                    ShowConfirmation(GetString("sysdev.views.viewrefreshed"));
                }
                break;

            default:
                return;
        }
    }