Пример #1
0
 protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
 {
     if (e.Id == "0")
     {
         e.BackgroundColor = "Khaki";
         e.BorderColor     = "silver";
     }
 }
Пример #2
0
        private BeforeEventRenderArgs DoBeforeEventRender(Event e)
        {
            BeforeEventRenderArgs ea = new BeforeEventRenderArgs(e);

            ea.ToolTip = Utils.Encoder.HtmlEncode(ea.Text);
            ea.Html    = Utils.Encoder.HtmlEncode(ea.Text);

            OnBeforeEventRender(ea);

            return(ea);
        }
Пример #3
0
        //This method is for the day/week view. It assigns a colour to each bubble
        public void BeforeCellRender(BeforeEventRenderArgs e)
        {
            var source = e.DataItem.Source as DayPilotTimeslotInfo;
            if (source == null)
            {
                return;
            }
            Color color = GetRandomPastelColour(source.GroupingID);

            const string cssColourString = "#{0}{1}{2}";
            e.BackgroundColor = String.Format(cssColourString, color.R.ToString("X2"), color.G.ToString("X2"), color.B.ToString("X2"));
        }
Пример #4
0
 protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
 {
     if (Id == "dpc_customization")
     {
         // alternating color
         int      colorIndex   = i % 4;
         string[] backColors   = { "#FFE599", "#9FC5E8", "#B6D7A8", "#EA9999" };
         string[] borderColors = { "#F1C232", "#3D85C6", "#6AA84F", "#CC0000" };
         e.BackgroundColor = backColors[colorIndex];
         e.BorderColor     = borderColors[colorIndex];
         i++;
     }
 }
Пример #5
0
 protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
 {
     if (e.Recurrent)
     {
         if (e.RecurrentException)
         {
             e.Areas.Add(new Area().Right(5).Top(5).CssClass("area_recurring_ex"));
         }
         else
         {
             e.Areas.Add(new Area().Right(5).Top(5).CssClass("area_recurring"));
         }
     }
 }
Пример #6
0
            //private int i = 0;
            protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
            {
                //if (Id == "dpc_customization")
                //{
                //    // alternating color
                //    int colorIndex = i % 4;
                //    string[] backColors = { "#FFE599", "#9FC5E8", "#B6D7A8", "#EA9999" };
                //    string[] borderColors = { "#F1C232", "#3D85C6", "#6AA84F", "#CC0000" };
                //    e.BackgroundColor = backColors[colorIndex];
                //    e.BorderColor = borderColors[colorIndex];
                //    i++;
                //}

                e.Html = "<strong>" + e.Text + "</strong>" + "<br>Teacher: " + e.DataItem["TeacherName"] + "<br>Room: " + e.DataItem["RoomNumber"];
            }
Пример #7
0
        internal Hashtable GetEventMap(Event e)
        {
            //BeforeEventRenderArgs eva = GetEva(e);

            BeforeEventRenderArgs eva = DoBeforeEventRender(e);

            Hashtable se = new Hashtable();

            se["id"]    = e.Id;
            se["text"]  = e.Text;
            se["start"] = e.Start.ToString("s");
            se["end"]   = e.End.ToString("s");

            if (eva.Html != e.Text)
            {
                se["html"] = eva.Html;
            }
            if (eva.ToolTip != e.Text)
            {
                se["toolTip"] = eva.ToolTip;
            }
            if (!String.IsNullOrEmpty(eva.BackgroundColor))
            {
                se["backColor"] = eva.BackgroundColor;
            }
            if (!String.IsNullOrEmpty(eva.DurationBarColor))
            {
                se["barColor"] = eva.DurationBarColor;
            }
            if (!String.IsNullOrEmpty(eva.BorderColor))
            {
                se["borderColor"] = eva.BorderColor;
            }
            if (!String.IsNullOrEmpty(eva.FontColor))
            {
                se["fontColor"] = eva.FontColor;
            }
            if (!String.IsNullOrEmpty(eva.CssClass))
            {
                se["cssClass"] = eva.CssClass;
            }

            return(se);
        }
            /// <summary>
            ///     Method that sets the colours of the class events on the calendar.
            /// </summary>
            /// <remarks>
            ///     Set the font colour to black.
            ///     Check the current user's class level.
            ///     If a class level is equal to the user's level, colour the event red to denote available.
            ///     Else, colour the event gray to denote not available.
            ///     However, if the user's class level is set to Open, then colour each class to be displayed depending on their level.
            /// </remarks>
            /// <param name="e">The incoming event data</param>
            protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
            {
                e.FontColor = "black";

                string userLevel = _db.Users.Single(u => u.UserName
                                                    .Equals(System.Web.HttpContext.Current.User.Identity.Name)).ClassLevel.ToString();

                string classlevel = e.DataItem["ClassLevel"].ToString();

                if (!userLevel.Equals("Open"))
                {
                    e.BackgroundColor = classlevel.Equals(userLevel) ? "red" : "grey";
                }
                else
                {
                    if (classlevel.Equals("Beginner"))
                    {
                        e.BackgroundColor = "red";
                    }
                    else if (classlevel.Equals("Intermediate"))
                    {
                        e.BackgroundColor = "yellow";
                    }
                    else if (classlevel.Equals("Advanced"))
                    {
                        e.BackgroundColor = "green";
                    }
                    else if (classlevel.Equals("Womens"))
                    {
                        e.BackgroundColor = "pink";
                    }
                    else if (classlevel.Equals("Private"))
                    {
                        e.BackgroundColor = "black";
                        e.FontColor       = "white";
                    }
                }

                base.OnBeforeEventRender(e);
            }
Пример #9
0
            protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
            {
                e.Html = String.Format("{0} ({1:d} - {2:d})", e.Text, e.Start, e.End);
                int status = Convert.ToInt32(e.Tag["ReservationStatus"]);

                switch (status)
                {
                case 0:                                      // new
                    if (e.Start < DateTime.Today.AddDays(2)) // must be confirmed two day in advance
                    {
                        e.DurationBarColor = "red";
                        e.ToolTip          = "Expired (not confirmed in time)";
                    }
                    else
                    {
                        e.DurationBarColor = "orange";
                        e.ToolTip          = "New";
                    }
                    break;

                case 1:                                                                                               // confirmed
                    if (e.Start < DateTime.Today || (e.Start == DateTime.Today && DateTime.Now.TimeOfDay.Hours > 18)) // must arrive before 6 pm
                    {
                        e.DurationBarColor = "#f41616";                                                               // red
                        e.ToolTip          = "Late arrival";
                    }
                    else
                    {
                        e.DurationBarColor = "green";
                        e.ToolTip          = "Confirmed";
                    }
                    break;

                case 2:                                                                                           // arrived
                    if (e.End < DateTime.Today || (e.End == DateTime.Today && DateTime.Now.TimeOfDay.Hours > 11)) // must checkout before 10 am
                    {
                        e.DurationBarColor = "#f41616";                                                           // red
                        e.ToolTip          = "Late checkout";
                    }
                    else
                    {
                        e.DurationBarColor = "#1691f4";      // blue
                        e.ToolTip          = "Arrived";
                    }
                    break;

                case 3:     // checked out
                    e.DurationBarColor = "gray";
                    e.ToolTip          = "Checked out";
                    break;

                default:
                    throw new ArgumentException("Unexpected status.");
                }

                e.Html = e.Html + String.Format("<br /><span style='color:gray'>{0}</span>", e.ToolTip);


                int    paid      = Convert.ToInt32(e.DataItem["ReservationPaid"]);
                string paidColor = "#aaaaaa";

                e.Areas.Add(new Area().Bottom(10).Right(4).Html("<div style='color:" + paidColor + "; font-size: 8pt;'>Paid: " + paid + "%</div>").Visible());
                e.Areas.Add(new Area().Left(4).Bottom(8).Right(4).Height(2).Html("<div style='background-color:" + paidColor + "; height: 100%; width:" + paid + "%'></div>").Visible());
            }
Пример #10
0
 /// <summary>
 /// An event handler that allows event customization. Called once for each event in the Events collection.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnBeforeEventRender(BeforeEventRenderArgs e)
 {
 }
            protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
            {
                e.Html = String.Format("{0} ({1:d} - {2:d})", e.Text, e.Start, e.End);
                int status = Convert.ToInt32(e.Tag["ReservationStatus"]);

                switch (status)
                {
                    case 0: // new
                        if (e.Start < DateTime.Today.AddDays(2)) // must be confirmed two day in advance
                        {
                            e.DurationBarColor = "red";
                            e.ToolTip = "Expired (not confirmed in time)";
                        }
                        else
                        {
                            e.DurationBarColor = "orange";
                            e.ToolTip = "New";
                        }
                        break;
                    case 1:  // confirmed
                        if (e.Start < DateTime.Today || (e.Start == DateTime.Today && DateTime.Now.TimeOfDay.Hours > 18))  // must arrive before 6 pm
                        {
                            e.DurationBarColor = "#f41616";  // red
                            e.ToolTip = "Late arrival";
                        }
                        else
                        {
                            e.DurationBarColor = "green";
                            e.ToolTip = "Confirmed";
                        }
                        break;
                    case 2: // arrived
                        if (e.End < DateTime.Today || (e.End == DateTime.Today && DateTime.Now.TimeOfDay.Hours > 11))  // must checkout before 10 am
                        {
                            e.DurationBarColor = "#f41616"; // red
                            e.ToolTip = "Late checkout";
                        }
                        else
                        {
                            e.DurationBarColor = "#1691f4";  // blue
                            e.ToolTip = "Arrived";
                        }
                        break;
                    case 3: // checked out
                        e.DurationBarColor = "gray";
                        e.ToolTip = "Checked out";
                        break;
                    default:
                        throw new ArgumentException("Unexpected status.");
                }

                e.Html = e.Html + String.Format("<br /><span style='color:gray'>{0}</span>", e.ToolTip);
                int paid = 0;
                if (e.DataItem["ReservationPaid"] != DBNull.Value)
                {
                    paid = Convert.ToInt32(e.DataItem["ReservationPaid"]);
                }

                string paidColor = "#aaaaaa";

                e.Areas.Add(new Area().Bottom(10).Right(4).Html("<div style='color:" + paidColor + "; font-size: 8pt;'>Paid: " + paid + "%</div>").Visible());
                e.Areas.Add(new Area().Left(4).Bottom(8).Right(4).Height(2).Html("<div style='background-color:" + paidColor + "; height: 100%; width:" + paid + "%'></div>").Visible());
            }
Пример #12
0
 protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
 {
     e.Html = (e.End - e.Start).ToString("hh\\:mm") + " - " + e.Text;
 }
Пример #13
0
 protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
 {
     base.OnBeforeEventRender(e);
     e.BackgroundColor = UserNameToColor(e.DataItem["UserName"].ToString());
     e.FontColor       = ContrastColor(e.BackgroundColor);
 }
Пример #14
0
        //public ActionResult GetEvents()
        //{
        //    var rawData  = _provider.LoadData();
            
        //    var returnData = rawData.Select(d => new
        //    {
        //        d.StartDate,
        //        d.EndDate,
        //    });

        //} 

        protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
        {
            _provider.BeforeCellRender(e);
            base.OnBeforeEventRender(e);
        }
Пример #15
0
 protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
 {
     e.Areas.Add(new Area().Right(3).Top(3).Width(15).Height(15).CssClass("event_action_delete").JavaScript("switcher.active.control.commandCallBack('delete', {'e': e});"));
 }