Exemple #1
0
        public static List <ControlResult> PestControls(string pest_id)
        {
            List <Solution>      solutions = PestProcess.PestSolutions(pest_id, false);
            List <ControlResult> controls  = new List <ControlResult>();

            foreach (var solution in solutions)
            {
                ControlResult control = new ControlResult()
                {
                    Control     = db.Controls.FirstOrDefault(c => c.C_ID == solution.C_ID).Description,
                    Description = solution.Description
                };
                controls.Add(control);
            }
            return(controls);
        }
Exemple #2
0
        public static List <Symptom> SymptomsFromKeyword(string fruit, string malebud,
                                                         string leaves, string stem,
                                                         string corm, string root, string whole)
        {
            List <Symptom> _symptoms = new List <Symptom>();
            List <Disease> _diseases = new List <Disease>();
            List <Pest>    _pests    = new List <Pest>();

            //Symtoms Retrieval
            List <Symptom> fruit_symptoms   = SymptomsFromKeywords(Constants.RemoveEmptyString(fruit));
            List <Symptom> malebud_symptoms = SymptomsFromKeywords(Constants.RemoveEmptyString(malebud));
            List <Symptom> leaves_symptoms  = SymptomsFromKeywords(Constants.RemoveEmptyString(leaves));
            List <Symptom> stem_symptoms    = SymptomsFromKeywords(Constants.RemoveEmptyString(stem));
            List <Symptom> corm_symptoms    = SymptomsFromKeywords(Constants.RemoveEmptyString(corm));
            List <Symptom> root_symptoms    = SymptomsFromKeywords(Constants.RemoveEmptyString(root));
            List <Symptom> whole_symptoms   = SymptomsFromKeywords(Constants.RemoveEmptyString(whole));

            foreach (var fruit_symptom in fruit_symptoms)
            {
                List <Disease> _ds = DiseaseProcess.KeywordDiseases(fruit_symptom.Description);
                List <Pest>    _ps = PestProcess.KeywordPests(fruit_symptom.Description);
                if (_ds != null)
                {
                    foreach (var _disease in _ds)
                    {
                        _diseases.Add(_disease);
                    }
                }
                if (_ps != null)
                {
                    foreach (var _pest in _ps)
                    {
                        _pests.Add(_pest);
                    }
                }
            }
            foreach (var malebud_symptom in malebud_symptoms)
            {
                List <Disease> _ds = DiseaseProcess.KeywordDiseases(malebud_symptom.Description);
                List <Pest>    _ps = PestProcess.KeywordPests(malebud_symptom.Description);
                if (_ds != null)
                {
                    foreach (var _disease in _ds)
                    {
                        _diseases.Add(_disease);
                    }
                }
                if (_ps != null)
                {
                    foreach (var _pest in _ps)
                    {
                        _pests.Add(_pest);
                    }
                }
            }
            foreach (var leaves_symptom in leaves_symptoms)
            {
                List <Disease> _ds = DiseaseProcess.KeywordDiseases(leaves_symptom.Description);
                List <Pest>    _ps = PestProcess.KeywordPests(leaves_symptom.Description);
                if (_ds != null)
                {
                    foreach (var _disease in _ds)
                    {
                        _diseases.Add(_disease);
                    }
                }
                if (_ps != null)
                {
                    foreach (var _pest in _ps)
                    {
                        _pests.Add(_pest);
                    }
                }
            }
            foreach (var stem_symptom in stem_symptoms)
            {
                List <Disease> _ds = DiseaseProcess.KeywordDiseases(stem_symptom.Description);
                List <Pest>    _ps = PestProcess.KeywordPests(stem_symptom.Description);
                if (_ds != null)
                {
                    foreach (var _disease in _ds)
                    {
                        _diseases.Add(_disease);
                    }
                }
                if (_ps != null)
                {
                    foreach (var _pest in _ps)
                    {
                        _pests.Add(_pest);
                    }
                }
            }
            foreach (var corm_symptom in corm_symptoms)
            {
                List <Disease> _ds = DiseaseProcess.KeywordDiseases(corm_symptom.Description);
                List <Pest>    _ps = PestProcess.KeywordPests(corm_symptom.Description);
                if (_ds != null)
                {
                    foreach (var _disease in _ds)
                    {
                        _diseases.Add(_disease);
                    }
                }
                if (_ps != null)
                {
                    foreach (var _pest in _ps)
                    {
                        _pests.Add(_pest);
                    }
                }
            }
            foreach (var root_symptom in root_symptoms)
            {
                List <Disease> _ds = DiseaseProcess.KeywordDiseases(root_symptom.Description);
                List <Pest>    _ps = PestProcess.KeywordPests(root_symptom.Description);
                if (_ds != null)
                {
                    foreach (var _disease in _ds)
                    {
                        _diseases.Add(_disease);
                    }
                }
                if (_ps != null)
                {
                    foreach (var _pest in _ps)
                    {
                        _pests.Add(_pest);
                    }
                }
            }
            foreach (var whole_symptom in whole_symptoms)
            {
                List <Disease> _ds = DiseaseProcess.KeywordDiseases(whole_symptom.Description);
                List <Pest>    _ps = PestProcess.KeywordPests(whole_symptom.Description);
                if (_ds != null)
                {
                    foreach (var _disease in _ds)
                    {
                        _diseases.Add(_disease);
                    }
                }
                if (_ps != null)
                {
                    foreach (var _pest in _ps)
                    {
                        _pests.Add(_pest);
                    }
                }
            }
            List <Disease> _finaldiseases = DiseaseProcess.ClearDiseases(_diseases);
            List <Pest>    _finalpests    = PestProcess.ClearPests(_pests);

            return(ClearSymptoms(RemoveSymptomRepetions(GenerateSymptoms(_finaldiseases, _finalpests))));
        }