Ejemplo n.º 1
0
        public virtual ViewControl getControl(dynamic _param_field, dynamic _param_format = null)
        {
            #region default values
            if (_param_format as Object == null)
            {
                _param_format = new XVar();
            }
            #endregion

            #region pass-by-value parameters
            dynamic field  = XVar.Clone(_param_field);
            dynamic format = XVar.Clone(_param_format);
            #endregion

            if (XVar.Pack(!(XVar)(this.viewControls.KeyExists(field))))
            {
                dynamic className = null, editFormat = null, userControl = null, vcTypes = null, viewFormat = null;
                vcTypes    = XVar.Clone(new ViewControlTypes());
                editFormat = XVar.Clone(this.pSet.getEditFormat((XVar)(field)));
                if (XVar.Pack(format == null))
                {
                    dynamic localPSet = null, lookupPageType = null;
                    localPSet      = XVar.Clone(this.pSet);
                    lookupPageType = new XVar("");
                    if (XVar.Pack(!(XVar)(this.isLocal)))
                    {
                        lookupPageType = XVar.Clone(this.pSet.getPageTypeByFieldEditFormat((XVar)(field), new XVar(Constants.EDIT_FORMAT_LOOKUP_WIZARD)));
                        if (lookupPageType != XVar.Pack(""))
                        {
                            localPSet = XVar.Clone(new ProjectSettings((XVar)(this.pSet._table), (XVar)(lookupPageType)));
                        }
                    }
                    if ((XVar)((XVar)((XVar)(!(XVar)(this.isLocal)) && (XVar)((XVar)(editFormat == Constants.EDIT_FORMAT_LOOKUP_WIZARD) || (XVar)(lookupPageType != XVar.Pack("")))) && (XVar)((XVar)(localPSet.getLookupType((XVar)(field)) == Constants.LT_LOOKUPTABLE) || (XVar)(localPSet.getLookupType((XVar)(field)) == Constants.LT_QUERY))) && (XVar)(localPSet.getLinkField((XVar)(field)) != localPSet.getDisplayField((XVar)(field))))
                    {
                        viewFormat = new XVar(Constants.FORMAT_LOOKUP_WIZARD);
                    }
                    else
                    {
                        viewFormat = XVar.Clone(this.pSet.getViewFormat((XVar)(field)));
                    }
                }
                else
                {
                    viewFormat = XVar.Clone(format);
                }
                className = XVar.Clone(vcTypes.viewTypes[viewFormat]);
                if ((XVar)(className == XVar.Pack("")) && (XVar)(viewFormat != XVar.Pack("")))
                {
                    className   = XVar.Clone(MVCFunctions.Concat("View", viewFormat));
                    userControl = new XVar(true);
                }
                if (className != XVar.Pack(""))
                {
                    this.viewControls.InitAndSetArrayItem(MVCFunctions.createViewControlClass((XVar)(className), (XVar)(field), this, (XVar)(this.pageObject)), field);
                }
                else
                {
                    this.viewControls.InitAndSetArrayItem(new ViewControl((XVar)(field), this, (XVar)(this.pageObject)), field);
                }
                if (XVar.Pack(userControl))
                {
                    this.viewControls[field].viewFormat = XVar.Clone(className);
                    this.viewControls[field].init();
                    this.viewControls[field].initUserControl();
                }
            }
            return(XVar.UnPackViewControl(this.viewControls[field] ?? new XVar()));
        }