Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (PageSize >= 0)
        {
            gridElem.Pager.DefaultPageSize = PageSize;
        }
        gridElem.OrderBy                   = OrderBy;
        gridElem.WhereCondition            = WhereCondition;
        gridElem.OnExternalDataBound      += gridElem_OnExternalDataBound;
        gridElem.GridOptions.ShowSelection = ShowSelection;

        // Set gridelement empty list info text either to set property or default value
        gridElem.ZeroRowsText         = String.IsNullOrEmpty(ZeroRowsText) ? GetString("om.activities.noactivities") : GetString(ZeroRowsText);
        gridElem.FilteredZeroRowsText = String.IsNullOrEmpty(FilteredZeroRowsText) ? GetString("om.activities.noactivities.filtered") : GetString(FilteredZeroRowsText);

        if (ContactID > 0)
        {
            gridElem.Query = "om.activity.selectcontactactivitylist";

            QueryDataParameters parameters = new QueryDataParameters();
            parameters.AddId("@ContactID", ContactID);

            gridElem.QueryParameters = parameters;
        }

        modifyPermission = AuthorizationHelper.AuthorizedManageActivity(SiteContext.CurrentSiteID, false);

        ScriptHelper.RegisterDialogScript(Page);

        string scriptBlock = string.Format(@"
            function ViewDetails(id) {{ modalDialog('{0}' + id, 'ActivityDetails', '900', '950'); return false; }}",
                                           ResolveUrl(@"~/CMSModules/Activities/Pages/Tools/Activities/Activity/Activity_Details.aspx"));

        ScriptHelper.RegisterClientScriptBlock(this, GetType(), "Actions", scriptBlock, true);
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (PageSize >= 0)
        {
            gridElem.Pager.DefaultPageSize = PageSize;
        }
        gridElem.OrderBy                   = OrderBy;
        gridElem.WhereCondition            = WhereCondition;
        gridElem.OnExternalDataBound      += gridElem_OnExternalDataBound;
        gridElem.GridOptions.ShowSelection = ShowSelection;

        // Set gridelement empty list info text either to set property or default value
        gridElem.ZeroRowsText         = String.IsNullOrEmpty(ZeroRowsText) ? GetString("om.activities.noactivities") : GetString(ZeroRowsText);
        gridElem.FilteredZeroRowsText = String.IsNullOrEmpty(FilteredZeroRowsText) ? GetString("om.activities.noactivities.filtered") : GetString(FilteredZeroRowsText);

        if (ContactID > 0)
        {
            gridElem.ObjectType     = ActivityInfo.OBJECT_TYPE;
            gridElem.WhereCondition = new WhereCondition(gridElem.WhereCondition).WhereEquals(nameof(ActivityInfo.ActivityContactID), ContactID).ToString(true);
        }
        else
        {
            gridElem.ObjectType = ActivityListInfo.OBJECT_TYPE;
            gridElem.GridColumns.Columns.Insert(2, new Column {
                Caption = GetString("om.contact.firstname"), Source = nameof(ContactInfo.ContactFirstName), Wrap = false
            });
            gridElem.GridColumns.Columns.Insert(3, new Column {
                Caption = GetString("om.contact.middlename"), Source = nameof(ContactInfo.ContactMiddleName), Wrap = false
            });
            gridElem.GridColumns.Columns.Insert(4, new Column {
                Caption = GetString("om.contact.lastname"), Source = nameof(ContactInfo.ContactLastName), Wrap = false
            });
            gridElem.Columns += ",ContactFirstName, ContactMiddleName, ContactLastName";
        }

        modifyPermission = AuthorizationHelper.AuthorizedManageActivity(SiteContext.CurrentSiteID, false);

        ScriptHelper.RegisterDialogScript(Page);

        string scriptBlock = string.Format(@"
            function ViewDetails(id) {{ modalDialog('{0}' + id, 'ActivityDetails', '900', '950'); return false; }}",
                                           ResolveUrl(@"~/CMSModules/Activities/Pages/Tools/Activities/Activity/Activity_Details.aspx"));

        ScriptHelper.RegisterClientScriptBlock(this, GetType(), "Actions", scriptBlock, true);
    }