Example #1
0
    private int mSetPriority()
    {
        MediaSubjects mediaSubjects = new MediaSubjects();

        mediaSubjects.LoadByIDSubjectAndIDMediaSubjectType(pSubjectID, pMediaSubjectTypeID);
        mediaSubjects.Sort = MediaSubjects.ColumnNames.Priority;
        if (mediaSubjects.RowCount > 0)
        {
            mediaSubjects.MoveTo(mediaSubjects.RowCount - 1);
            if (!mediaSubjects.IsColumnNull(MediaSubjects.ColumnNames.Priority))
            {
                return(mediaSubjects.pPriority + 1);
            }
            else
            {
                mediaSubjects.Rewind();
                int i = 1;
                if (mediaSubjects.RowCount > 0)
                {
                    do
                    {
                        mediaSubjects.pPriority = i;
                        i++;
                    }while (mediaSubjects.MoveNext());
                    mediaSubjects.Save();
                }
                return(i++);
            }
        }
        else
        {
            return(1);
        }
    }