Пример #1
0
 protected virtual List<string> _GetSettings()
 {
     List<string> stringList = new List<string>();
     if (!this.DaySet && !this.FullWeek)
     {
         stringList.Add("start_date:" + DateFormatHelper.DateToJS(this.StartDate, true));
         if (this.EndDate != new DateTime())
             stringList.Add("end_date:" + DateFormatHelper.DateToJS(this.EndDate, true));
     }
     if (!string.IsNullOrEmpty(this.HTML))
         stringList.Add(string.Format("html:\"{0}\"", (object)this.HTML.Replace("\"", "\\\"")));
     if (this.FullWeek)
         stringList.Add("days:\"fullweek\"");
     else if (this.DaySet)
         stringList.Add(string.Format("days:{0}", (object)this.Day));
     if (this.Sections.Count > 0)
         stringList.Add(string.Format("sections:{{{0}}}", (object)string.Join(",", this.Sections.Select<Section, string>((Func<Section, string>)(s => s.ToString())).ToArray<string>())));
     if (this.Zones.Count > 0 && !this.FullDay)
         stringList.Add(string.Format("zones:[{0}]", (object)string.Join(",", this.Zones.Select<Zone, string>((Func<Zone, string>)(z => z.ToString())).ToArray<string>())));
     else if (this.EndDate == new DateTime())
         stringList.Add("zones:\"fullday\"");
     return stringList;
 }
Пример #2
0
        public override string Render()
        {
            if (this.Value == null || this.Field == null)
            {
                return(this._Default);
            }
            string str1;

            switch (this.Operator)
            {
            case Operator.Equals:
                str1 = "==";
                break;

            case Operator.NotEquals:
                str1 = "!=";
                break;

            case Operator.Identical:
                str1 = "===";
                break;

            case Operator.NotIdentical:
                str1 = "!==";
                break;

            case Operator.Greater:
                str1 = ">";
                break;

            case Operator.GreaterOrEqual:
                str1 = ">=";
                break;

            case Operator.Lower:
                str1 = "<";
                break;

            case Operator.LowerOrEqual:
                str1 = "<=";
                break;

            case Operator.GreaterOrIdentical:
                str1 = ">==";
                break;

            case Operator.LowerOrIdentical:
                str1 = "<==";
                break;

            default:
                throw new NotImplementedException(this.Operator.ToString() + " operator support has not been implemented yet!");
            }
            string format = "(event.{0} {1} {2})";
            string str2   = this.Value == null || this.Value.GetType() != typeof(DateTime) ? JSONHelper.ToJSON(this.Value) : DateFormatHelper.DateToJS((DateTime)this.Value);

            return(string.Format(format, (object)this.Field, (object)str1, (object)str2));
        }
Пример #3
0
        public string GenerateJSCode()
        {
            StringBuilder builder = new StringBuilder();

            if (this.Name != this.DefaultName)
            {
                builder.Append(string.Format("\n\twindow.{0} = Scheduler.getSchedulerInstance();", (object)this.Name));
            }
            builder.Append("\n");
            builder.Append(string.Format(DHXScheduler.GetServerList().InitConfigSection, (object)this.Name));
            if (DHXScheduler.GetServerList().Count > 0)
            {
                builder.Append(DHXScheduler.GetServerList().RenderCollections(this.Name));
            }
            foreach (SchedulerControlsBase control in this._Controls)
            {
                control.Render(builder, this.Name);
            }
            foreach (SchedulerSettingsBase setting in this._Settings)
            {
                setting.Render(builder, this.Name);
            }
            if (this.HasBeforeInitCode)
            {
                builder.Append("\n");
                builder.Append(string.Join("\n", this.BeforeInit.ToArray()));
                builder.Append("\n");
            }
            if (this.EventHandlers.Events.Count > 0)
            {
                this.EventHandlers.Render(builder, this.Name);
            }
            if (this.TimeSpans.Items.Count > 0)
            {
                this.TimeSpans.Render(builder, this.Name);
            }
            if (this.Highlighter.Enabled)
            {
                this.Highlighter.Render(builder, this.Name);
            }
            List <string> stringList = new List <string>();

            stringList.Add(string.Format("'{0}_here'", (object)this.Name));
            DateTime initialDate = this.InitialDate;
            string   str         = initialDate == new DateTime() ? "null" : DateFormatHelper.DateToJS(initialDate);
            string   initialView = this.InitialView;

            if (initialDate != new DateTime() || initialView != (string)null)
            {
                if (initialView != (string)null)
                {
                    stringList.Add(str);
                    stringList.Add("'" + initialView + "'");
                }
                else if (initialDate != new DateTime())
                {
                    stringList.Add(str);
                }
            }
            builder.Append(string.Format("\n\t{0}.init({1});", (object)this.Name, (object)string.Join(",", stringList.ToArray())));
            if (this.Extensions != null && this.Extensions.Items != null && this.Extensions.Items.Count != 0)
            {
                foreach (KeyValuePair <SchedulerExtensions.Extension, DHXExtension> keyValuePair in this.Extensions.Items)
                {
                    keyValuePair.Value.Render(builder, this);
                }
            }
            if (this.HasAfterInitCode)
            {
                builder.Append("\n");
                builder.Append(string.Join("\n", this.AfterInit.ToArray()));
                builder.Append("\n");
            }
            if (this.HasDefaultValues)
            {
                this.EventHandlers.Events.Add(new DHXSchedulerEvent(DHXSchedulerEvent.Types.onEventCreated, this._ProcessDefaultValues()));
            }
            this.Data.DateFormat = this.Config.xml_date;
            this.Data.Render(builder, this.Name);
            foreach (SchedulerControlsBase control in this._Controls)
            {
                builder.Append(control.AfterInit());
            }
            return(builder.ToString());
        }