private int getTargetYear(int targetID)
        {
            SalesTarget target = new SalesTarget();

            target.LoadByPrimaryKey(targetID);
            return(target.Year);
        }
        private string getLast5YearsTargetIDs()
        {
            string targetIDs = "";

            try
            {
                string      targetYears = "";
                SalesTarget thisTarget  = new SalesTarget();
                thisTarget.LoadByPrimaryKey(TargetID);
                int         targetYear = thisTarget.Year;
                SalesTarget target     = new SalesTarget();
                target.Where.Active.Value  = true;
                target.Where.Year.Value    = targetYear;
                target.Where.Year.Operator = WhereParameter.Operand.LessThan;
                target.Query.AddOrderBy(SalesTarget.ColumnNames.Year, WhereParameter.Dir.DESC);
                target.Query.Top = 5;
                if (target.Query.Load())
                {
                    if (target.DefaultView != null && target.DefaultView.Count > 0)
                    {
                        do
                        {
                            if (targetIDs == "")
                            {
                                targetIDs = "'" + target.ID + "'";
                            }
                            else
                            {
                                targetIDs += ",'" + target.ID + "'";
                            }

                            if (targetYears == "")
                            {
                                targetYears = "'" + target.Year + "'";
                            }
                            else
                            {
                                targetYears += ",'" + target.Year + "'";
                            }
                        } while (target.MoveNext());
                    }
                }
            }
            catch (Exception ex)
            {
                //Logger.LogException(ex);
            }
            return(targetIDs);
        }