Beispiel #1
0
        protected override void OnPreRender(EventArgs e)
        {
            DojoClassManager           cManager;
            DojoAttendanceEntryManager aManager;
            string classQuery;
            string attendanceQuery;

            EnsureChildControls();

            if (this.backTime == TimeSpan.Zero)
            {
                classQuery =
                    "SigninEnd>=#" +
                    localTime.Subtract(backTime).ToString() + "# AND " +
                    "SigninStart<=#" +
                    localTime.ToString() + "#";
            }
            else
            {
                classQuery =
                    "ClassEnd>=#" +
                    localTime.Subtract(backTime).Date.ToString() + "# AND " +
                    "ClassStart<=#" +
                    localTime.AddDays(1).Date.ToString() + "#";
            }

            attendanceQuery =
                "MemberID=" + memberID.ToString() + " AND " +
                classQuery;

            cManager = new DojoClassManager();
            aManager = new DojoAttendanceEntryManager();;

            // Be sure to adjust the backtime if you want earlier signin times.
            classes = cManager.GetCollection(classQuery, "ClassStart",
                                             DojoClassFlags.Instructor,
                                             DojoClassFlags.InstructorRank,
                                             DojoClassFlags.InstructorPrivateContact);

            classIdArray = new string[classes.Count];

            for (int x = 0; x < classes.Count; x++)
            {
                classIdArray[x] = classes[x].iD.ToString();
            }

            Page.ClientScript.RegisterHiddenField("___" + ClientID + "Classes",
                                                  string.Join(",", classIdArray));

            attendance =
                aManager.GetCollection(attendanceQuery,
                                       string.Empty,
                                       DojoAttendanceEntryFlags.Class);
        }
        public DojoAttendanceEntryCollection Clone()
        {
            DojoAttendanceEntryCollection clonedDojoAttendanceEntry = new DojoAttendanceEntryCollection(count);

            lock (this)
            {
                foreach (DojoAttendanceEntry item in this)
                {
                    clonedDojoAttendanceEntry.Add(item);
                }
            }
            return(clonedDojoAttendanceEntry);
        }
Beispiel #3
0
        protected override void RenderViewPane(HtmlTextWriter output)
        {
            if (ConnectionString == string.Empty)
            {
                output.Write("Empty Connection String!");
            }

            DojoClass c = new DojoClass(int.Parse(Page.Request.QueryString[0]));

            RenderTableBeginTag("_viewPanel", this.CellPadding, this.CellSpacing, Unit.Percentage(100), Unit.Empty, this.CssClass);

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("th");
            output.WriteAttribute("class", this.HeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write(c.Name);
            output.WriteEndTag("th");
            output.WriteEndTag("tr");

            #region Students Attended

            DojoAttendanceEntryManager    aem     = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection entries = aem.GetCollection("ClassID=" + c.ID.ToString(), "LastName, FirstName, MiddleName",
                                                                      DojoAttendanceEntryFlags.Member, DojoAttendanceEntryFlags.MemberPrivateContact);

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", this.SubHeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Students (" + entries.Count.ToString() + ")");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            foreach (DojoAttendanceEntry entry in entries)
            {
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", this.defaultRowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(entry.Member.PrivateContact.ConstructName("LS,FMi."));
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
            }

            #endregion

            output.WriteEndTag("table");
        }
Beispiel #4
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)
        {
            DojoAttendanceEntryManager    m = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection dojoAttendanceEntryCollection = m.GetCollection(string.Empty, string.Empty, null);

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

            bool   rowflag = false;
            string rowCssClass;

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

                output.Indent--;
                output.WriteEndTag("tr");
                output.WriteLine();
            }
        }
Beispiel #5
0
        public override void Render(System.Web.UI.HtmlTextWriter output)
        {
            TableGrid grid;

            if (ParentWindow is TableGrid)
            {
                grid = (TableGrid)ParentWindow;

                if (ParentWindow is DojoMemberGrid)
                {
                }
                else if (ParentWindow is DojoTestEligibilityGrid)
                {
                }
                else
                {
                    throw(new Exception("Parent window is not supported."));
                }
            }
            else
            {
                throw(new Exception("Parent window is not supported."));
            }

            DojoMember m = new DojoMember(int.Parse(grid.Page.Request.QueryString[0]));

            RenderTableBeginTag(output, "_viewPanel", grid.CellPadding, grid.CellSpacing, Unit.Percentage(100), Unit.Empty, grid.CssClass);

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("th");
            output.WriteAttribute("class", grid.HeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write(m.PrivateContact.FullName);
            output.WriteEndTag("th");
            output.WriteEndTag("tr");

            #region Contact Information

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.SubHeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Contacts");
            if (m.PrivateContact.IsBadAddress)
            {
                output.Write(" - <strong>Bad Address</strong>");
            }
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.DefaultRowCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write(m.PrivateContact.ConstructAddress("<br />"));
            output.Write("<br />");
            if (m.PrivateContact.HomePhone != string.Empty)
            {
                output.Write(m.PrivateContact.HomePhone + " (h)<br />");
            }
            if (m.PrivateContact.WorkPhone != string.Empty)
            {
                output.Write(m.PrivateContact.WorkPhone + " (w)<br />");
            }
            if (m.PrivateContact.MobilePhone != string.Empty)
            {
                output.Write(m.PrivateContact.MobilePhone + " (m)<br />");
            }
            if (m.PrivateContact.Email1 != string.Empty)
            {
                output.Write("<a href=\"mailto:");
                output.Write(m.PrivateContact.Email1);
                output.Write("\">");
                output.Write(m.PrivateContact.Email1);
                output.Write("</a>");
                output.Write("<br />");
            }
            if (m.PrivateContact.ValidationMemo != null && m.PrivateContact.ValidationMemo.Length > 0)
            {
                output.Write("<br />");
                output.Write("<strong>Validation Memo : </strong><br />");
                output.Write(m.PrivateContact.ValidationMemo.Replace("\n", "<br />"));
            }
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            #endregion

            #region Membership Information

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.SubHeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Membership");
            if (m.IsPastDue)
            {
                output.Write(" - <strong>Past Due</strong>");
            }
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.DefaultRowCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("<strong>Student Type</strong> : ");
            output.Write(m.MemberType.Name);
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.DefaultRowCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("<strong>Membership Date</strong> : ");
            output.Write(m.MemberSince.ToLongDateString());
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.DefaultRowCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("<strong>Active Membership</strong> : ");
            if (m.IsPrimaryOrgActive)
            {
                output.Write("Yes");
            }
            else
            {
                output.Write("No");
            }
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.DefaultRowCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("<strong>Rank</strong> : ");
            output.Write(m.Rank.Name);
            output.Write(" (" + m.RankDate.ToShortDateString() + ")");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            #endregion

            #region Attendance Information

            // Pull last 90 days of attendance from the database

            int      maxEntries     = 150;
            int      displayEntries = 5;
            DateTime minSearchDate  = DateTime.Now.Subtract(TimeSpan.FromDays(90));

            DojoAttendanceEntryManager    aem        = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection attendance =
                aem.GetCollection(maxEntries, "MemberID=" + m.ID.ToString() +
                                  " AND ClassStart>=#" + minSearchDate.ToString() + "#", "ClassStart DESC",
                                  DojoAttendanceEntryFlags.Class);

            DojoMember instructor1 = m.Instructor1;
            DojoMember instructor2 = m.Instructor2;
            DojoMember instructor3 = m.Instructor3;

            if (attendance.Count < displayEntries)
            {
                displayEntries = attendance.Count;
            }

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.SubHeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Attendance");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.DefaultRowCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("<strong>Time In Membership</strong> : ");
            output.Write(m.TimeInMembership.TotalHours.ToString("f") + " Hours");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.DefaultRowCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("<strong>Time In Rank</strong> : ");
            output.Write(m.TimeInRank.TotalHours.ToString("f") + " Hours");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.DefaultRowCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("<strong>Last Signin</strong> : ");
            output.Write(m.LastSignin.ToLongDateString());
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            // Top Instructor
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.SubHeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Ninety Day Instructors");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            if (instructor1 != null)
            {
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", grid.DefaultRowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(instructor1.PrivateContact.FullName);
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
            }
            else
            {
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", grid.DefaultRowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("None");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
            }

            if (instructor2 != null)
            {
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", grid.DefaultRowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(instructor2.PrivateContact.FullName);
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
            }

            if (instructor3 != null)
            {
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", grid.DefaultRowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(instructor3.PrivateContact.FullName);
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
            }

            // Display Last 5 Classes
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", grid.SubHeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Ninety Day Activity");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            if (displayEntries == 0)
            {
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", grid.DefaultRowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("None");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
            }
            else
            {
                for (int x = 0; x < displayEntries; x++)
                {
                    DojoAttendanceEntry entry = attendance[x];

                    output.WriteFullBeginTag("tr");
                    output.WriteBeginTag("td");
                    output.WriteAttribute("class", grid.DefaultRowCssClass);
                    output.Write(HtmlTextWriter.TagRightChar);
                    output.Write(entry.Class.Name +
                                 " - " +
                                 entry.Class.ClassStart.ToString("dddd, MMMM d - h:mm tt"));
                    output.WriteEndTag("td");
                    output.WriteEndTag("tr");
                }
            }

            #endregion

            //			#region Instructor Information
            //
            //			if(m.IsInstructor)
            //			{
            //				output.WriteFullBeginTag("tr");
            //				output.WriteBeginTag("td");
            //				output.WriteAttribute("class", grid.SubHeaderCssClass);
            //				output.Write(HtmlTextWriter.TagRightChar);
            //				output.Write("Instructor Details");
            //				output.WriteEndTag("td");
            //				output.WriteEndTag("tr");
            //			}
            //
            //			#endregion

            #region Security

            if (this.ParentWindow.Page.User.IsInRole("Tessen/Administrator"))
            {
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", grid.SubHeaderCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("Security");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");

                if (m.UserAccount == null)
                {
                    output.WriteFullBeginTag("tr");
                    output.WriteBeginTag("td");
                    output.WriteAttribute("class", grid.DefaultRowCssClass);
                    output.Write(HtmlTextWriter.TagRightChar);
                    output.Write("The member has no associated user account.");
                    output.WriteEndTag("td");
                    output.WriteEndTag("tr");
                }
                else
                {
                    output.WriteFullBeginTag("tr");
                    output.WriteBeginTag("td");
                    output.WriteAttribute("class", grid.DefaultRowCssClass);
                    output.Write(HtmlTextWriter.TagRightChar);
                    output.Write("<strong>Username</strong> : ");
                    output.Write(m.UserAccount.UserName);
                    output.Write("<br />");
                    output.Write("<strong>Last Access</strong> : ");
                    if (m.UserAccount.LoginDate != DateTime.MinValue)
                    {
                        output.Write(m.UserAccount.LoginDate);
                    }
                    else
                    {
                        output.Write("None");
                    }
                    output.Write("<br />");
                    output.Write("<strong>Login Count</strong> : ");
                    output.Write(m.UserAccount.LoginCount);
                    output.WriteEndTag("td");
                    output.WriteEndTag("tr");
                }
            }

            #endregion

            #region Memos

            if (this.ParentWindow.Page.User.IsInRole("Tessen/Administrator"))
            {
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", grid.SubHeaderCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("Current Attendance Message");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");

                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", grid.DefaultRowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                if (m.AttendanceMessage != "")
                {
                    output.Write(m.AttendanceMessage);
                }
                else
                {
                    output.Write("Empty");
                }
                output.WriteEndTag("td");
                output.WriteEndTag("tr");

                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", grid.SubHeaderCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("Memo");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");

                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", grid.DefaultRowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                if (m.PrivateContact.MemoText != "")
                {
                    output.Write(m.PrivateContact.MemoText.Replace("\n", "<br>"));
                }
                else
                {
                    output.Write("Empty");
                }
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
            }

            #endregion

            output.WriteEndTag("table");
        }
        private void bindDropDownLists()
        {
            #region Bind Allowed Child Data

            msAllowedMemberType1.Items.Add(new ListItem("Null", "Null"));
            DojoAttendanceEntryManager    allowedMemberType1Manager    = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection allowedMemberType1Collection = allowedMemberType1Manager.GetCollection(string.Empty, string.Empty, null);
            foreach (DojoAttendanceEntry allowedMemberType1 in allowedMemberType1Collection)
            {
                ListItem i = new ListItem(allowedMemberType1.ToString(), allowedMemberType1.ID.ToString());
                msAllowedMemberType1.Items.Add(i);
            }

            msAllowedMemberType2.Items.Add(new ListItem("Null", "Null"));
            DojoAttendanceEntryManager    allowedMemberType2Manager    = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection allowedMemberType2Collection = allowedMemberType2Manager.GetCollection(string.Empty, string.Empty, null);
            foreach (DojoAttendanceEntry allowedMemberType2 in allowedMemberType2Collection)
            {
                ListItem i = new ListItem(allowedMemberType2.ToString(), allowedMemberType2.ID.ToString());
                msAllowedMemberType2.Items.Add(i);
            }

            msAllowedMemberType3.Items.Add(new ListItem("Null", "Null"));
            DojoAttendanceEntryManager    allowedMemberType3Manager    = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection allowedMemberType3Collection = allowedMemberType3Manager.GetCollection(string.Empty, string.Empty, null);
            foreach (DojoAttendanceEntry allowedMemberType3 in allowedMemberType3Collection)
            {
                ListItem i = new ListItem(allowedMemberType3.ToString(), allowedMemberType3.ID.ToString());
                msAllowedMemberType3.Items.Add(i);
            }

            msAllowedMemberType4.Items.Add(new ListItem("Null", "Null"));
            DojoAttendanceEntryManager    allowedMemberType4Manager    = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection allowedMemberType4Collection = allowedMemberType4Manager.GetCollection(string.Empty, string.Empty, null);
            foreach (DojoAttendanceEntry allowedMemberType4 in allowedMemberType4Collection)
            {
                ListItem i = new ListItem(allowedMemberType4.ToString(), allowedMemberType4.ID.ToString());
                msAllowedMemberType4.Items.Add(i);
            }

            msAllowedMemberType5.Items.Add(new ListItem("Null", "Null"));
            DojoAttendanceEntryManager    allowedMemberType5Manager    = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection allowedMemberType5Collection = allowedMemberType5Manager.GetCollection(string.Empty, string.Empty, null);
            foreach (DojoAttendanceEntry allowedMemberType5 in allowedMemberType5Collection)
            {
                ListItem i = new ListItem(allowedMemberType5.ToString(), allowedMemberType5.ID.ToString());
                msAllowedMemberType5.Items.Add(i);
            }

            #endregion

            #region Bind Denied Child Data

            msDeniedMemberType1.Items.Add(new ListItem("Null", "Null"));
            DojoAttendanceEntryManager    deniedMemberType1Manager    = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection deniedMemberType1Collection = deniedMemberType1Manager.GetCollection(string.Empty, string.Empty, null);
            foreach (DojoAttendanceEntry deniedMemberType1 in deniedMemberType1Collection)
            {
                ListItem i = new ListItem(deniedMemberType1.ToString(), deniedMemberType1.ID.ToString());
                msDeniedMemberType1.Items.Add(i);
            }

            msDeniedMemberType2.Items.Add(new ListItem("Null", "Null"));
            DojoAttendanceEntryManager    deniedMemberType2Manager    = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection deniedMemberType2Collection = deniedMemberType2Manager.GetCollection(string.Empty, string.Empty, null);
            foreach (DojoAttendanceEntry deniedMemberType2 in deniedMemberType2Collection)
            {
                ListItem i = new ListItem(deniedMemberType2.ToString(), deniedMemberType2.ID.ToString());
                msDeniedMemberType2.Items.Add(i);
            }

            msDeniedMemberType3.Items.Add(new ListItem("Null", "Null"));
            DojoAttendanceEntryManager    deniedMemberType3Manager    = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection deniedMemberType3Collection = deniedMemberType3Manager.GetCollection(string.Empty, string.Empty, null);
            foreach (DojoAttendanceEntry deniedMemberType3 in deniedMemberType3Collection)
            {
                ListItem i = new ListItem(deniedMemberType3.ToString(), deniedMemberType3.ID.ToString());
                msDeniedMemberType3.Items.Add(i);
            }

            msDeniedMemberType4.Items.Add(new ListItem("Null", "Null"));
            DojoAttendanceEntryManager    deniedMemberType4Manager    = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection deniedMemberType4Collection = deniedMemberType4Manager.GetCollection(string.Empty, string.Empty, null);
            foreach (DojoAttendanceEntry deniedMemberType4 in deniedMemberType4Collection)
            {
                ListItem i = new ListItem(deniedMemberType4.ToString(), deniedMemberType4.ID.ToString());
                msDeniedMemberType4.Items.Add(i);
            }

            msDeniedMemberType5.Items.Add(new ListItem("Null", "Null"));
            DojoAttendanceEntryManager    deniedMemberType5Manager    = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection deniedMemberType5Collection = deniedMemberType5Manager.GetCollection(string.Empty, string.Empty, null);
            foreach (DojoAttendanceEntry deniedMemberType5 in deniedMemberType5Collection)
            {
                ListItem i = new ListItem(deniedMemberType5.ToString(), deniedMemberType5.ID.ToString());
                msDeniedMemberType5.Items.Add(i);
            }

            #endregion
        }
Beispiel #7
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)
        {
            IFormatProvider enFormat = new System.Globalization.CultureInfo("en-US", true);

            // Attendance Index
            int attendanceIndex      = 0;                               // The current attendance entry
            int attendanceIndexMonth = 0;                               // The current attendance entry at beginning of month
            int classIndex           = 0;                               // The current class
            int classIndexMonth      = 0;                               // The current class at beginning of month
            int year = DateTime.Now.Year;                               // This year in an integer

            // Classes
            DojoAttendanceEntryCollection attendance = null;
            DojoClassCollection           classes    = null;

            // Start card at beginning of year
            DateTime startDate = DateTime.Parse("1/1/" + year.ToString(), enFormat);

            // Start times for classes every day
            DateTime testDateLow  = startDate;
            DateTime testDateHigh = startDate;

            string[]   startStrings   = __classTimes.Split('|');
            DateTime[] startTimes     = new DateTime[startStrings.Length];
            TimeSpan[] startSpansBack = new TimeSpan[startStrings.Length];
            TimeSpan[] startSpansFor  = new TimeSpan[startStrings.Length];

            // Parse class string
            for (int i = 0; i < startTimes.Length; i++)
            {
                string[] temp = startStrings[i].Split(',');
                startTimes[i] = DateTime.Parse(temp[0]);

                // initialize start spans
                if (temp.Length > 2)
                {
                    startSpansFor[i]  = TimeSpan.FromMinutes(double.Parse(temp[1]));
                    startSpansBack[i] = TimeSpan.FromMinutes(double.Parse(temp[2]));
                }
                else if (temp.Length > 1)
                {
                    startSpansFor[i]  = TimeSpan.FromMinutes(double.Parse(temp[1]));
                    startSpansBack[i] = TimeSpan.Zero;
                }
                else
                {
                    startSpansFor[i]  = TimeSpan.Zero;
                    startSpansBack[i] = TimeSpan.Zero;
                }
            }

            // Load member
            DojoMember m = new DojoMember(__memberID);

            // Load member's attendance
            DojoAttendanceEntryManager aem = new DojoAttendanceEntryManager();

            attendance = aem.GetCollection("MemberID=" + __memberID +
                                           " AND ClassStart>#1/1/" + year.ToString() + "#" +
                                           " AND ClassStart<#1/1/" + (year + 1).ToString() + "#", "ClassStart", DojoAttendanceEntryFlags.Class);

            if (__fillBlanks)
            {
                // Load classes
                DojoClassManager cm = new DojoClassManager();
                classes = cm.GetCollection("ClassStart>#1/1/" + year.ToString() + "#" +
                                           " AND ClassStart<#1/1/" + (year + 1).ToString() + "#", "ClassStart", null);
            }

            // If there is no attendance, display no attendance error
            if (attendance.Count == 0)
            {
                output.WriteFullBeginTag("tr");
                output.WriteFullBeginTag("td");
                output.Write("No Attendance");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
                output.WriteLine();
                return;
            }

            #region Classes From January to December

            for (int month = 1; month <= 12; month++)
            {
                output.WriteFullBeginTag("tr");

                // Class Column
                output.WriteBeginTag("td");
                if (this.SubHeaderCssClass != string.Empty)
                {
                    output.WriteAttribute("class", this.SubHeaderCssClass);
                }
                if (this.__dateCellWidth != Unit.Empty)
                {
                    output.WriteAttribute("width", this.__dateCellWidth.ToString());
                }
                if (this.__dateCellHeight != Unit.Empty)
                {
                    output.WriteAttribute("height", this.__dateCellHeight.ToString());
                }
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(DateTime.Parse(month.ToString() + "/1/2005", enFormat).ToString("MMMM"));
                output.WriteEndTag("td");

                // Days Columns
                for (int day = 1; day <= 31; day++)
                {
                    if (day > DateTime.DaysInMonth(year, month))
                    {
                        output.WriteBeginTag("td");
                        if (this.SubHeaderCssClass != string.Empty)
                        {
                            output.WriteAttribute("class", this.SubHeaderCssClass);
                        }
                        if (this.__dateCellWidth != Unit.Empty)
                        {
                            output.WriteAttribute("width", this.__dateCellWidth.ToString());
                        }
                        if (this.__dateCellHeight != Unit.Empty)
                        {
                            output.WriteAttribute("height", this.__dateCellHeight.ToString());
                        }
                        output.Write(HtmlTextWriter.TagRightChar);
                        output.Write("&nbsp;");
                        output.WriteEndTag("td");
                        continue;
                    }

                    output.WriteBeginTag("td");
                    if (this.SubHeaderCssClass != string.Empty)
                    {
                        output.WriteAttribute("class", this.SubHeaderCssClass);
                    }
                    if (this.__dateCellWidth != Unit.Empty)
                    {
                        output.WriteAttribute("width", this.__dateCellWidth.ToString());
                    }
                    if (this.__dateCellHeight != Unit.Empty)
                    {
                        output.WriteAttribute("height", this.__dateCellHeight.ToString());
                    }
                    output.Write(HtmlTextWriter.TagRightChar);
                    output.Write(day.ToString("##00"));
                    output.WriteEndTag("td");
                }

                output.WriteEndTag("tr");
                output.WriteLine();

                attendanceIndexMonth = attendanceIndex;
                classIndexMonth      = classIndex;

                // Class Column and Class Rows
                for (int iClass = 0; iClass < startTimes.Length; iClass++)
                {
                    attendanceIndex = attendanceIndexMonth;
                    classIndex      = classIndexMonth;

                    output.WriteFullBeginTag("tr");

                    // Class Title
                    output.WriteFullBeginTag("td");
                    output.Write(startTimes[iClass].ToString("hh:mm tt"));
                    output.WriteEndTag("td");

                    for (int day = 1; day <= 31; day++)
                    {
                        if (day > DateTime.DaysInMonth(year, month))
                        {
                            output.WriteBeginTag("td");
                            if (this.__blankCellCssClass != string.Empty)
                            {
                                output.WriteAttribute("class", this.__blankCellCssClass);
                            }
                            if (this.__dateCellWidth != Unit.Empty)
                            {
                                output.WriteAttribute("width", this.__dateCellWidth.ToString());
                            }
                            if (this.__dateCellHeight != Unit.Empty)
                            {
                                output.WriteAttribute("height", this.__dateCellHeight.ToString());
                            }
                            output.Write(HtmlTextWriter.TagRightChar);
                            output.Write("&nbsp;");
                            output.WriteEndTag("td");
                            continue;
                        }

                        testDateLow = DateTime.Parse(month.ToString() + "/" + day.ToString() + "/" + year.ToString() +
                                                     " " + startTimes[iClass].Hour.ToString("00") + ":" + startTimes[iClass].Minute.ToString("00"), enFormat);

                        testDateHigh = testDateLow.Add(startSpansFor[iClass]);                                          // set high test date
                        testDateLow  = testDateLow.Subtract(startSpansBack[iClass]);                                    // set low test date

                        // Make sure attendance examined is equal to or more than the test date
                        while (attendance[attendanceIndex].Class.ClassStart < testDateLow &&
                               attendanceIndex + 1 < attendance.Count)
                        {
                            attendanceIndex++;
                        }

                        // Make sure classes examined is equal to or more than the test date
                        while (classes[classIndex].ClassStart < testDateLow &&
                               classIndex + 1 < classes.Count)
                        {
                            classIndex++;
                        }

                        output.WriteBeginTag("td");
                        if (this.__fillBlanks && !dateCheck(classes[classIndex].ClassStart, testDateLow, testDateHigh) && this.__blankCellCssClass != string.Empty)
                        {
                            output.WriteAttribute("class", __blankCellCssClass);
                        }
                        else if (this.__fillBlanks && classes[classIndex].Instructor.ID == this.__memberID && this.__instructorCellCssClass != string.Empty)
                        {
                            output.WriteAttribute("class", __instructorCellCssClass);
                        }
                        else if (this.__fillBlanks && classes[classIndex].ParentSeminar != null && this.__seminarCellCssClass != string.Empty)
                        {
                            output.WriteAttribute("class", __seminarCellCssClass);
                        }
                        else if (this.__dateCellCssClass != string.Empty)
                        {
                            output.WriteAttribute("class", this.__dateCellCssClass);
                        }
                        if (this.__dateCellWidth != Unit.Empty)
                        {
                            output.WriteAttribute("width", this.__dateCellWidth.ToString());
                        }
                        if (this.__dateCellHeight != Unit.Empty)
                        {
                            output.WriteAttribute("height", this.__dateCellHeight.ToString());
                        }
                        output.Write(HtmlTextWriter.TagRightChar);

                        // Now that we have the record closest to the month and date
                        // check to see if it is on the month date and time of the start time,
                        // if it is, display a tick mark, if not an empty
                        if (dateCheck(attendance[attendanceIndex].Class.ClassStart, testDateLow, testDateHigh))
                        {
                            if (attendance[attendanceIndex].Class.Instructor.ID == this.__memberID)
                            {
                                output.Write("I");
                            }
                            else
                            {
                                output.Write("X");
                            }
                        }
                        else
                        {
                            output.Write("&nbsp;");
                        }

                        output.WriteEndTag("td");
                    }

                    output.WriteEndTag("tr");
                    output.WriteLine();
                }

                #endregion
            }

            #region Legend

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Legend");
            output.WriteEndTag("td");

            output.WriteBeginTag("td");
            if (this.__blankCellCssClass != string.Empty)
            {
                output.WriteAttribute("class", __blankCellCssClass);
            }
            output.WriteAttribute("colspan", "6");
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("No Class");
            output.WriteEndTag("td");

            output.WriteBeginTag("td");
            output.WriteAttribute("colspan", "6");
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Unattended");
            output.WriteEndTag("td");

            output.WriteBeginTag("td");
            output.WriteAttribute("colspan", "6");
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("X - Attended");
            output.WriteEndTag("td");

            output.WriteBeginTag("td");
            if (this.__instructorCellCssClass != string.Empty)
            {
                output.WriteAttribute("class", this.__instructorCellCssClass);
            }
            output.WriteAttribute("colspan", "6");
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("I - Instructed");
            output.WriteEndTag("td");

            output.WriteBeginTag("td");
            if (this.__seminarCellCssClass != string.Empty)
            {
                output.WriteAttribute("class", this.__seminarCellCssClass);
            }
            output.WriteAttribute("colspan", "7");
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Seminar");
            output.WriteEndTag("td");

            output.WriteEndTag("tr");

            #endregion
        }
Beispiel #8
0
        public void LoadDefaults()
        {
            DojoAccessControlGroupCollection accessControls;

            DojoAttendanceEntryCollection     attendanceEntries;
            DojoBulkAttendanceEntryCollection bulkAttendances;
            DojoClassCollection           classes;
            DojoClassDefinitionCollection classDefinitions;

            DojoMemberCollection             members;
            DojoMembershipCollection         memberships;
            DojoMembershipTemplateCollection membershipTemplates;
            DojoMemberTypeCollection         memberTypes;
            DojoMemberTypeTemplateCollection memberTypeTemplates;
            DojoOrganizationCollection       organizations;

            DojoPromotionCollection                promotions;
            DojoPromotionFlagCollection            promotionFlags;
            DojoPromotionStatusCollection          promotionStatuses;
            DojoRankCollection                     ranks;
            DojoTestCollection                     tests;
            DojoTestListCollection                 testLists;
            DojoTestListJournalEntryCollection     testListJournalEntries;
            DojoTestListJournalEntryTypeCollection testListJournalEntryTypes;
            DojoTestListStatusCollection           testListStatuses;

            DojoSeminarCollection                   seminars;
            DojoSeminarOptionCollection             seminarOptions;
            DojoSeminarRegistrationCollection       seminarRegistrations;
            DojoSeminarRegistrationOptionCollection seminarRegistrationOptions;

            GreyFoxContactCollection locations;

            accessControls = new DojoAccessControlGroupCollection();

            attendanceEntries = new DojoAttendanceEntryCollection();
            bulkAttendances   = new DojoBulkAttendanceEntryCollection();
            classes           = new DojoClassCollection();
            classDefinitions  = new DojoClassDefinitionCollection();

            members             = new DojoMemberCollection();
            memberships         = new DojoMembershipCollection();
            membershipTemplates = new DojoMembershipTemplateCollection();
            memberTypes         = new DojoMemberTypeCollection();
            memberTypeTemplates = new DojoMemberTypeTemplateCollection();
            organizations       = new DojoOrganizationCollection();

            promotions                = new DojoPromotionCollection();
            promotionFlags            = new DojoPromotionFlagCollection();
            promotionStatuses         = new DojoPromotionStatusCollection();
            ranks                     = new DojoRankCollection();
            tests                     = new DojoTestCollection();
            testLists                 = new DojoTestListCollection();
            testListJournalEntries    = new DojoTestListJournalEntryCollection();
            testListJournalEntryTypes = new DojoTestListJournalEntryTypeCollection();
            testListStatuses          = new DojoTestListStatusCollection();

            seminars                   = new DojoSeminarCollection();
            seminarOptions             = new DojoSeminarOptionCollection();
            seminarRegistrations       = new DojoSeminarRegistrationCollection();
            seminarRegistrationOptions = new DojoSeminarRegistrationOptionCollection();

            locations = new GreyFoxContactCollection();

            organizations       = new DojoOrganizationManager().GetCollection(string.Empty, string.Empty, null);
            memberTypes         = new DojoMemberTypeManager().GetCollection(string.Empty, string.Empty);
            memberTypeTemplates = new DojoMemberTypeTemplateManager().GetCollection(string.Empty, string.Empty, null);
            ranks = new DojoRankManager().GetCollection(string.Empty, string.Empty, null);
            membershipTemplates = new DojoMembershipTemplateManager().GetCollection(string.Empty, string.Empty, null);

            Dictionary <string, DojoMemberType> memberTypesDictionary =
                new Dictionary <string, DojoMemberType>();

            foreach (DojoMemberType memberType in memberTypes)
            {
                memberTypesDictionary.Add(memberType.Name, memberType);
            }
            Dictionary <string, DojoMemberTypeTemplate> memberTypeTemplatesDictionary =
                new Dictionary <string, DojoMemberTypeTemplate>();

            foreach (DojoMemberTypeTemplate typeTemplate in memberTypeTemplates)
            {
                memberTypeTemplatesDictionary.Add(typeTemplate.Name, typeTemplate);
            }
            Dictionary <string, DojoRank> ranksDictionary =
                new Dictionary <string, DojoRank>();

            foreach (DojoRank rank in ranks)
            {
                ranksDictionary.Add(rank.Name, rank);
            }
            Dictionary <string, DojoMembershipTemplate> membershipTemplatesDictionary =
                new Dictionary <string, DojoMembershipTemplate>();

            foreach (DojoMembershipTemplate template in membershipTemplates)
            {
                membershipTemplatesDictionary.Add(template.Name, template);
            }

            CsvParser.CsvStream csv =
                CsvParser.StreamParse(Localization.Defaults.Defaults_en_US, false);
            string rowType;

            string[] r = csv.GetNextRow();
            while (r != null)
            {
                rowType = r[0];

                if (rowType == Localization.Defaults.CSVMembershipTemplate)
                {
                    DojoMembershipTemplate template =
                        TessenFactory.MembershipTemplate(
                            r[1], r[2],
                            bool.Parse(r[3]), bool.Parse(r[4]), bool.Parse(r[5]),
                            decimal.Parse(r[6]), decimal.Parse(r[7]),
                            (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[8]),
                            (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[9]),
                            DojoOrganization.NewPlaceHolder(0),
                            1,
                            int.Parse(r[11]), int.Parse(r[12]), decimal.Parse(r[13]), (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[14]),
                            int.Parse(r[15]), int.Parse(r[16]), decimal.Parse(r[17]), (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[18]),
                            int.Parse(r[19]), int.Parse(r[20]), decimal.Parse(r[21]), (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[22]),
                            int.Parse(r[23]), int.Parse(r[24]),
                            int.Parse(r[25]), int.Parse(r[26]),
                            ranksDictionary.ContainsKey(r[27]) ? ranksDictionary[r[27]] : null,
                            ranksDictionary.ContainsKey(r[28]) ? ranksDictionary[r[28]] : null);
                    membershipTemplates.Add(template);
                    membershipTemplatesDictionary.Add(template.Name, template);
                    template.Save();
                }
                else if (rowType == Localization.Defaults.CSVMemberTypeTemplate)
                {
                    DojoMemberTypeTemplate template = TessenFactory.MemberTypeTemplate(
                        r[1], r[2],
                        memberTypeTemplatesDictionary.ContainsKey(r[3].ToString()) ? memberTypeTemplatesDictionary[r[3]] : null,
                        memberTypesDictionary.ContainsKey(r[4]) ? memberTypesDictionary[r[4]] : null,
                        bool.Parse(r[5]), bool.Parse(r[6]), bool.Parse(r[7]), bool.Parse(r[8]),
                        int.Parse(r[9]), int.Parse(r[10]),
                        int.Parse(r[11]), int.Parse(r[12]),
                        ranksDictionary.ContainsKey(r[13]) ? ranksDictionary[r[13]] : null,
                        ranksDictionary.ContainsKey(r[14]) ? ranksDictionary[r[14]] : null,
                        membershipTemplatesDictionary.ContainsKey(r[15]) ? membershipTemplatesDictionary[r[15]] : null,
                        membershipTemplatesDictionary.ContainsKey(r[16]) ? membershipTemplatesDictionary[r[16]] : null,
                        membershipTemplatesDictionary.ContainsKey(r[17]) ? membershipTemplatesDictionary[r[17]] : null,
                        membershipTemplatesDictionary.ContainsKey(r[18]) ? membershipTemplatesDictionary[r[18]] : null,
                        membershipTemplatesDictionary.ContainsKey(r[19]) ? membershipTemplatesDictionary[r[19]] : null);
                    memberTypeTemplates.Add(template);
                    memberTypeTemplatesDictionary.Add(template.Name, template);
                    template.Save();
                }

                r = csv.GetNextRow();
            }
        }
Beispiel #9
0
        private void saveAttendance()
        {
            DojoMember member;
            string     whereQuery;
            DojoAttendanceEntryManager    aManager;
            DojoAttendanceEntryCollection attendance;

            int[]             selectedClasses;
            string[]          ids;
            bool              removeEntry;
            bool              formChanged;
            AttendanceScanner aScanner;

            // Load Member and set LastSignIn to present time
            member            = new DojoMember(memberID);
            member.LastSignin = DateTime.Now;

            // Get classes on the attendance form.
            classIdArray = Context.Request.Form["___" + ClientID + "Classes"].Split(',');

            // Build query to get member's attendance for the classes on
            // the attendance form and get the memberTypeTemplates.
            whereQuery = "MemberID=" + member.iD;
            if (classIdArray.Length > 0)
            {
                whereQuery += " AND (";
                for (int x = 0; x < classIdArray.Length; x++)
                {
                    if (x == 0)
                    {
                        whereQuery += "ClassID=" + classIdArray[x] + " ";
                    }
                    else
                    {
                        whereQuery += "OR ClassID=" + classIdArray[x] + " ";
                    }
                }
                whereQuery += ") ";
            }
            aManager   = new DojoAttendanceEntryManager();
            attendance = aManager.GetCollection(whereQuery, string.Empty, null);

            // Load selected classes from form.
            if (Page.Request.Form[this.ClientID + "classoptions"] != null)
            {
                ids             = Page.Request.Form[this.ClientID + "classoptions"].Split(',');
                selectedClasses = new int[ids.Length];
                for (int x = 0; x < ids.Length; x++)
                {
                    selectedClasses[x] = int.Parse(ids[x]);
                }
            }
            else
            {
                // What the hell is this?
                selectedClasses = new int[0];
            }

            // Assume that the form has not been changed.
            formChanged = false;

            // Save newly checked classes.
            for (int x = 0; x < selectedClasses.Length; x++)
            {
                // Ignore classes already checked!
                foreach (DojoAttendanceEntry aEntry in attendance)
                {
                    if (selectedClasses[x] == aEntry.Class.iD)
                    {
                        goto NEXT_ENTRY;
                    }
                }

                DojoAttendanceEntry entry = new DojoAttendanceEntry();
                entry.Class      = DojoClass.NewPlaceHolder(selectedClasses[x]);
                entry.Member     = member;
                entry.Rank       = member.rank;
                entry.SigninTime = localTime;
                attendance.Add(entry);

                entry.Save();

                formChanged = true;

NEXT_ENTRY:
                continue;
            }

            // Delete unchecked classes.
            foreach (DojoAttendanceEntry aEntry in attendance)
            {
                removeEntry = true;
                for (int x = 0; x < selectedClasses.Length; x++)
                {
                    if (aEntry.Class.iD == selectedClasses[x])
                    {
                        removeEntry = false;
                    }
                }

                if (removeEntry)
                {
                    aEntry.Delete();
                    formChanged = true;
                }
            }

            // Run attendance scan if form has changed
            if (formChanged)
            {
                aScanner = new AttendanceScanner();
                aScanner.RunMemberAttendanceScan(member, TimeSpan.FromHours(1));
                member.Save();
            }
        }
        /// <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();

            DojoAttendanceEntryFlags[] options = new DojoAttendanceEntryFlags[]
            {
                DojoAttendanceEntryFlags.Class,
                DojoAttendanceEntryFlags.Member,
                DojoAttendanceEntryFlags.Rank,
                DojoAttendanceEntryFlags.MemberPrivateContact
            };

            DojoAttendanceEntryManager m = new DojoAttendanceEntryManager();

            StringBuilder whereQuery = new StringBuilder();

            if (ddMembers.SelectedItem.Value != "-1")
            {
                whereQuery.Append("MemberID=");
                whereQuery.Append(ddMembers.SelectedItem.Value);
            }

            if (ddClassDefinitions.SelectedItem.Value != "-1")
            {
                if (whereQuery.Length > 0)
                {
                    whereQuery.Append(" AND ");
                }

                if (ddClassDefinitions.SelectedItem.Value == "0")
                {
                    whereQuery.Append("ParentDefinitionID=null");
                }
                else
                {
                    whereQuery.Append("ParentDefinitionID=");
                    whereQuery.Append(ddClassDefinitions.SelectedItem.Value);
                }
            }

            if (ddInstructors.SelectedItem.Value != "-1")
            {
                if (whereQuery.Length > 0)
                {
                    whereQuery.Append(" AND ");
                }

                whereQuery.Append("kitTessen_Classes.InstructorID=");
                whereQuery.Append(ddInstructors.SelectedItem.Value);
            }

            switch (ddSearchMode.SelectedItem.Text)
            {
            case "Today":                                       // today
                if (whereQuery.Length > 0)
                {
                    whereQuery.Append(" AND ");
                }
                whereQuery.Append("(ClassStart>=#");
                whereQuery.Append(LocalTime.Date);
                whereQuery.Append("# AND ClassStart <#");
                whereQuery.Append(LocalTime.Date.AddDays(1));
                whereQuery.Append("#)");
                break;

            case "This Month":
                if (whereQuery.Length > 0)
                {
                    whereQuery.Append(" AND ");
                }
                whereQuery.Append("(ClassStart>=#");
                whereQuery.Append(DateManipulator.FirstOfMonth(LocalTime.Date));
                whereQuery.Append("# AND ClassStart <#");
                whereQuery.Append(DateManipulator.FirstOfMonth(LocalTime.Date).AddMonths(1));
                whereQuery.Append("#)");
                break;

            case "Last Month":
                if (whereQuery.Length > 0)
                {
                    whereQuery.Append(" AND ");
                }
                whereQuery.Append("(ClassStart>=#");
                whereQuery.Append(DateManipulator.SubtractMonths(LocalTime.Date, 1));
                whereQuery.Append("# AND ClassStart <#");
                whereQuery.Append(DateManipulator.FirstOfMonth(LocalTime.Date));
                whereQuery.Append("#)");
                break;

            case "This Week":
                if (whereQuery.Length > 0)
                {
                    whereQuery.Append(" AND ");
                }
                whereQuery.Append("(ClassStart>=#");
                whereQuery.Append(DateManipulator.FirstOfWeek(LocalTime.Date));
                whereQuery.Append("# AND ClassStart <#");
                whereQuery.Append(DateManipulator.LastOfWeek(LocalTime.Date).AddDays(1));
                whereQuery.Append("#)");
                break;

            case "Last Week":
                if (whereQuery.Length > 0)
                {
                    whereQuery.Append(" AND ");
                }
                whereQuery.Append("(ClassStart>=#");
                whereQuery.Append(DateManipulator.FirstOfWeek(LocalTime.Date).Subtract(TimeSpan.FromDays(7)));
                whereQuery.Append("# AND ClassStart <#");
                whereQuery.Append(DateManipulator.LastOfWeek(LocalTime.Date).Subtract(TimeSpan.FromDays(6)));
                whereQuery.Append("#)");
                break;
            }

            attendance =
                m.GetCollection(whereQuery.ToString(), "ClassStart DESC", options);

            switch (ddView.SelectedItem.Value)
            {
            case "default":
                RenderView(output, false);
                break;

            case "weekly":
                RenderView(output, true);
                break;

            case "weeklysummary":
                RenderWeeklySummary(output);
                break;
            }
        }
Beispiel #11
0
        private void Populate(string id)
        {
            DojoMember        m;
            string            validation;
            MembershipBuilder b;

            m = new DojoMember(int.Parse(id));

            // We're going to twist the membership builder to get what we want for faster
            // load times. So what we'll do is load the member into the Load Function
            // then we'll ask the membership builder for the member back. Pretty
            // nifty eh? Why? Because the membership builder loads the member's root
            // and children in one pass. :) :) :)
            b = new MembershipBuilder();
            b.Load(m);                     // MUAHAHAHA! FASTER! USES ROOT MEMBER!
            b.ProcessTrees();              // Required for memberships availability
            b.ProcessHashes();             // Required for memberships availability
            b.pullData(m);

            name.Text    = m.PrivateContact.FullName;
            address.Text = m.PrivateContact.ConstructAddress("<br />");
            validation   = m.PrivateContact.ValidationFlagsToString();
            if (validation.Length != 0)
            {
                address.Text += "<br /><em>" + validation;
            }

            if (m.Parent != null)
            {
                addRow(table, Localization.Strings.ParentMember + " : " + m.Parent.PrivateContact.FullName);
                if (m.Root != null & m.ID != m.Root.ID & m.Parent.ID != m.Root.ID)
                {
                    addRow(table, Localization.Strings.RootMember + " : " + m.Root.PrivateContact.FullName);
                }
            }
            else
            {
                if (m.Root != null & m.Root.ID != m.ID)
                {
                    addRow(table, Localization.Strings.RootMember + " : " + m.Root.PrivateContact.FullName);
                }
            }

            addRow(table, Localization.Strings.MemberType + " : " +
                   (m.MemberType != null ? m.MemberType.Name : Localization.Strings.IllegalValue));

            addRow(table, Localization.Strings.Rank + " : " +
                   string.Format(Localization.Strings.RankFormat,
                                 m.Rank != null ? m.Rank.Name : Localization.Strings.NoRankSpecified,
                                 m.TimeInRank.Hours));

            addRow(table, Localization.Strings.MemberSince + " : " +
                   string.Format(Localization.Strings.MemberSinceFormat,
                                 m.MemberSince, m.TimeInMembership.Hours));

            // ATTENDANCE =========================================================

            int      maxEntries     = 150;
            int      displayEntries = 5;
            DateTime minSearchDate  = DateTime.Now.Subtract(TimeSpan.FromDays(90));

            DojoAttendanceEntryManager    aem        = new DojoAttendanceEntryManager();
            DojoAttendanceEntryCollection attendance =
                aem.GetCollection(maxEntries, "MemberID=" + m.ID.ToString() +
                                  " AND ClassStart>=#" + minSearchDate.ToString() + "#", "ClassStart DESC",
                                  DojoAttendanceEntryFlags.Class);

            DojoMember instructor1 = m.Instructor1;
            DojoMember instructor2 = m.Instructor2;
            DojoMember instructor3 = m.Instructor3;

            if (attendance.Count < displayEntries)
            {
                displayEntries = attendance.Count;
            }

            addRow(table, Localization.Strings.LastSignin + " : " +
                   m.LastSignin.ToShortDateString());

            Table instructorTable = new Table();

            addCells(table, new LiteralControl(Localization.Strings.NinetyDayInstructors), instructorTable);
            if (instructor1 != null)
            {
                addRow(instructorTable, instructor1.PrivateContact.FullName);
            }
            if (instructor2 != null)
            {
                addRow(instructorTable, instructor2.PrivateContact.FullName);
            }
            if (instructor3 != null)
            {
                addRow(instructorTable, instructor3.PrivateContact.FullName);
            }

            Table attendanceTable = new Table();

            foreach (DojoAttendanceEntry a in attendance)
            {
                addRow(attendanceTable, a.Class.Name);
                addRow(attendanceTable, a.Class.ClassStart.ToString("dddd, MMMM d - h:mm tt"));
            }

            // MEMBERSHIPS ========================================================

            membershipsTable = new Table();
            addCells(table, new LiteralControl(Localization.Strings.MembershipsCurrent), membershipsTable);

            availableMembershipsTable = new Table();
            addCells(table, new LiteralControl(Localization.Strings.MembershipsAvailable), availableMembershipsTable);

            DojoMembershipCollection memberships = m.CollateMemberships();

            if (memberships.Count == 0)
            {
                addRow(membershipsTable, Localization.Strings.NoMemberships);
            }
            else
            {
                foreach (DojoMembership membership in memberships)
                {
                    addMembership(membership);
                }
            }

            List <MembershipPackage> packages = b.GetMembershipPackages(m);

            if (packages.Count == 0)
            {
                addRow(availableMembershipsTable, Localization.Strings.NoMemberships);
            }
            else
            {
                foreach (MembershipPackage package in packages)
                {
                    if (package.Memberships.Count == 0)
                    {
                        addRow(availableMembershipsTable, package.TypeTemplate.Name);
                        addRow(availableMembershipsTable, Localization.Strings.NoMemberships);
                    }
                    else
                    {
                        addRow(availableMembershipsTable, package.TypeTemplate.Name, package.TotalFee.ToString("c"));
                        foreach (DojoMembership membership in package.Memberships)
                        {
                            addRow(availableMembershipsTable, membership.MembershipTemplate.Name +
                                   (membership.PriorMembership == null ? " " + Localization.Strings.StartupMembershipAbbreviation : "") +
                                   (membership.IsProRated ? " " + Localization.Strings.ProrateMembershipAbbreviation : ""),
                                   membership.Fee.ToString("c"));
                            addRow(availableMembershipsTable,
                                   string.Format(Localization.Strings.MembershipDates,
                                                 membership.StartDate,
                                                 membership.EndDate), "&nbsp;");
                        }
                    }
                }
            }

            // SECURITY ===========================================================
        }