コード例 #1
0
 /// <summary>
 /// True if the controls contains the control; otherwise, false.
 /// </summary>
 private bool ContainsControlDictionary(PXFieldSchema control, Dictionary <string, List <PXFieldSchema> > controls)
 {
     Dictionary <string, List <PXFieldSchema> > .KeyCollection keyColl = controls.Keys;
     foreach (string type in keyColl)
     {
         foreach (PXFieldSchema wc in controls[type])
         {
             if (control.DataField == wc.DataField)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #2
0
    private void AddControl(PXFieldSchema control, List <PXFieldSchema> lRequestControls)
    {
        string id = control.DataField.Replace("DataSource", string.Empty);

        if (id.StartsWith("Usr", StringComparison.OrdinalIgnoreCase))
        {
            id = id.Insert(3, "Request");
        }
        else
        {
            id = "Request" + id;
        }
        if (ContainsControl(id, lRequestControls))
        {
            WebControl newDsCtrl = this.CreateControlForField(control);
            (newDsCtrl).ApplyStyleSheetSkin(this.Page);

            PXLayoutRule ruleMerge = new PXLayoutRule()
            {
                ID = "rule" + Guid.NewGuid().ToString(), Merge = true
            };
            (ruleMerge).ApplyStyleSheetSkin(this.Page);

            PXLayoutRule ruleEndMerge = new PXLayoutRule()
            {
                ID = "rule" + Guid.NewGuid().ToString()
            };
            (ruleEndMerge).ApplyStyleSheetSkin(this.Page);

            WebControl newRequestCtrl = CreateControlForField(GetControl(id, lRequestControls));
            (newRequestCtrl).ApplyStyleSheetSkin(this.Page);

            form.TemplateContainer.Controls.AddAt(_insertIndex, ruleMerge);
            _insertIndex++;

            form.TemplateContainer.Controls.AddAt(_insertIndex, newDsCtrl);
            _insertIndex++;

            form.TemplateContainer.Controls.AddAt(_insertIndex, newRequestCtrl);
            SetProperty(newRequestCtrl, "SuppressLabel", true);
            SetProperty(newRequestCtrl, "Size", "xs");
            _insertIndex++;

            form.TemplateContainer.Controls.AddAt(_insertIndex, ruleEndMerge);
            _insertIndex++;
        }
    }
コード例 #3
0
    /// <summary>
    /// Create web control for specified field.
    /// </summary>
    private WebControl CreateControlForField(PXFieldSchema f)
    {
        System.Web.UI.WebControls.WebControl ctrl = null;
        switch (f.ControlType)
        {
        case PXSchemaControl.NumberEdit:
            ctrl = new PXNumberEdit();
            ((PXNumberEdit)ctrl).DataField = f.DataField;
            ((PXNumberEdit)ctrl).ValueType = f.DataType;
            ((PXNumberEdit)ctrl).AllowNull = true;
            break;

        case PXSchemaControl.TextEdit:
            ctrl = new PXTextEdit();
            ((PXTextEdit)ctrl).DataField = f.DataField;
            break;

        case PXSchemaControl.CheckBox:
            ctrl = new PXCheckBox();
            ((PXCheckBox)ctrl).DataField = f.DataField;
            break;

        case PXSchemaControl.ComboBox:
            ctrl = new PXDropDown();
            ((PXDropDown)ctrl).DataField = f.DataField;
            ((PXDropDown)ctrl).AllowNull = false;
            break;

        case PXSchemaControl.Selector:
            ctrl = new PXSelector();
            ((PXSelector)ctrl).DataSourceID = ds.ID;
            ((PXSelector)ctrl).DataField    = f.DataField;
            PXFieldState fs = ((RMReportMaint)ds.DataGraph).Report.Cache.GetStateExt(((RMReportMaint)ds.DataGraph).Report.Current, f.DataField) as PXFieldState;
            if (fs != null && !String.IsNullOrWhiteSpace(fs.DescriptionName))
            {
                ((PXSelector)ctrl).TextMode    = TextModeTypes.Search;
                ((PXSelector)ctrl).DisplayMode = ValueDisplayMode.Text;
            }
            else if (fs.ValueField != null && fs.ValueField.ToLower() == "compositekey")
            {
                ((PXSelector)ctrl).CommitChanges = true;
            }
            break;

        case PXSchemaControl.SegmentMask:
            ctrl = new PXSegmentMask();
            ((PXSegmentMask)ctrl).DataMember = f.ViewName;
            break;

        case PXSchemaControl.DateTimeEdit:
            ctrl = new PXDateTimeEdit();
            ((PXDateTimeEdit)ctrl).DataField = f.DataField;
            break;
        }

        if (ctrl != null)
        {
            ctrl.ID = f.DataField;
            ((IFieldEditor)ctrl).DataField = f.DataField;
        }
        return(ctrl);
    }
コード例 #4
0
    /// <summary>
    /// Refresh the list of data fields using specified view name.
    /// </summary>
    private List <PXFieldSchema> RefreshFieldsList(PXDataSourceViewSchema schema, RMReportMaint graph)
    {
        PX.Data.PXFieldState[] fields = schema.GetFields();
        List <PXFieldSchema>   list   = new List <PXFieldSchema>();

        if (fields != null)
        {
            foreach (PX.Data.PXFieldState f in fields)
            {
                if (String.IsNullOrEmpty(f.Name) || !f.Name.StartsWith("DataSource", StringComparison.OrdinalIgnoreCase) && !f.Name.StartsWith("Request", StringComparison.OrdinalIgnoreCase) && !f.Name.StartsWith("UsrRequest", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                string dsField = f.Name;
                if (dsField.StartsWith("DataSource", StringComparison.OrdinalIgnoreCase))
                {
                    dsField = dsField.Substring(10);
                }
                else if (f.Name.StartsWith("Request", StringComparison.OrdinalIgnoreCase))
                {
                    dsField = dsField.Substring(7);
                }
                else
                {
                    dsField = "Usr" + dsField.Substring(10);
                }

                PXFieldState dsState = graph.DataSourceByID.Cache.GetStateExt(null, dsField) as PXFieldState;

                if (dsState == null || !dsState.Visible)
                {
                    continue;
                }

                TypeCode dataType = Type.GetTypeCode(f.DataType);
                if (dataType == TypeCode.Object)
                {
                    continue;
                }

                PXFieldSchema item = new PXFieldSchema(true, f.Name, dataType);
                item.ControlType = PXSchemaGenerator.GetControlType(f);
                item.PrimaryKey  = f.PrimaryKey;
                item.ReadOnly    = f.IsReadOnly;
                item.AllowNull   = f.Nullable;
                item.MaxLength   = (f.Length > 0) ? f.Length : 0;
                item.Precision   = (f.Precision > 0) ? f.Precision : 0;

                item.Caption      = f.DisplayName;
                item.ViewName     = f.ViewName;
                item.HintField    = f.DescriptionName;
                item.FieldList    = f.FieldList;
                item.HeaderList   = f.HeaderList;
                item.DefaultValue = f.DefaultValue;

                list.Add(item);
            }
        }

        return(list);
    }
コード例 #5
0
	/// <summary>
	/// Create web control for specified field.
	/// </summary>
	private WebControl CreateControlForField(PXFieldSchema f)
	{
		System.Web.UI.WebControls.WebControl ctrl = null;
		switch (f.ControlType)
		{
			case PXSchemaControl.NumberEdit:
				ctrl = new PXNumberEdit();
				((PXNumberEdit)ctrl).DataField = f.DataField;
				((PXNumberEdit)ctrl).ValueType = f.DataType;
				((PXNumberEdit)ctrl).AllowNull = true;
				break;
			case PXSchemaControl.TextEdit:
				ctrl = new PXTextEdit();
				((PXTextEdit)ctrl).DataField = f.DataField;
				break;
			case PXSchemaControl.CheckBox:
				ctrl = new PXCheckBox();
				((PXCheckBox)ctrl).DataField = f.DataField;
				break;
			case PXSchemaControl.ComboBox:
				ctrl = new PXDropDown();
				((PXDropDown)ctrl).DataField = f.DataField;
				((PXDropDown)ctrl).AllowNull = false;
				break;
			case PXSchemaControl.Selector:
				ctrl = new PXSelector();
				((PXSelector)ctrl).DataSourceID = ds.ID;
				((PXSelector)ctrl).DataField = f.DataField;
				PXFieldState fs = ((RMReportMaint)ds.DataGraph).Report.Cache.GetStateExt(((RMReportMaint)ds.DataGraph).Report.Current, f.DataField) as PXFieldState;
				if (fs != null && !String.IsNullOrWhiteSpace(fs.DescriptionName))
				{
					((PXSelector)ctrl).TextMode = TextModeTypes.Search;
					((PXSelector)ctrl).DisplayMode = ValueDisplayMode.Text;
				}
				else if (fs.ValueField != null && fs.ValueField.ToLower() == "compositekey")
				{
					((PXSelector)ctrl).CommitChanges = true;
				}
				break;
			case PXSchemaControl.SegmentMask:
				ctrl = new PXSegmentMask();
				((PXSegmentMask)ctrl).DataMember = f.ViewName;
				break;
			case PXSchemaControl.DateTimeEdit:
				ctrl = new PXDateTimeEdit();
				((PXDateTimeEdit)ctrl).DataField = f.DataField;
				break;
		}

		if (ctrl != null)
		{
			ctrl.ID = f.DataField;
			((IFieldEditor)ctrl).DataField = f.DataField;
		}
		return ctrl;
	}
コード例 #6
0
	/// <summary>
	/// True if the controls contains the control; otherwise, false.
	/// </summary>
	private bool ContainsControlDictionary(PXFieldSchema control, Dictionary<string, List<PXFieldSchema>> controls)
	{
		Dictionary<string, List<PXFieldSchema>>.KeyCollection keyColl = controls.Keys;
		foreach (string type in keyColl)
		{
			foreach (PXFieldSchema wc in controls[type])
			{
				if (control.DataField == wc.DataField) return true;
			}
		}
		return false;
	}
コード例 #7
0
	/// <summary>
	/// Refresh the list of data fields using specified view name.
	/// </summary>
	private List<PXFieldSchema> RefreshFieldsList(PXDataSourceViewSchema schema, RMReportMaint graph)
	{
		PX.Data.PXFieldState[] fields = schema.GetFields();
		List<PXFieldSchema> list = new List<PXFieldSchema>();

		if (fields != null)
		{
			foreach (PX.Data.PXFieldState f in fields)
			{
				if (String.IsNullOrEmpty(f.Name) || !f.Name.StartsWith("DataSource", StringComparison.OrdinalIgnoreCase) && !f.Name.StartsWith("Request", StringComparison.OrdinalIgnoreCase) && !f.Name.StartsWith("UsrRequest", StringComparison.OrdinalIgnoreCase))
					continue;

				string dsField = f.Name;
				if (dsField.StartsWith("DataSource", StringComparison.OrdinalIgnoreCase))
					dsField = dsField.Substring(10);
				else if (f.Name.StartsWith("Request", StringComparison.OrdinalIgnoreCase))
					dsField = dsField.Substring(7);
				else
					dsField = "Usr" + dsField.Substring(10);

				PXFieldState dsState = graph.DataSourceByID.Cache.GetStateExt(null, dsField) as PXFieldState;

				if (dsState == null || !dsState.Visible) continue;

				TypeCode dataType = Type.GetTypeCode(f.DataType);
				if (dataType == TypeCode.Object) continue;

				PXFieldSchema item = new PXFieldSchema(true, f.Name, dataType);
				item.ControlType = PXSchemaGenerator.GetControlType(f);
				item.PrimaryKey = f.PrimaryKey;
				item.ReadOnly = f.IsReadOnly;
				item.AllowNull = f.Nullable;
				item.MaxLength = (f.Length > 0) ? f.Length : 0;
				item.Precision = (f.Precision > 0) ? f.Precision : 0;

				item.Caption = f.DisplayName;
				item.ViewName = f.ViewName;
				item.HintField = f.DescriptionName;
				item.FieldList = f.FieldList;
				item.HeaderList = f.HeaderList;
				item.DefaultValue = f.DefaultValue;

				list.Add(item);
			}
		}

		return list;
	}
コード例 #8
0
	private void AddControl(PXFieldSchema control, List<PXFieldSchema> lRequestControls)
	{
		string id = control.DataField.Replace("DataSource", string.Empty);
		if (id.StartsWith("Usr", StringComparison.OrdinalIgnoreCase))
		{
			id = id.Insert(3, "Request");
		}
		else
		{
			id = "Request" + id;
		}
		if (ContainsControl(id, lRequestControls))
		{
			WebControl newDsCtrl = this.CreateControlForField(control);
			(newDsCtrl).ApplyStyleSheetSkin(this.Page);

			PXLayoutRule ruleMerge = new PXLayoutRule() { ID = "rule" + Guid.NewGuid().ToString(), Merge = true };
			(ruleMerge).ApplyStyleSheetSkin(this.Page);

			PXLayoutRule ruleEndMerge = new PXLayoutRule() { ID = "rule" + Guid.NewGuid().ToString() };
			(ruleEndMerge).ApplyStyleSheetSkin(this.Page);

			WebControl newRequestCtrl = CreateControlForField(GetControl(id, lRequestControls));
			(newRequestCtrl).ApplyStyleSheetSkin(this.Page);

			form.TemplateContainer.Controls.AddAt(_insertIndex, ruleMerge);
			_insertIndex++;

			form.TemplateContainer.Controls.AddAt(_insertIndex, newDsCtrl);
			_insertIndex++;

			form.TemplateContainer.Controls.AddAt(_insertIndex, newRequestCtrl);
			SetProperty(newRequestCtrl, "SuppressLabel", true);
			SetProperty(newRequestCtrl, "Size", "xs");
			_insertIndex++;

			form.TemplateContainer.Controls.AddAt(_insertIndex, ruleEndMerge);
			_insertIndex++;
		}
	}