protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);  // first things first
        if (ConciergeAPI.CurrentEntity == null)
        {
            return;
        }

        targetForm = LoadObjectFromAPI <msCustomObjectPortalForm>(ContextID);
        if (targetForm == null)
        {
            GoToMissingRecordPage();
        }

        targetObject = LoadObjectFromAPI <msCustomObject>(targetForm.CustomObject);

        using (var api = GetServiceAPIProxy())
            targetFormManifest = api.DescribePortalForm(targetForm.ID, ConciergeAPI.CurrentEntity.ID).ResultValue;

        rgMainDataGrid.AutoGenerateColumns = false;

        targetSearch = new Search(targetObject.Name);
        targetSearch.AddCriteria(Expr.Equals("Owner", ConciergeAPI.CurrentEntity.ID));

        var columns = targetForm.ManagementFieldsToDisplay;

        if (columns == null || columns.Count == 0)
        {
            columns = new List <string> {
                "Name"
            }
        }
        ;

        columns.ForEach(targetSearch.AddOutputColumn);


        if (!IsPostBack)
        {
            using (var api = GetServiceAPIProxy())
            {
                var meta = api.DescribeCompiledSearch(targetSearch).ResultValue;
                GridLogic.GenerateRadGridColumnsFromFieldMetadata(rgMainDataGrid, meta.Fields);
            }
        }

        GridHyperLinkColumn gc = new GridHyperLinkColumn();

        rgMainDataGrid.Columns.Add(gc); // remember we have to do this right away for column settings to persist
        gc.DataNavigateUrlFormatString = "ViewFormInstance.aspx?contextID={0}&formID=" + targetForm.ID;
        gc.DataNavigateUrlFields       = new string[] { "ID" };
        gc.Text = "(view)";
    }
Esempio n. 2
0
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();
        targetForm = LoadObjectFromAPI <msCustomObjectPortalForm>(ContextID);
        if (targetForm == null)
        {
            GoToMissingRecordPage();
        }

        string entityID = null;

        if (ConciergeAPI.CurrentEntity != null)
        {
            entityID = ConciergeAPI.CurrentEntity.ID;
        }

        using (var api = GetServiceAPIProxy())
            targetFormManifest = api.DescribePortalForm(targetForm.ID, entityID).ResultValue;

        // MS-5922 - only check this on initial load so that it will not fail on completion of creation of last allowed instance
        if (!IsPostBack)
        {
            if (!targetFormManifest.CanCreate)
            {
                GoTo("/AccessDenied.aspx");
            }
        }

        if (ConciergeAPI.CurrentEntity == null && !targetForm.AllowAnonymousSubmissions)  // we need them to go through registration
        {
            GoTo("~/profile/CreateAccount_BasicInfo.aspx?t=PortalForm&formID=" + targetForm.ID);
            return;
        }

        // ok, so we allow anonymous submissions here
        // MS-5360
        if (string.IsNullOrWhiteSpace(CurrentFormID.Value))
        {
            targetInstance          = MetadataLogic.CreateNewObject(targetFormManifest.UnderlyingObjectName);
            targetInstance["Owner"] = entityID;
        }
        else
        {
            targetInstance = APIExtensions.LoadObjectFromAPI(CurrentFormID.Value);
        }
    }
Esempio n. 3
0
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();
        targetForm = LoadObjectFromAPI <msCustomObjectPortalForm>(Request.QueryString["formID"]);
        if (targetForm == null)
        {
            GoToMissingRecordPage();
        }

        targetRecord = LoadObjectFromAPI <msCustomObjectInstance>(ContextID);
        if (targetRecord == null)
        {
            GoToMissingRecordPage();
        }

        targetObject = LoadObjectFromAPI <msCustomObject>(targetForm.CustomObject);

        using (var api = GetServiceAPIProxy())
            targetFormManifest = api.DescribePortalForm(targetForm.ID, ConciergeAPI.CurrentEntity.ID).ResultValue;
    }