Ejemplo n.º 1
0
        /// <summary>
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void RenderContent(HtmlTextWriter output)
        {
            DojoBulkAttendanceEntryManager    m = new DojoBulkAttendanceEntryManager();
            DojoBulkAttendanceEntryCollection dojoBulkAttendanceEntryCollection = m.GetCollection(string.Empty, string.Empty, null);

            // Render Header Row
            this.headerLockEnabled = true;
            RenderRow(this.HeaderRowCssClass, );

            bool   rowflag = false;
            string rowCssClass;

            //
            // Render Records
            //
            foreach (DojoBulkAttendanceEntry dojoBulkAttendanceEntry in dojoBulkAttendanceEntryCollection)
            {
                if (rowflag)
                {
                    rowCssClass = defaultRowCssClass;
                }
                else
                {
                    rowCssClass = alternateRowCssClass;
                }
                rowflag = !rowflag;
                output.WriteBeginTag("tr");
                output.WriteAttribute("i", dojoBulkAttendanceEntry.ID.ToString());
                output.WriteLine(HtmlTextWriter.TagRightChar);
                output.Indent++;

                output.Indent--;
                output.WriteEndTag("tr");
                output.WriteLine();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void RenderContent(HtmlTextWriter output)
        {
            EnsureChildControls();

            DojoBulkAttendanceEntryManager    m = new DojoBulkAttendanceEntryManager();
            DojoBulkAttendanceEntryCollection dojoBulkAttendanceEntryCollection = m.GetCollection(string.Empty,
                                                                                                  "LastName, FirstName, MiddleName",
                                                                                                  new DojoBulkAttendanceEntryFlags[] {
                DojoBulkAttendanceEntryFlags.Member,
                DojoBulkAttendanceEntryFlags.Rank,
                DojoBulkAttendanceEntryFlags.MemberPrivateContact
            });

            bool   rowflag = false;
            string rowCssClass;

            //
            // Render Records
            //
            foreach (DojoBulkAttendanceEntry entry in dojoBulkAttendanceEntryCollection)
            {
                if (rowflag)
                {
                    rowCssClass = this.defaultRowCssClass;
                }
                else
                {
                    rowCssClass = this.alternateRowCssClass;
                }
                rowflag = !rowflag;

                output.WriteBeginTag("tr");
                output.WriteAttribute("i", entry.ID.ToString());
                output.WriteLine(HtmlTextWriter.TagRightChar);
                output.Indent++;

                //
                // Render Main Representation of Record
                //
                output.WriteBeginTag("td");
                output.WriteAttribute("valign", "top");
                output.WriteAttribute("class", rowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(entry.Member.PrivateContact.FullName);
                output.WriteEndTag("td");
                output.WriteLine();

                //
                // Render Start and End Dates
                //
                output.WriteBeginTag("td");
                output.WriteAttribute("class", rowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(entry.StartDate.ToShortDateString());
                output.Write(" - ");
                output.Write(entry.EndDate.ToShortDateString());
                output.WriteEndTag("td");
                output.WriteLine();

                //
                // Render Time
                //
                output.WriteBeginTag("td");
                output.WriteAttribute("class", rowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(entry.Duration.TotalHours);
                output.Write(" hrs. ");
                output.WriteEndTag("td");
                output.WriteLine();

                //
                // Render Rank
                //
                output.WriteBeginTag("td");
                output.WriteAttribute("class", rowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(entry.Rank.Name);
                output.WriteEndTag("td");
                output.WriteLine();

                if (deleteEnabled)
                {
                    output.WriteBeginTag("a");
                    output.WriteAttribute("href", "javascript:" + Page.ClientScript.GetPostBackEventReference(this, "delete_" + entry.ID));
                    output.Write(HtmlTextWriter.TagRightChar);
                    output.Write("delete");
                    output.WriteEndTag("a");
                    output.WriteLine();
                }

                output.Indent--;
                output.WriteEndTag("tr");
                output.WriteLine();
            }
        }
Ejemplo n.º 3
0
        public void RunScan()
        {
            DojoBulkAttendanceEntryManager    bulkManager;
            DojoBulkAttendanceEntryCollection bulkAttendance;
            DojoAttendanceEntryManager        m;
            DojoAttendanceEntryCollection     attendance;
            double   classLength;
            DateTime dayIndex;
            double   dayWeightedHours;
            double   dayWeightedHoursInRank;
            DateTime firstDayOfWeek;
            DateTime lastDayOfWeek;
            DateTime firstDayOfLastWeek;
            DateTime lastDayOfLastWeek;

            bulkManager = new DojoBulkAttendanceEntryManager();

            bulkAttendance =
                bulkManager.GetCollection("MemberID=" + member.iD, string.Empty, null);

            // Load the attendance entry collection and be sure to sort by ClassStart
            // so that the system can calculate weighted hours properly.
            m          = new DojoAttendanceEntryManager();
            attendance =
                m.GetCollection("MemberID=" + member.iD, "ClassStart", DojoAttendanceEntryFlags.Class);


            // Clear Data
            this.totalBulkHours           = 0;
            this.totalBulkHoursInRank     = 0;
            this.totalHours               = 0;
            this.totalHoursInRank         = 0;
            this.totalWeightedHours       = 0;
            this.totalWeightedHoursInRank = 0;
            this.totalHoursThisWeek       = 0;
            this.totalHoursLastWeek       = 0;

            classLength            = 0;
            dayIndex               = DateTime.MinValue;
            dayWeightedHours       = 0;
            dayWeightedHoursInRank = 0;

            firstDayOfWeek     = DateManipulator.FirstOfWeek(DateTime.Now);
            lastDayOfWeek      = firstDayOfWeek.Add(new TimeSpan(6, 23, 59, 59, 999));
            firstDayOfLastWeek = DateManipulator.FirstOfWeek(DateTime.Now.Subtract(TimeSpan.FromDays(7)));
            lastDayOfLastWeek  = firstDayOfLastWeek.Add(new TimeSpan(6, 23, 59, 59, 999));

            // Scan Bulk Hours
            for (int x = 0; x < bulkAttendance.Count; x++)
            {
                totalBulkHours += bulkAttendance[x].Duration.TotalHours;

                if (bulkAttendance[x].rank.iD == member.rank.iD)
                {
                    totalBulkHoursInRank += bulkAttendance[x].Duration.TotalHours;
                }
            }

            if (attendance.Count > 0)
            {
                dayIndex = attendance[0].Class.ClassStart.Date;
            }

            for (int x = 0; x < attendance.Count; x++)
            {
                classLength = (attendance[x].Class.ClassEnd - attendance[x].Class.ClassStart).TotalHours;

                // Total Hours
                totalHours += classLength;

                // Total Hours in Rank
                if (attendance[x].rank.iD == member.rank.iD)
                {
                    totalHoursInRank += classLength;
                }

                // Total Weighted Hours
                if (attendance[x].Class.ClassStart.Date != dayIndex)
                {
                    // Add Prior Temporary Values
                    totalWeightedHours       += dayWeightedHours;
                    totalWeightedHoursInRank += dayWeightedHoursInRank;

                    // Reset Hours for Day
                    dayWeightedHours       = 0;
                    dayWeightedHoursInRank = 0;
                    dayIndex = attendance[x].Class.ClassStart.Date;
                }

                dayWeightedHours += classLength;

                if (attendance[x].rank.iD == member.rank.iD)
                {
                    dayWeightedHoursInRank += classLength;
                }

                if (dayWeightedHours > maxDayHours)
                {
                    dayWeightedHours = maxDayHours;
                }

                if (dayWeightedHoursInRank > maxDayHours)
                {
                    dayWeightedHoursInRank = maxDayHours;
                }

                if (attendance[x].Class.ClassStart >= firstDayOfLastWeek &&
                    attendance[x].Class.ClassStart <= lastDayOfLastWeek)
                {
                    totalHoursLastWeek += classLength;
                }

                if (attendance[x].Class.ClassStart >= firstDayOfWeek &&
                    attendance[x].Class.ClassStart <= lastDayOfWeek)
                {
                    totalHoursThisWeek += classLength;
                }

                // Update Last Signin
                if (attendance[x].signinTime > lastSignin)
                {
                    lastSignin = attendance[x].signinTime;
                }
            }

            // Tally Remaining Temporary Values
            totalWeightedHours       += dayWeightedHours;
            totalWeightedHoursInRank += dayWeightedHoursInRank;

            // Find Ninety Day Instructors
            DateTime maxDate = DateTime.Now;
            DateTime minDate = maxDate.Subtract(TimeSpan.FromDays(90));

            instructor1 = attendance.FindTopInstructor(minDate, maxDate, null);
            instructor2 = attendance.FindTopInstructor(minDate, maxDate, instructor1);
            instructor3 = attendance.FindTopInstructor(minDate, maxDate, instructor1, instructor2);
        }