Beispiel #1
0
 string GenLeftButtons(AjaxScheduleToolItemCollection tools)
 {
     StringBuilder builder = new StringBuilder();
     bool hasPos = false;
     foreach (AjaxScheduleToolItem item in tools)
     {
         if ((item.ButtonType == AjaxScheduleButtonType.PreviousYear
             || item.ButtonType == AjaxScheduleButtonType.Previous
             || item.ButtonType == AjaxScheduleButtonType.NextYear
             || item.ButtonType == AjaxScheduleButtonType.Next) && item.Visible)
         {
             if (!hasPos)
             {
                 builder.Append("left:'");
             }
             switch (item.ButtonType)
             {
                 case AjaxScheduleButtonType.PreviousYear:
                     builder.Append("prevYear ");
                     break;
                 case AjaxScheduleButtonType.Previous:
                     bool nextExist = false;
                     foreach (AjaxScheduleToolItem xItem in tools)
                     {
                         if (xItem.ButtonType == AjaxScheduleButtonType.Next)
                         {
                             nextExist = true;
                         }
                     }
                     if (nextExist)
                     {
                         builder.Append("prev,");
                     }
                     else
                     {
                         builder.Append("prev ");
                     }
                     break;
                 case AjaxScheduleButtonType.NextYear:
                     builder.Append("nextYear ");
                     break;
                 case AjaxScheduleButtonType.Next:
                     builder.Append("next ");
                     break;
                 case AjaxScheduleButtonType.Today:
                     builder.Append("today ");
                     break;
             }
             hasPos = true;
         }
     }
     if (builder.ToString().EndsWith(" "))
     {
         builder.Remove(builder.Length - 1, 1);
     }
     if (hasPos)
     {
         builder.Append("'");
     }
     return builder.ToString();
 }
Beispiel #2
0
 string GenRightButtons(AjaxScheduleToolItemCollection tools)
 {
     StringBuilder builder = new StringBuilder();
     bool hasPos = false;
     foreach (AjaxScheduleToolItem item in tools)
     {
         if ((item.ButtonType == AjaxScheduleButtonType.Month
             || item.ButtonType == AjaxScheduleButtonType.Week
             || item.ButtonType == AjaxScheduleButtonType.Day) && item.Visible)
         {
             if (!hasPos)
             {
                 builder.Append("right:'");
             }
             switch (item.ButtonType)
             {
                 case AjaxScheduleButtonType.Month:
                     builder.Append("month,");
                     break;
                 case AjaxScheduleButtonType.Week:
                     builder.Append("agendaWeek,");
                     break;
                 case AjaxScheduleButtonType.Day:
                     builder.Append("agendaDay,");
                     break;
             }
             hasPos = true;
         }
     }
     if (builder.ToString().EndsWith(","))
     {
         builder.Remove(builder.Length - 1, 1);
     }
     if (hasPos)
     {
         builder.Append("',");
     }
     return builder.ToString();
 }
Beispiel #3
0
 string GenButtonText(AjaxScheduleToolItemCollection tools)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("{");
     foreach (AjaxScheduleToolItem item in tools)
     {
         if (item.Visible)
         {
             switch (item.ButtonType)
             {
                 case AjaxScheduleButtonType.PreviousYear:
                     builder.AppendFormat("prevYear:'{0}',", item.ButtonText);
                     break;
                 case AjaxScheduleButtonType.Previous:
                     builder.AppendFormat("prev:'{0}',", item.ButtonText);
                     break;
                 case AjaxScheduleButtonType.NextYear:
                     builder.AppendFormat("nextYear:'{0}',", item.ButtonText);
                     break;
                 case AjaxScheduleButtonType.Next:
                     builder.AppendFormat("next:'{0}',", item.ButtonText);
                     break;
                 case AjaxScheduleButtonType.Today:
                     builder.AppendFormat("today:'{0}',", item.ButtonText);
                     break;
                 case AjaxScheduleButtonType.Month:
                     builder.AppendFormat("month:'{0}',", item.ButtonText);
                     break;
                 case AjaxScheduleButtonType.Week:
                     builder.AppendFormat("week:'{0}',", item.ButtonText);
                     break;
                 case AjaxScheduleButtonType.Day:
                     builder.AppendFormat("day:'{0}',", item.ButtonText);
                     break;
             }
         }
     }
     if (builder.ToString().EndsWith(","))
     {
         builder.Remove(builder.Length - 1, 1);
     }
     builder.Append("}");
     return builder.ToString();
 }