Exemple #1
0
		private void LoadParameters()
		{
			if ( _searchObject == null ) return;

			foreach( PropertyInfo mb in _searchObject.GetProperties())
			{
				foreach( Attribute am in mb.GetCustomAttributes( false ) )
				{
				
					if ( am is atAllowMultipleRows )
					{
						_allowMultipleSelectMethod = mb;
					}
					if ( am is atFormatCondition) 
					{
						_formato = (FormatoCondicional) mb.GetValue(_searchObject,null);						 
					}
				}
			}

			foreach( MethodBase mb in _searchObject.GetMethods() )
			{
				foreach( Attribute am in mb.GetCustomAttributes( false ) )
				{
					if ( am is SearchMember)
					{
						SearchMember sm = ( SearchMember )am;
						_dataSource = sm.DataSource;
						_getCaption = sm.Caption;
						_orderUIAvailable = sm.OrderUIAvailable;

						if(!_fastSearch)
							_fastSearch= sm.FastSearch;

						_searchMethod = mb;

						_parameters = new Parameters();
						_parameters.OrderUIAvailable = _orderUIAvailable;

						ParameterInfo[] pi = mb.GetParameters();
						for( int i = 0; i < pi.Length; i++ )
						{
							Parameter _parameter = new Parameter( pi[ i ].Name, pi[ i ] );
							_parameter.EditorType = SearchEditorType.Standar;
							_parameter.EditorObject = pi[ i ].ParameterType;

							_parameters.Add( _parameter );
							

							foreach( Attribute ap in pi[ i ].GetCustomAttributes( false ) )
							{
								if ( ap is SearchParameterInfo )
								{
									SearchParameterInfo smi = ( SearchParameterInfo )ap;

									if (smi.CaptionVariable == String.Empty) 
									{
										_parameter.Caption = smi.Caption;
									}
									else 
									{
										_parameter.Caption = Variables.GetValueString(smi.CaptionVariable);
										//En el futuro debería manejarse desde un controller para no hacer
										//referencia directa con BS.
									}									
									
									_parameter.IsAlternativePrimaryKey = smi.IsAlternativePrimaryKey;
									_parameter.IsDescription = smi.IsDescription;
									if(_orderUIAvailable)
										_parameter.OrderUI = smi.OrderUI;
								}

								if ( ap is SearchEditor )
								{
									SearchEditor se = ( SearchEditor )ap;
									_parameter.EditorType = se.EditorType;
									_parameter.EditorObject = se.EditorObject;
									if(_orderUIAvailable)
										_parameter.OrderUI = se.OrderUI;
								}
								
							}
						}
					}
					if (am is atMethodLayoutData)
					{
						_layoutMethod = mb;
					}
				}
			}
		}
Exemple #2
0
        private void LoadParameters()
        {
            if (_searchObject == null)
            {
                return;
            }


            foreach (MethodBase mb in _searchObject.GetMethods())
            {
                foreach (Attribute am in mb.GetCustomAttributes(false))
                {
                    if (am is HierarchicalSearchMember)
                    {
                        HierarchicalSearchMember sm = ( HierarchicalSearchMember )am;


                        _searchMethod         = mb;
                        _searchTreeMethodType = sm.TreeByDemandType;
                        foreach (MethodBase mb1 in _searchTreeMethodType.GetMethods())
                        {
                            foreach (Attribute am1 in mb1.GetCustomAttributes(false))
                            {
                                if (am1 is TreeByDemandAttribute)
                                {
                                    _searchTree = mb1;
                                }
                            }
                        }
                    }
                    if (am is atMethodLayoutData)
                    {
                        _layoutMethod = mb;
                    }
                    if (am is SearchMember)
                    {
                        SearchMember sm = ( SearchMember )am;
                        _dataSource = sm.DataSource;

                        _getCaption = sm.Caption;

                        if (!_fastSearch)
                        {
                            _fastSearch = sm.FastSearch;
                        }

                        _searchMethod = mb;

                        _parameters = new Parameters();

                        ParameterInfo[] pi = mb.GetParameters();
                        for (int i = 0; i < pi.Length; i++)
                        {
                            Parameter _parameter = new Parameter(pi[i].Name, pi[i]);
                            _parameter.EditorType   = SearchEditorType.Standar;
                            _parameter.EditorObject = pi[i].ParameterType;

                            _parameters.Add(_parameter);

                            foreach (Attribute ap in pi[i].GetCustomAttributes(false))
                            {
                                if (ap is SearchParameterInfo)
                                {
                                    SearchParameterInfo smi = ( SearchParameterInfo )ap;

                                    _parameter.Caption = smi.Caption;
                                    _parameter.IsAlternativePrimaryKey = smi.IsAlternativePrimaryKey;
                                    _parameter.IsDescription           = smi.IsDescription;
                                }

                                if (ap is SearchEditor)
                                {
                                    SearchEditor se = ( SearchEditor )ap;
                                    _parameter.EditorType   = se.EditorType;
                                    _parameter.EditorObject = se.EditorObject;
                                }
                            }
                        }
                    }
                }
            }
        }