Exemplo n.º 1
0
 /// <summary>
 /// Gets the number of columns to show
 /// </summary>
 /// <param name="e"></param>
 internal void RaiseMultiCount(TeamViewCountEventArgs e)
 {
     if (MultiCount != null)
     {
         MultiCount(this, e);
     }
 }
Exemplo n.º 2
0
        private void RenderEmptyCells(HtmlTextWriter output)
        {
            for (DateTime time = GetEarliestStartTime(CurrentDate); time < GetLatestFinishTime(CurrentDate);)
            {
                // create a new row
                output.AddAttribute("Height", RowHeight.ToString());
                output.RenderBeginTag("tr");

                if (DiaryType == CalendarType.DayView)
                {
                    TeamViewCountEventArgs args = new TeamViewCountEventArgs(1);
                    RaiseMultiCount(args);

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

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

                        if (true) //appts.Options.AllowCreateAppointment(CurrentDate, t))
                        {
                            output.AddAttribute("class", "DiaryAppointmentFree");
                            output.AddAttribute("onclick", "javascript:" + Page.ClientScript.GetPostBackEventReference(this, String.Format("EC:{0} {1}", time.ToString("HH:mm"), i)));
                        }
                        //else
                        //{
                        //    output.AddAttribute("class", "DiaryNotWorking");
                        //}

                        output.AddStyleAttribute("width", String.Format("{0}px", ColumnWidth - 2));
                        output.AddStyleAttribute("height", String.Format("{0}px", RowHeight - 2));
                        output.RenderBeginTag("div");
                        output.RenderEndTag(); //div

                        output.RenderEndTag(); //td
                    }
                }
                else
                {
                    DateTime currentDate = CurrentDate;

                    for (int i = 1; i <= ColumnCount; i++)
                    {
                        output.AddAttribute("class", "DiaryEmpteCellTD");
                        output.AddStyleAttribute("width", String.Format("{0}px", ColumnWidth));
                        output.AddAttribute("colspan", "1");
                        output.RenderBeginTag("td");

                        if (true) //therapist != null && therapist.AllowCreateAppointment(currentDate, t))
                        {
                            output.AddAttribute("class", "DiaryAppointmentFree");
                            output.AddAttribute("onclick", "javascript:" + Page.ClientScript.GetPostBackEventReference(this, String.Format("WVEC:{0} {1}", currentDate.ToShortDateString(), time.ToString("HH:mm"))));
                        }
                        //else
                        //{
                        //    output.AddAttribute("class", "DiaryNotWorking");
                        //}

                        output.AddStyleAttribute("width", String.Format("{0}px", ColumnWidth - 2));
                        output.AddStyleAttribute("height", String.Format("{0}px", RowHeight - 2));
                        output.RenderBeginTag("div");
                        output.RenderEndTag(); //div

                        output.RenderEndTag(); //td

                        currentDate = currentDate.AddDays(1);
                    }
                }

                output.RenderEndTag(); // tr

                time = time.AddMinutes(15);
            }
        }
Exemplo n.º 3
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
        }
Exemplo n.º 4
0
        private void RenderHeader(HtmlTextWriter output)
        {
            output.AddAttribute("align", "left");
            output.AddAttribute("valign", "top");
            output.RenderBeginTag("td");

            output.AddAttribute("border", "0");
            output.AddAttribute("cellpadding", "0");
            output.AddAttribute("cellspacing", "0");
            output.AddAttribute("width", "100%");
            output.RenderBeginTag("table");

            if (DiaryType == CalendarType.WeekView)
            {
                RenderAppointmentsWeekView(output);
            }
            else
            {
                RenderAppointmentsDayView(output);
            }

            output.RenderBeginTag("tr");

            if (DiaryType == CalendarType.DayView)
            {
                TeamViewCountEventArgs args = new TeamViewCountEventArgs(1);
                RaiseMultiCount(args);

                // add a column for each staff member
                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.RenderBeginTag("td");

                    output.AddAttribute("class", "DiaryEmployeeNameSmall");
                    output.AddStyleAttribute("width", String.Format("{0}px", ColumnWidth));
                    output.AddStyleAttribute("height", String.Format("{0}px", RowHeight));
                    output.RenderBeginTag("div");

                    output.Write(headerArgs.HeaderText);
                    output.RenderEndTag(); //div

                    output.RenderEndTag(); //td
                }
            }
            else
            {   //weekview
                DateTime currentDate = CurrentDate;

                for (int i = 1; i <= ColumnCount; i++)
                {
                    output.AddStyleAttribute("width", String.Format("{0}px", ColumnWidth));
                    output.AddAttribute("colspan", "1");
                    output.RenderBeginTag("td");

                    output.AddAttribute("class", "DiaryEmployeeNameSmall");
                    output.AddStyleAttribute("width", String.Format("{0}px", ColumnWidth));
                    output.AddStyleAttribute("height", String.Format("{0}px", RowHeight));
                    output.RenderBeginTag("div");
                    output.Write(currentDate.ToShortDateString());
                    output.RenderEndTag(); //div

                    output.RenderEndTag(); //td

                    currentDate = currentDate.AddDays(1);
                }
            }

            output.RenderEndTag(); //tr

            RenderEmptyCells(output);

            output.RenderEndTag(); // table
            output.RenderEndTag(); // td
        }