Пример #1
0
        public ResultList selectAsResultList(string sql)
        {
            ResultList res = new ResultList();

            MySql.Data.MySqlClient.MySqlDataReader reader = this.sql_select(sql);
            if (reader != null)
            {
                Boolean todoInit = true;
                while (reader.Read())
                {
                    int insertRow = res.AddRow();
                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        Object dataValue = null;
                        try
                        {
                            dataValue = reader.GetValue(i);
                        }
                        catch (Exception)
                        {
                        }
                        string column = reader.GetName(i);
                        if (todoInit)
                        {
                            res.AddColumn(column);
                        }

                        res.setValue(column, insertRow, dataValue);
                    }
                    todoInit = false;
                }
            }
            return(res);
        }
Пример #2
0
        public ResultList resultFromSelected()
        {
            ResultList tmp = new ResultList();

            if (this.listView.SelectedItems.Count > 0)
            {
                Boolean todoInit = true;
                for (int i = 0; i < this.listView.SelectedItems.Count; i++)
                {
                    int rowNr = tmp.AddRow();
                    for (int a = 0; a < listView.Columns.Count; a++)
                    {
                        string header = listView.Columns[a].Text;
                        string value  = listView.SelectedItems[i].SubItems[a].Text.ToString();
                        if (todoInit)
                        {
                            tmp.AddColumn(header);
                        }
                        tmp.setValue(header, rowNr, value);
                    }
                    todoInit = false;
                }
            }
            return(tmp);
        }
Пример #3
0
        public ResultList getGroupMemberAsResultList(string groupName, string name)
        {
            GroupProfilWorker worker = new GroupProfilWorker(new PConfig());
            List <string>     grps   = worker.getGroupMember(groupName);

            ResultList result = new ResultList();

            result.AddColumn(name);

            foreach (string membername in grps)
            {
                int rowIndex = result.AddRow();
                result.setValue(name, rowIndex, membername);
            }
            return(result);
        }
Пример #4
0
        public ResultList Split(string splitByChars, string fieldName)
        {
            ResultList splitResult = new ResultList();

            if (this.val == "")
            {
                return(splitResult);
            }
            string[] parts = this.val.Split(splitByChars.ToCharArray());
            splitResult.AddColumn(fieldName);
            foreach (string part in parts)
            {
                int newIndex = splitResult.AddRow();
                splitResult.setValue(fieldName, newIndex, part);
            }
            return(splitResult);
        }