예제 #1
0
        } //ende main

        public ArrayList getArray(ArrayList myAl)
        {
            var newArr = myAl;

            var kategorie     = "";
            var kategorieid   = 0;
            var finalarr      = new ArrayList();
            var subcatcounter = 1;
            var counter       = 1;

            var zeilencounter = 1;
            var curcat        = new Category();

            foreach (ArrayList zeile in newArr)
            {
                if (zeile.Count == 1)
                {
                    kategorie     = zeile[0].ToString();
                    subcatcounter = 1;
                    curcat.Id     = counter++;
                    curcat.Name   = kategorie;
                    continue;
                }
                if (zeile.Count == 4 ||
                    zeile.Count == 5)
                {
                    var gfcell = new GFHelper();

                    gfcell.gfactor = getString(zeile[0]);
                    //gfcell.rightsource = gfcell.getString(zeile[2]);
                    gfcell.id = zeilencounter++;

                    if (zeile.Count == 5)
                    {
                        //gfcell.comments = gfcell.getString(zeile[4]);
                    }

                    if (zeile[1].GetType() == typeof(ArrayList))
                    {
                        var arrlst = (ArrayList)zeile[1];
                        foreach (var arr in arrlst)
                        {
                            //gfcell.arrThreatsource.Add(arr);
                            gfcell.arrDpoints.Add(arr);
                        }
                    }
                    if (zeile[3].GetType() == typeof(ArrayList))
                    {
                        var arrlst = (ArrayList)zeile[3];
                        foreach (var arr in arrlst)
                        {
                            gfcell.arrQuestion.Add(arr);
                        }
                    }

                    var newcat = new Category();
                    newcat.Id   = curcat.Id;
                    newcat.Name = curcat.Name;

                    gfcell.category = newcat;

                    finalarr.Add(gfcell);
                }
            } //ende foreach
            newArr = finalarr;

            return(newArr);
        }
예제 #2
0
        public ArrayList getArray(ArrayList myAl)
        {
            var newArr = myAl;

              var kategorie = "";
              var kategorieid = 0;
              var finalarr = new ArrayList();
              var subcatcounter = 1;
              var counter = 1;

              var zeilencounter = 1;
              var curcat = new Category();

              foreach (ArrayList zeile in newArr)
              {
            if (zeile.Count == 1)
            {
              kategorie = zeile[0].ToString();
              subcatcounter = 1;
              curcat.Id = counter++;
              curcat.Name = kategorie;
              continue;
            }
            if (zeile.Count == 4 || zeile.Count == 5)
            {
              var gfcell = new GFHelper();

              gfcell.gfactor = getString(zeile[0]);
              //gfcell.rightsource = gfcell.getString(zeile[2]);
              gfcell.id = zeilencounter++;

              if (zeile.Count == 5)
              {
            //gfcell.comments = gfcell.getString(zeile[4]);
              }

              if (zeile[1].GetType() == typeof (ArrayList))
              {
            var arrlst = (ArrayList) zeile[1];
            foreach (var arr in arrlst)
            {
              //gfcell.arrThreatsource.Add(arr);
              gfcell.arrDpoints.Add(arr);
            }
              }
              if (zeile[3].GetType() == typeof (ArrayList))
              {
            var arrlst = (ArrayList) zeile[3];
            foreach (var arr in arrlst)
            {
              gfcell.arrQuestion.Add(arr);
            }
              }

              var newcat = new Category();
              newcat.Id = curcat.Id;
              newcat.Name = curcat.Name;

              gfcell.category = newcat;

              finalarr.Add(gfcell);
            }
              } //ende foreach
              newArr = finalarr;

              return newArr;
        }