Exemple #1
0
        private void RenderAppointmentsDayView(HtmlTextWriter output)
        {
            DateTime firstTimeSlot = GetEarliestStartTime(CurrentDate);

            output.AddAttribute("height", "1px");
            output.RenderBeginTag("tr");

            TeamViewCountEventArgs args = new TeamViewCountEventArgs(1);

            RaiseMultiCount(args);

            // add a column for each person
            for (int i = 0; i < args.Count; i++)
            {
                TeamViewGetEventArgs headerArgs = new TeamViewGetEventArgs(i);
                RaiseMultiCountHeader(headerArgs);

                output.AddStyleAttribute("width", String.Format("{0}px", ColumnWidth));
                output.AddAttribute("colspan", "1");
                output.AddAttribute("style", "height: 0px;");
                output.AddAttribute("class", "DiaryAppointmentBlock");
                output.RenderBeginTag("td");

                AppointmentList appointments = new AppointmentList();
                DoGetAppointments(i, appointments);

                // add appointments here
                foreach (Appointment appt in appointments)
                {
                    TimeSpan duration = appt.EndDate - appt.StartDate;

                    //div wrapper
                    int divHeight = ((int)duration.TotalMinutes * RowHeight) + 3;

                    TimeSpan spanTop      = appt.StartDate - firstTimeSlot;
                    double   divTop       = (((spanTop.TotalMinutes / 15) * RowHeight) + 1) + RowHeight; // remember header
                    int      apptsStacked = _appointments.AppointmentsClash(appt);
                    int      divLeft      = 0;

                    if (appt.Column > 0)
                    {
                        divLeft = ((ColumnWidth / apptsStacked) * (appt.Column)) + 2;
                        output.AddAttribute("style", String.Format("width:{0}px; height:0px;", (int)(ColumnWidth / apptsStacked) - 4));
                    }
                    else
                    {
                        output.AddAttribute("style", String.Format("width:{0}px; height:0px;", (int)(ColumnWidth / apptsStacked) - 2));
                    }

                    output.AddAttribute("class", "DiaryEntryWrapper");
                    output.RenderBeginTag("div");

                    // mouse div
                    output.AddAttribute("onselectstart", "return false;");
                    output.AddAttribute("onclick", String.Format("javascript:event.cancelBubble=true;{0}", Page.ClientScript.GetPostBackEventReference(this, "APPT:" + appt.ID.ToString())));
                    output.AddAttribute("style", String.Format("cursor:pointer;-moz-user-select:none;-khtml-user-select:none;user-select:none;position:absolute;top:{0}px;height:{1}px;left:{2}px", divTop, divHeight, divLeft));
                    output.RenderBeginTag("div");

                    //mouse over dive
                    output.AddAttribute("onmouseover", "this.style.backgroundColor=&#39;#DCDCDC&#39;;event.cancelBubble=true;");
                    output.AddAttribute("onmouseout", "this.style.backgroundColor=&#39;#FFFFFF&#39;;event.cancelBubble=true;");
                    output.AddAttribute("title", "Appointment: " + appt.ID.ToString());
                    output.AddAttribute("style", String.Format("display:block;height:{0}px;overflow:hidden;", divHeight));
                    output.RenderBeginTag("div");

                    //output.AddAttribute("class", String.Format("{0} DiaryAppointment", apptStyle));
                    output.AddAttribute("style", String.Format("width:{0}px; height:{1}px;", (int)(ColumnWidth / apptsStacked) - 4, divHeight - 4));
                    output.AddAttribute("left", String.Format("{0}px", (ColumnWidth / apptsStacked) * appt.Column));
                    output.AddAttribute("class", "DiaryAppointment " + DoGetAppointmentClass(appt));
                    output.RenderBeginTag("div");
                    output.Write(AppointmentTextFull(appt));
                    output.RenderEndTag(); //div

                    output.RenderEndTag(); // mouse over dive
                    output.RenderEndTag(); // mouse div
                    output.RenderEndTag(); // div wrapper
                }

                output.RenderEndTag();//td
            }

            output.RenderEndTag(); //tr
        }