Esempio n. 1
0
        public void InitPlanDataGrid()
        {
            string evalStr = "(get_weightage_phone_plan_list)";
            MultifieldValue mv = (MultifieldValue)environment.Eval(evalStr);
            phase4Results.Clear();

            for (int i = 0; i < mv.Count; i++)
            {
                FactAddressValue fv = (FactAddressValue)mv[i];
                PlanResultDisplay display = new PlanResultDisplay();
                String sModel = "";
                try
                {
                    float fphoneprice = (float)(FloatValue)fv.GetFactSlot("phoneprice");

                }
                catch (Exception exception)
                {
                    try
                    {
                        String sProvider = (String)(SymbolValue)fv.GetFactSlot("provider");
                    }
                    catch (Mommosoft.ExpertSystem.Interop.ExpertSystemException ex)
                    {
                        if ((fv.GetFactSlot("model").GetType().ToString()).Equals("Mommosoft.ExpertSystem.SymbolValue"))
                            sModel = (String)(SymbolValue)fv.GetFactSlot("model");
                        else if ((fv.GetFactSlot("model").GetType().ToString()).Equals("Mommosoft.ExpertSystem.IntegerValue"))
                            sModel = ((int)(IntegerValue)fv.GetFactSlot("model")).ToString();
                        float fweightagePhone = (float)(FloatValue)fv.GetFactSlot("normalizedWeightagePhone");
                        float fweightagePlan = (float)(FloatValue)fv.GetFactSlot("normalizedWeightagePlan");
                        String sPlan = (String)(SymbolValue)fv.GetFactSlot("plan");

                        display.fWeightagePhone = fweightagePhone;
                        display.fWeightagePlan = fweightagePlan;
                        display.sModel = sModel;
                        display.sPlan = sPlan;

                        phase4Results.Add(display);
                    }
                }
            }

            List<PlanResultDisplay> listConvert = phase4Results.ToList();
            listConvert = listConvert.OrderByDescending(x => x.fWeightagePhone).ToList();
            phase4Results.Clear();

            for (int i = 0; i < listConvert.Count; i++)
            {
                phase4Results.Add(listConvert.ElementAt(i));
            }

            dataGridView1.DataSource = phase4Results;
        }
Esempio n. 2
0
        public void UpdatePlanGrid(String attribute)
        {
            //string evalStr = "(update_phoneplan_list " + attribute + ")";
            string evalStr = "(get_weightage_phone_plan_list)";
            MultifieldValue mv = (MultifieldValue)environment.Eval(evalStr);
            environment.Run();

            for (int i = 0; i < mv.Count; i++)
            {
                FactAddressValue fv = (FactAddressValue)mv[i];
                PlanResultDisplay display = new PlanResultDisplay();

                String sModel = (String)(SymbolValue)fv.GetFactSlot("model");
                float fphoneprice = (float)(FloatValue)fv.GetFactSlot("phoneprice");
                String sPlan = (String)(SymbolValue)fv.GetFactSlot("plan");

                display.sModel = sModel;
                display.fprice = fphoneprice;
                display.sPlan = sPlan;
            }
        }