예제 #1
0
    private void AddControls(int level, IEnumerable <string> features, Dictionary <string, List <string> > subfeatures, IEnumerable <string> disabled)
    {
        foreach (string feature in features)
        {
            if (this.form.TemplateContainer.FindControl(feature) != null)
            {
                continue;
            }
            if (PX.Data.PXLicenseHelper.License.Licensed && !PX.Data.PXLicenseHelper.License.Features.Any(f => f.EndsWith(feature)))
            {
                continue;
            }

            PXCheckBox control = new PXCheckBox();
            control.ID        = feature;
            control.DataField = feature;
            control.Enabled   = !disabled.Contains(feature);
            control.TextAlign = TextAlign.Right;
            if (level > 0)
            {
                control.Style["margin-left"] = level * 25 + "px";
            }
            control.CommitChanges = true;
            control.ApplyStyleSheetSkin(this.Page);
            this.form.TemplateContainer.Controls.Add(control);
            if (subfeatures.ContainsKey(feature))
            {
                AddControls(level + 1, subfeatures[feature], subfeatures, disabled);
            }
        }
    }
예제 #2
0
    private void AddFileControls(PXSmartPanel smartPanel = null)
    {
        if (smartPanel == null)
        {
            smartPanel = (PXSmartPanel)form.FindControl("edAttachmentsPanel");
        }

        var graph       = (OUSearchMaint)ds.DataGraph;
        var attachments = graph.APBillAttachments.Select()
                          .AsEnumerable()
                          .Select(a => (OUAPBillAttachment)a)
                          .ToArray();

        for (var i = 0; i < attachments.Length; i++)
        {
            var id             = string.Format("edCheckboxFile{0}", i);
            var itemIdCaptured = attachments[i].ItemId;
            var idCaptured     = attachments[i].Id;

            if (smartPanel.FindControl(id) != null)
            {
                continue;
            }

            var fieldName = string.Format("File{0}", i);

            if (!graph.Filter.Cache.Fields.Contains(fieldName))
            {
                graph.Filter.Cache.Fields.Add(fieldName);

                graph.FieldSelecting.AddHandler(_primaryViewName, fieldName, (s, e) =>
                {
                    graph.OUAPBillAttachmentSelectFileFieldSelecting(s, e, itemIdCaptured, idCaptured);
                });

                graph.FieldUpdating.AddHandler(_primaryViewName, fieldName, (s, e) =>
                {
                    graph.OUAPBillAttachmentSelectFileFieldUpdating(s, e, itemIdCaptured, idCaptured);
                });
            }

            var checkboxFile = new PXCheckBox
            {
                ID            = id,
                CommitChanges = true,
                DataField     = fieldName,
            };

            checkboxFile.ClientEvents.ValueChanged = "onFileSelect";
            checkboxFile.ApplyStyleSheetSkin(this);
            smartPanel.Controls.Add(checkboxFile);

            var formDataProvider = form.DataProviders[_primaryViewName];
            formDataProvider.DataControls[id] = checkboxFile;
        }
    }
예제 #3
0
	private void AddControls(int level, IEnumerable<string> features,   Dictionary<string, List<string>> subfeatures, IEnumerable<string> disabled)
	{
		foreach (string feature in features)
		{
			if (this.form.TemplateContainer.FindControl(feature) != null) continue;
			if (PX.Data.PXLicenseHelper.License.Licensed && !PX.Data.PXLicenseHelper.License.Features.Any(f => f.EndsWith(feature))) continue;
			
			PXCheckBox control = new PXCheckBox();
			control.ID = feature;
			control.DataField = feature;
			control.Enabled = !disabled.Contains(feature);
			control.TextAlign = TextAlign.Right;
			if(level > 0)
				control.Style["margin-left"] = level*25 + "px";			
			control.CommitChanges = true;
			control.ApplyStyleSheetSkin(this.Page);
			this.form.TemplateContainer.Controls.Add(control);
			if (subfeatures.ContainsKey(feature))
				AddControls(level +1, subfeatures[feature], subfeatures, disabled);
		}
	}