예제 #1
0
        private string doQueryDetails(Config config, string id, List <string> paramethers, out string err)
        {
            err = "";

            Connector cnx = new Connector(Constants.username, Constants.password, config.realm);

            cnx.setToken(config.token);

            if (!cnx.Login())
            {
                err = "Authentication failed. " + cnx.getMessage();
                return(null);
            }
            // reemplazar XD
            string QUERY = config.query;

            for (int i = 0; i < config.paramethers.Count; i++)
            {
                if (paramethers != null)
                {
                    for (int j = 0; j < paramethers.Count; j++)
                    {
                        if (config.paramethers[i].name == paramethers[j])
                        {
                            if (j + 1 < paramethers.Count)
                            {
                                QUERY = QUERY.Replace("__" + config.paramethers[i].name + "__", paramethers[j + 1]);
                            }
                        }
                    }
                }
            }

            var list = cnx.DoQuery(config.dbid, QUERY, config.clist + ".3", config.qid);

            if (list != null)
            {
                if (list.Count == 0)
                {
                    return(sendResponse(new List <List <KeyValuePair <string, string> > >()));
                }
                else
                {
                    List <List <KeyValuePair <string, string> > > lista = new List <List <KeyValuePair <string, string> > >();

                    foreach (Record R in list)
                    {
                        List <KeyValuePair <string, string> > obj = new List <KeyValuePair <string, string> >();

                        string QUERY_CHILD = config.details.query;

                        foreach (Paramether P in config.response)
                        {
                            obj.Add(new KeyValuePair <string, string>(P.name, R.getFieldValue(P.fid)));
                            QUERY_CHILD = QUERY_CHILD.Replace("__" + P.name + "__", R.getFieldValue(P.fid));
                        }


                        // Buscamos los hijos
                        {
                            var childs = cnx.DoQuery(config.details.dbid, QUERY_CHILD, config.details.clist + ".3", -1);


                            List <List <KeyValuePair <string, string> > > listaChilds = new List <List <KeyValuePair <string, string> > >();

                            foreach (Record RChild in childs)
                            {
                                List <KeyValuePair <string, string> > objCh = new List <KeyValuePair <string, string> >();

                                foreach (Paramether PCh in config.details.response)
                                {
                                    objCh.Add(new KeyValuePair <string, string>(PCh.name, RChild.getFieldValue(PCh.fid)));
                                }

                                listaChilds.Add(objCh);
                            }

                            string json = sendResponse(listaChilds);
                            // Agregamos todos los hijos como Elemento al padre
                            obj.Add(new KeyValuePair <string, string>("CHILDS", json));
                        }



                        lista.Add(obj);
                    }

                    return(sendResponse(lista));
                }
            }


            return(null);
        }
예제 #2
0
 public override double NumericEval()
 {
     return(Math.Pow(LChild.NumericEval(), RChild.NumericEval()));
 }
예제 #3
0
 public override string Print()
 {
     return("(" + LChild.Print() + ") ^ (" + RChild.Print() + ")");
 }
예제 #4
0
 public override double NumericEval()
 {
     return(LChild.NumericEval() / RChild.NumericEval());
 }