Example #1
0
    protected string GetActivityCommandArg(object obj)
    {
        ActivityTreeListRow row = (ActivityTreeListRow)obj;

        return(row.Code);
    }
Example #2
0
 public static string GetCodeAndParent(this ActivityTreeListRow row)
 {
     return(row.Code + "&" + row.ParentCode);
 }
Example #3
0
    protected string GetName(object obj)
    {
        ActivityTreeListRow row = (ActivityTreeListRow)obj;

        return(row.GetName());
    }
Example #4
0
 public static bool AllowFacilityLink(this ActivityTreeListRow row)
 {
     return(!TreeListRow.CODE_UNKNOWN.Equals(row.Code));
 }
Example #5
0
 public static string GetIndentCssClass(this ActivityTreeListRow row)
 {
     return(CssBuilder.IndentLevelCss(row.Level));
 }
Example #6
0
 public static string GetRowCssClass(this ActivityTreeListRow row)
 {
     return("generalListStyle_row " + CssBuilder.TreeLevelCss(row.Level));
 }
Example #7
0
 /// <summary>
 /// returns the name of the sector / activity / subactivity
 /// </summary>
 public static string GetName(this ActivityTreeListRow row)
 {
     return(LOVResources.AnnexIActivityName(row.Code));
 }
        public int Compare(object x, object y)
        {
            ActivityTreeListRow row1 = x as ActivityTreeListRow;
            ActivityTreeListRow row2 = y as ActivityTreeListRow;

            //if all codes are the same the rows are identical.
            if (row1.SectorCode == row2.SectorCode && row1.ActivityCode == row2.ActivityCode && row1.SubactivityCode == row2.SubactivityCode)
            {
                return(0);
            }

            //total row must always be last
            if (row1.Code.Equals(ActivityTreeListRow.CODE_TOTAL))
            {
                return(1);
            }
            if (row2.Code.Equals(ActivityTreeListRow.CODE_TOTAL))
            {
                return(-1);
            }
            if (row1.Code.Equals(ActivityTreeListRow.CODE_TOTAL) && row2.Code.Equals(ActivityTreeListRow.CODE_TOTAL))
            {
                return(0);
            }

            CaseInsensitiveComparer c = new CaseInsensitiveComparer();

            //compare sectors
            int res = row1.SectorCode.CompareTo(row2.SectorCode);

            //if sectors are the same, compare activities
            if (res == 0)
            {
                //sector must always come first
                if (row1.ActivityCode == null)
                {
                    return(-1);
                }
                if (row2.ActivityCode == null)
                {
                    return(1);
                }
                if (row1.ActivityCode == null && row2.ActivityCode == null)
                {
                    return(0);
                }

                //compare level to keep country before regions within the country
                res = row1.ActivityCode.CompareTo(row2.ActivityCode);

                if (res == 0)
                {
                    //activity must always come first
                    if (row1.SubactivityCode == null)
                    {
                        return(-1);
                    }
                    if (row2.SubactivityCode == null)
                    {
                        return(1);
                    }
                    if (row1.SubactivityCode == null && row2.SubactivityCode == null)
                    {
                        return(0);
                    }


                    //unknown region must always be last
                    //if (row1.Code.Equals(TreeListRow.CODE_UNKNOWN)) return 1;
                    //if (row2.Code.Equals(TreeListRow.CODE_UNKNOWN)) return -1;
                    //if (row1.Code.Equals(TreeListRow.CODE_UNKNOWN) && row2.Code.Equals(TreeListRow.CODE_UNKNOWN)) return 0;

                    //compare subactivities
                    res = row1.SubactivityCode.CompareTo(row2.SubactivityCode);

                    //res = c.Compare(row1.GetAreaName(this.areaFilter), row2.GetAreaName(this.areaFilter));
                }
            }


            return(res);
        }