Exemplo n.º 1
0
        public List <SchemaEntityClass> EmployeeSchemaEntityParser(Dictionary <string, List <Dictionary <string, string> > > SearchResult, string SearchInput)
        {
            List <SchemaEntityClass> SchemaEntityList = new List <SchemaEntityClass>();

            string[] SearchInputWords = SearchInput.Trim().Split(' ');


            // Iterate schema collection
            foreach (KeyValuePair <string, List <Dictionary <string, string> > > Item in SearchResult)
            {
                SchemaEntityClass objSchemaEntity = new SchemaEntityClass();
                objSchemaEntity.SchemaName  = Item.Key;
                objSchemaEntity.InputSearch = SearchInput;
                objSchemaEntity.WordCount   = Item.Value.Count;
                int WordSchemaMatchCount = 0;
                int count = 0;
                List <WordSchemaReferenceValueClass> WordSchemaList = new List <WordSchemaReferenceValueClass>();
                // Iterate List of columns
                foreach (Dictionary <string, string> Columns in Item.Value)
                {
                    DateTime CurrentDateTime = DateTime.Now;

                    //Iterate dictionary - column : action, value pair
                    //bug
                    for (int i = 0; i < Columns.Count; i++)
                    {
                        objSchemaEntity.WordSchemaReferenceValueCollection = new List <WordSchemaReferenceValueClass>();
                        WordSchemaReferenceValueClass objWordSchema = new WordSchemaReferenceValueClass();

                        if (Columns.Values.ElementAt(0) != string.Empty)
                        {
                            WordSchemaMatchCount++;
                        }
                        objWordSchema.Word            = SearchInputWords[count];
                        objWordSchema.SchemaReference = Columns.Keys.ElementAt(i);
                        objWordSchema.SchemaValue     = Columns.Values.ElementAt(i);

                        WordSchemaList.Add(objWordSchema);
                    }
                    objSchemaEntity.WordSchemaMatchCount = WordSchemaMatchCount;
                    count++;
                }
                objSchemaEntity.WordSchemaReferenceValueCollection = WordSchemaList;
                SchemaEntityList.Add(objSchemaEntity);
            }
            return(SchemaEntityList);
        }
Exemplo n.º 2
0
        public SchemaEntityClass EmployeeSchemaEvaluatorMethod(Dictionary <string, List <Dictionary <string, string> > > SearchResult, string SearchInput)
        {
            SchemaEntityClass SchemaResult = new SchemaEntityClass();

            if (SearchResult != null)
            {
                List <SchemaEntityClass> SchemaEntityList = new List <SchemaEntityClass>();
                SchemaEntityList = EmployeeSchemaEntityParser(SearchResult, SearchInput);

                KuttyPayanMongodbClass KPDBObj = new KuttyPayanMongodbClass();
                bool IsInserted = KPDBObj.KPEmployeeSchemaInsertMethod(SchemaEntityList);
                if (IsInserted)
                {
                    SchemaResult = EmployeeSchemaIdentifier(SchemaEntityList);
                }
            }
            else
            {
                SchemaResult = null;
                // result = "sorry, could't understand your query";
            }
            return(SchemaResult);
        }