Esempio n. 1
0
        public static string[] valuesOfColumnParameters(int selectionId, int paramId)
        {
            Selection     selection  = (Selection)Selection.getById(selectionId, typeof(Selection));
            int           templateId = selection.TaskTemplateID;
            Query         query      = new Query("SelectionRow").addTypeQuery(TypeQuery.select).addCondition("SelectionID", "=", selectionId.ToString());
            List <Entity> rows       = SelectionRow.where (query, typeof(SelectionRow));
            Query         valQuery   = new Query("ValueParameter").addTypeQuery(TypeQuery.select)
                                       .addInArray("SelectionRowID", rows.Select(x => x.ID).ToArray())
                                       .addCondition("ParameterID", "=", paramId.ToString());

            ValueParameter[] values = ValueParameter.where (valQuery, typeof(ValueParameter)).Cast <ValueParameter>().ToArray();
            int[]            ids    = rows.Select(x => x.ID).ToArray();
            string[]         res    = new string[ids.Length];
            var index = 0;

            foreach (int id in ids)
            {
                ValueParameter[] vals = values.Where(x => x.SelectionRowID == id).ToArray();
                res[index] = "";
                if (vals.Length > 0)
                {
                    res[index] = vals[0].Value;
                }
                index++;
            }

            return(res);
        }
Esempio n. 2
0
        public static Entity[] valueParametersOfColumn(int selectionId, int paramId)
        {
            Selection     selection  = (Selection)Selection.getById(selectionId, typeof(Selection));
            int           templateId = selection.TaskTemplateID;
            Query         query      = new Query("SelectionRow").addTypeQuery(TypeQuery.select).addCondition("SelectionID", "=", selectionId.ToString());
            List <Entity> rows       = SelectionRow.where (query, typeof(SelectionRow));
            Query         valQuery   = new Query("ValueParameter").addTypeQuery(TypeQuery.select)
                                       .addInArray("SelectionRowID", rows.Select(x => x.ID).ToArray())
                                       .addCondition("ParameterID", "=", paramId.ToString());

            ValueParameter[] values = ValueParameter.where (valQuery, typeof(ValueParameter)).Cast <ValueParameter>().ToArray();

            return(values);
        }
Esempio n. 3
0
        public static string[][] valuesOfSelectionId(int selectionId)
        {
            Selection selection  = (Selection)Selection.getById(selectionId, typeof(Selection));
            int       templateId = selection.TaskTemplateID;

            Parameter[] parameters = Parameter.parametersOfTaskTemplateId(templateId).ToArray();
            parameters = parameters.OrderBy(c => c.Index).ToArray();
            Query         query    = new Query("SelectionRow").addTypeQuery(TypeQuery.select).addCondition("SelectionID", "=", selectionId.ToString());
            List <Entity> rows     = SelectionRow.where (query, typeof(SelectionRow));
            Query         valQuery = new Query("ValueParameter").addTypeQuery(TypeQuery.select).addInArray("SelectionRowID", rows.Select(x => x.ID).ToArray());

            ValueParameter[] values = ValueParameter.where (valQuery, typeof(ValueParameter)).Cast <ValueParameter>().ToArray();
            int[]            ids    = rows.Select(x => x.ID).ToArray();
            string[][]       res    = new string[ids.Length][];
            var index = 0;

            foreach (int id in ids)
            {
                ValueParameter[] vals = values.Where(x => x.SelectionRowID == id).ToArray();
                res[index] = new string[parameters.Length];
                int j = 0;
                foreach (Parameter par in parameters)
                {
                    ValueParameter[] find = vals.Where(x => x.ParameterID == par.ID).ToArray();
                    if (find.Length > 0)
                    {
                        string value = find[0].Value;
                        res[index][j] = value;
                    }
                    else
                    {
                        res[index][j] = "";
                    }


                    j++;
                }
                index++;
            }

            return(res);
        }