Example #1
0
        /// <summary>
        /// Obtener nombre de la plantilla, basado en el tipo del campo de busqueda
        /// </summary>
        /// <param name="fieldSearch"></param>
        /// <returns></returns>
        public static string GetTemplateNameForType(this FieldSearch fieldSearch)
        {
            string result;

            _defaultTemplateName.TryGetValue(fieldSearch.FieldType, out result);
            return(result);
        }
Example #2
0
        public Search GeneratedSearchView(Type type)
        {
            Search layout = new Search();


            //Reflection
            BindingFlags memberFlags = BindingFlags.Public | BindingFlags.Instance;

            //PropertyInfo[] properties = type.GetProperties(memberFlags);

            //TODO: Definir AutoGeneration Search
            //Option 1. All Fields String. Nombres, Descripcion, Observaciones??


            //Option 2. If type is Named. IEntityNamed
            if (type.Implements(typeof(IEntityNamed)))
            {
                PropertyInfo[] propertiesInteface = typeof(IEntityNamed).GetProperties(memberFlags);

                foreach (var pro in propertiesInteface)
                {
                    var field = new FieldSearch();
                    field.Name = pro.Name;

                    //TODO: El operador segun el tipo de la propiedad
                    //Ejemplo string like, int =, date =, etc.
                    field.Operator = "==";

                    field.FieldType = pro.PropertyType;
                    field.String    = pro.Name;

                    layout.Fields.Add(field);
                }
            }

            //Option 3. Name, Nombre,Nombres, State
            //PropertyInfo[] properties = type.GetProperties(memberFlags);
            //string[] commons = { "NAME", "NOMBRE", "NOMBRES" };

            //foreach (var pro in properties)
            //{
            //    if (Array.IndexOf(commons, pro.Name.ToUpper()) > -1)
            //    {
            //        var field = new FieldSearch();
            //        field.Name = pro.Name;
            //        field.Operator = "==";
            //        field.String = pro.Name;

            //        layout.Fields.Add(field);
            //    }
            //}

            return(layout);
        }
Example #3
0
 public void SearchFlickr()
 {
     FieldSearch.SendKeys(ConfigurationManager.AppSettings.Get("WordForSearch") + OpenQA.Selenium.Keys.Enter);
 }