示例#1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Make a finder appropriate to the given column specification
        /// </summary>
        /// <param name="cache">FdoCache</param>
        /// <param name="colSpec">column specification</param>
        /// <param name="vc">The vc.</param>
        /// <param name="app">The application.</param>
        /// <returns>finder for colSpec</returns>
        /// ------------------------------------------------------------------------------------
        static public IStringFinder CreateFinder(FdoCache cache, XmlNode colSpec,
                                                 XmlBrowseViewBaseVc vc, IApp app)
        {
            string       layoutName  = XmlUtils.GetOptionalAttributeValue(colSpec, "layout");
            string       sSortMethod = XmlUtils.GetOptionalAttributeValue(colSpec, "sortmethod");
            string       sortType    = XmlUtils.GetOptionalAttributeValue(colSpec, "sortType", null);
            LayoutFinder result;

            if (sSortMethod != null)
            {
                result = new SortMethodFinder(cache, sSortMethod, layoutName, colSpec, app);
            }
            else if (sortType != null)
            {
                switch (sortType)
                {
                case "integer":
                    result = new IntCompareFinder(cache, layoutName, colSpec, app);
                    break;

                case "date":
                case "YesNo":
                case "stringList":
                case "genDate":
                    // no special action needed here for sorting dates or date that shows as 'yes" or "no";
                    // Using a SortCollectorEnv triggers special
                    // action in case "datetime"/"gendate" of XmlVc.ProcessFrag().
                    result = new LayoutFinder(cache, layoutName, colSpec, vc.StringTbl, app);
                    break;

                default:
                    throw new ConfigurationException("unexpected sort type: " + sortType, colSpec);
                }
            }
            else
            {
                result = new LayoutFinder(cache, layoutName, colSpec, vc.StringTbl, app);
            }
            result.Vc = vc;
            return(result);
        }
示例#2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make a finder appropriate to the given column specification
		/// </summary>
		/// <param name="cache">FdoCache</param>
		/// <param name="colSpec">column specification</param>
		/// <param name="vc">The vc.</param>
		/// <returns>finder for colSpec</returns>
		/// ------------------------------------------------------------------------------------
		static public IStringFinder CreateFinder(FdoCache cache, XmlNode colSpec, XmlBrowseViewBaseVc vc)
		{
			string layoutName = XmlUtils.GetOptionalAttributeValue(colSpec, "layout");
			string sSortMethod = XmlUtils.GetOptionalAttributeValue(colSpec, "sortmethod");
			string sortType = XmlUtils.GetOptionalAttributeValue(colSpec, "sortType", null);
			LayoutFinder result;
			if (sSortMethod != null)
			{
				result = new SortMethodFinder(cache, sSortMethod, layoutName, colSpec);
			}
			else if (sortType != null)
			{
				switch (sortType)
				{
					case "integer":
						result = new IntCompareFinder(cache, layoutName, colSpec);
						break;
					case "date":
					case "YesNo":
					case "stringList":
						// no special action needed here for sorting dates or date that shows as 'yes" or "no";
						// Using a SortCollectorEnv triggers special
						// action in case "datetime" of XmlVc.ProcessFrag().
						result = new LayoutFinder(cache, layoutName, colSpec, vc.StringTbl);
						break;
					default:
						throw new ConfigurationException("unexpected sort type: " + sortType, colSpec);
				}
			}
			else
			{
				result = new LayoutFinder(cache, layoutName, colSpec, vc.StringTbl);
			}
			result.Vc = vc;
			return result;
		}