示例#1
0
    protected string FindCrew(int JobRno)
    {
        Collection <Sling.CalendarEvent> cShifts = new Collection <Sling.CalendarEvent>();

        if (Sling != null)
        {
            foreach (Sling.CalendarEvent Shift in Sling.Shifts)
            {
                if (Shift.JobRno == JobRno && Shift.User != null)
                {
                    cShifts.Add(Shift);
                }
            }
            Sling.SortShiftCrew(cShifts);
        }

        string htmlCrew   = string.Empty;
        int    PrevUserId = 0;

        // published
        foreach (Sling.CalendarEvent Shift in cShifts)
        {
            if (Shift.User.ID == PrevUserId || Shift.Status == "planning")
            {
                continue;
            }

            htmlCrew  += FormatCrew(Shift);
            PrevUserId = Shift.User.ID;
        }

        string htmlPlan = string.Empty;

        PrevUserId = 0;

        // planning
        foreach (Sling.CalendarEvent Shift in cShifts)
        {
            if (Shift.User.ID == PrevUserId || Shift.Status != "planning")
            {
                continue;
            }

            htmlPlan  += FormatCrew(Shift);
            PrevUserId = Shift.User.ID;
        }

        if (htmlPlan.Length > 0)
        {
            if (htmlCrew.Length > 0)
            {
                htmlCrew += "<hr>\n";
            }
            htmlCrew += "<div class=\"Planning\">Planning</div>\n" + htmlPlan;
        }

        return(htmlCrew);
    }