Exemplo n.º 1
0
    /* Constructor to instantiate audition as well as create it in the database */
    public Audition(int districtId, int numJudges, string venue, string chairpersonId, string theoryTestSeries,
                    DateTime auditionDate, DateTime freezeDate, TimeSpan startTime1, TimeSpan endTime1, TimeSpan startTime2,
                    TimeSpan endTime2, TimeSpan startTime3, TimeSpan endTime3, TimeSpan startTime4, TimeSpan endTime4,
                    string startTimeDisplaySession1, string startTimeDisplaySession2, string startTimeDisplaySession3,
                    string startTimeDisplaySession4, string endTimeDisplaySession1, string endTimeDisplaySession2,
                    string endTimeDisplaySession3, string endTimeDisplaySession4, bool duetsAllowed)
    {
        this.districtId               = districtId;
        this.numJudges                = numJudges;
        this.venue                    = venue;
        this.chairpersonId            = chairpersonId;
        this.theoryTestSeries         = theoryTestSeries;
        this.auditionDate             = auditionDate;
        this.freezeDate               = freezeDate;
        this.startTimeSession1        = startTime1;
        this.endTimeSession1          = endTime1;
        this.startTimeSession2        = startTime2;
        this.endTimeSession2          = endTime2;
        this.startTimeSession3        = startTime3;
        this.endTimeSession3          = endTime3;
        this.startTimeSession4        = startTime4;
        this.endTimeSession4          = endTime4;
        this.startTimeDisplaySession1 = startTimeDisplaySession1;
        this.startTimeDisplaySession2 = startTimeDisplaySession2;
        this.startTimeDisplaySession3 = startTimeDisplaySession3;
        this.startTimeDisplaySession4 = startTimeDisplaySession4;
        this.endTimeDisplaySession1   = endTimeDisplaySession1;
        this.endTimeDisplaySession2   = endTimeDisplaySession2;
        this.endTimeDisplaySession3   = endTimeDisplaySession3;
        this.endTimeDisplaySession4   = endTimeDisplaySession4;
        this.duetsAllowed             = duetsAllowed;
        scheduleData                  = new ScheduleData();

        addNewAudition();
    }
Exemplo n.º 2
0
        // GET: MultipleDrag
        public ActionResult MultipleDrag()
        {
            ScheduleData data = new ScheduleData();
            List <ScheduleData.ResourceData> resourceData         = data.GetResourceData();
            List <ScheduleData.ResourceData> timelineResourceData = data.GetTimelineResourceData();

            ViewBag.datasource = resourceData.Concat(timelineResourceData);

            List <ResourceDataSourceModel> ownerData = new List <ResourceDataSourceModel>();

            ownerData.Add(new ResourceDataSourceModel {
                text = "Nancy", id = 1, color = "#df5286"
            });
            ownerData.Add(new ResourceDataSourceModel {
                text = "Steven", id = 2, color = "#7fa900"
            });
            ownerData.Add(new ResourceDataSourceModel {
                text = "Robert", id = 3, color = "#ea7a57"
            });
            ownerData.Add(new ResourceDataSourceModel {
                text = "Smith", id = 4, color = "#5978ee"
            });
            ownerData.Add(new ResourceDataSourceModel {
                text = "Michael", id = 5, color = "#df5286"
            });
            ViewBag.Owners = ownerData;

            ViewBag.Resources = new string[] { "Owners" };
            return(View());
        }
Exemplo n.º 3
0
 public void UpdateEvent([FromBody] ScheduleData eventData)
 {
     try
     {
         ScheduleData updateData = _context.EventDatas.Find(eventData.Id);
         if (updateData != null)
         {
             updateData.Subject             = eventData.Subject;
             updateData.StartTime           = Convert.ToDateTime(eventData.StartTime);
             updateData.EndTime             = Convert.ToDateTime(eventData.EndTime);
             updateData.StartTimezone       = eventData.StartTimezone;
             updateData.EndTimezone         = eventData.EndTimezone;
             updateData.Location            = eventData.Location;
             updateData.Description         = eventData.Description;
             updateData.IsAllDay            = eventData.IsAllDay;
             updateData.IsBlock             = eventData.IsBlock;
             updateData.IsReadonly          = eventData.IsReadonly;
             updateData.FollowingID         = eventData.FollowingID;
             updateData.RecurrenceID        = eventData.RecurrenceID;
             updateData.RecurrenceRule      = eventData.RecurrenceRule;
             updateData.RecurrenceException = eventData.RecurrenceException;
             updateData.RoomId  = eventData.RoomId;
             updateData.OwnerId = eventData.OwnerId;
             _context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Exemplo n.º 4
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "schedule/{repo}")] HttpRequest req,
            string repo,
            ILogger log)
        {
            DateTime     startDate, endDate;
            StringValues startBuffer, endBuffer;

            log.LogInformation("Schedule(): Received request");

            if (req.Query.TryGetValue("startdate", out startBuffer) && req.Query.TryGetValue("enddate", out endBuffer))
            {
                if (!DateTime.TryParse(startBuffer, out startDate) || !DateTime.TryParse(endBuffer, out endDate))
                {
                    log.LogError("Schedule(): Badly formed dates in query string");
                    return(new BadRequestResult());
                }
            }
            else
            {
                // Dates were not provided, use default of next 31 days
                startDate = DateTime.Today;
                endDate   = DateTime.Today.AddDays(31);
            }

            var result = await ScheduleData.GetScheduleAsync(repo, startDate, endDate);

            return(new OkObjectResult(result));
        }
        //get offices weekly schedule from the database
        public List <WeeklySchedule> GetScheduleData()
        {
            var sd = new ScheduleData();
            List <WeeklySchedule> weeklySchedule = sd.GetOfficeWeeklySchedule();

            return(weeklySchedule);
        }
Exemplo n.º 6
0
        private static async void ExecuteTask(ScheduleData data)
        {
            _log.Debug("Eksekusi schedule: {0}", data.MessageId);

            switch (data.Operation)
            {
            case ScheduleData.Type.Delete:
                await BotClient.DeleteMessageAsync(data.ChatId, data.MessageId);

                break;

            case ScheduleData.Type.Edit:
                await BotClient.EditOrSendTextAsync(data.ChatId, data.MessageId, data.Text, data.ParseMode,
                                                    sendOnError : false);

                break;

            case ScheduleData.Type.Done:
                return;

            default:
                return;
            }

            data.Operation = ScheduleData.Type.Done;
            await _db.InsertOrReplaceSchedule(data);
        }
Exemplo n.º 7
0
 public void AddEvent([FromBody] ScheduleData eventData)
 {
     try
     {
         ScheduleData insertData = new ScheduleData();
         insertData.Id                  = (_context.EventDatas.ToList().Count > 0 ? _context.EventDatas.ToList().Max(p => p.Id) : 1) + 1;
         insertData.Subject             = eventData.Subject;
         insertData.StartTime           = Convert.ToDateTime(eventData.StartTime);
         insertData.EndTime             = Convert.ToDateTime(eventData.EndTime);
         insertData.StartTimezone       = eventData.StartTimezone;
         insertData.EndTimezone         = eventData.EndTimezone;
         insertData.Location            = eventData.Location;
         insertData.Description         = eventData.Description;
         insertData.IsAllDay            = eventData.IsAllDay;
         insertData.IsBlock             = eventData.IsBlock;
         insertData.IsReadonly          = eventData.IsReadonly;
         insertData.FollowingID         = eventData.FollowingID;
         insertData.RecurrenceID        = eventData.RecurrenceID;
         insertData.RecurrenceRule      = eventData.RecurrenceRule;
         insertData.RecurrenceException = eventData.RecurrenceException;
         insertData.RoomId              = eventData.RoomId;
         insertData.OwnerId             = eventData.OwnerId;
         _context.EventDatas.Add(insertData);
         _context.SaveChanges();
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Exemplo n.º 8
0
 public ScheduleAndResultsDto GetSchedule(string divisionName, string seasonName, string leagueName)
 {
     using (var data = new ScheduleData())
     {
         return(data.GetSchedule(divisionName, seasonName, leagueName));
     }
 }
Exemplo n.º 9
0
    /// <summary>
    /// 增加新的label到刷新列表
    /// </summary>
    /// <param name="target"></param>
    /// <param name="schedulerID"></param>
    public void AddSchedulerLabel(Transform target, int schedulerID, int showModel = 0)
    {
        //int index = m_timeSchedulerList.FindIndex(x => x.schedulerRefreshList.FindIndex(y => y.target == target) >= 0);
        int index = m_timeSchedulerList.FindIndex(x => x.schedulerID == schedulerID);

        if (index >= 0)
        {
            SchedulerRefresh data = new SchedulerRefresh();
            data.showModel = showModel;
            data.target    = target;
            ScheduleData scheduleData = m_timeSchedulerList[index];
            index = scheduleData.schedulerRefreshList.FindIndex(x => x.target == target);
            if (index >= 0)
            {
                scheduleData.schedulerRefreshList[index] = data;
            }
            else
            {
                scheduleData.schedulerRefreshList.Add(data);
            }
        }
        else
        {
            target.GetComponent <UILabel>().text = "";
            Debug.Log("该计时事件ID:" + schedulerID + "没有注册");
        }
        if (m_labelUpdateList.ContainsKey(target))
        {
            m_labelUpdateList[target] = schedulerID;
        }
        else
        {
            m_labelUpdateList.Add(target, schedulerID);
        }
    }
Exemplo n.º 10
0
        /// <summary>
        /// 延迟delay秒之后每隔delta秒执行callback,执行次数为repeat
        /// </summary>
        /// <param name="delay">Delay.</param>
        /// <param name="delta">Delta.</param>
        /// <param name="Repeat">Repeat.</param>
        /// <param name="callback">Callback.</param>
        public void ScheduleRepeatInvoke(float delay, float delta, int Repeat, object o, Action <object, int> callback)
        {
            if (Repeat == 0 || delta < 0f || delay < 0f)
            {
                LogMgr.LogErrorFormat("参数错误 {0} {1} {2}", delay.ToString(), delta.ToString(), Repeat.ToString());
                return;
            }

            long invoketime = GameSyncCtr.mIns.RenderFrameCount + Mathf.RoundToInt(delay * GameSyncCtr.mIns.FrameRate);

            if (this.scheduleList.Count > 0)
            {
                bool inserted = false;
                for (int i = scheduleList.Count - 1; i >= 0; --i)
                {
                    ScheduleData data = scheduleList[i];
                    if (data.InvokeTime > invoketime)
                    {
                        this.scheduleList.Insert(i, new ScheduleData(invoketime, Repeat, delta, o, callback));
                        inserted = true;
                        break;
                    }
                }

                if (!inserted)
                {
                    this.scheduleList.Add(new ScheduleData(invoketime, Repeat, delta, o, callback));
                }
            }
            else
            {
                this.scheduleList.Add(new ScheduleData(invoketime, Repeat, delta, o, callback));
            }
        }
Exemplo n.º 11
0
        public void ScheduleRepeatFrameInvoke(int delay, int deltaFrame, int Repeat, object o, Action <object, int> callback)
        {
            if (Repeat == 0 || deltaFrame < 0f)
            {
                LogMgr.LogErrorFormat("参数错误 {0} {1} {2}", delay.ToString(), deltaFrame.ToString(), Repeat.ToString());
                return;
            }

            long invoketime = GameSyncCtr.mIns.RenderFrameCount + delay;
            bool inserted   = false;

            for (int i = scheduleList.Count - 1; i >= 0; --i)
            {
                ScheduleData data = scheduleList[i];
                if (data.InvokeTime > invoketime)
                {
                    this.scheduleList.Insert(0, new ScheduleData(invoketime, Repeat, deltaFrame, o, callback));
                    inserted = true;
                    break;
                }
            }

            if (!inserted)
            {
                this.scheduleList.Add(new ScheduleData(invoketime, Repeat, deltaFrame, o, callback));
            }
        }
Exemplo n.º 12
0
 public void SetScript(Func <IScriptEngine <ProgressInfo> > GetScript, ScheduleData Data, Flyout fy)
 {
     script           = GetScript();
     _data            = Data;
     this.DataContext = _data;
     _fy = fy;
 }
Exemplo n.º 13
0
        /// <summary>
        /// just one invoke
        /// </summary>
        /// <param name="delay"></param>
        /// <param name="o"></param>
        /// <param name="callback"></param>
        public void ScheduleInvoke(float delay, object o, Action <object, int> callback)
        {
            if (delay < 0f)
            {
                LogMgr.LogErrorFormat("参数错误 {0}", delay.ToString());
                return;
            }

            long invoketime = GameSyncCtr.mIns.RenderFrameCount + Mathf.RoundToInt(delay * GameSyncCtr.mIns.FrameRate);

            bool insert = false;

            for (int i = 0; i < scheduleList.Count; ++i)
            {
                ScheduleData data = scheduleList[i];
                if (data.InvokeTime > invoketime)
                {
                    this.scheduleList.Insert(i, new ScheduleData(invoketime, 1, 0f, o, callback));
                    insert = true;
                    break;
                }
            }


            if (!insert)
            {
                this.scheduleList.Add(new ScheduleData(invoketime, 1, 0f, o, callback));
            }
        }
Exemplo n.º 14
0
        public IActionResult TimelineResourceGroup()
        {
            ScheduleData data = new ScheduleData();
            List<ScheduleData.ResourceData> resourceData = data.GetResourceData();
            List<ScheduleData.ResourceData> timelineResourceData = data.GetTimelineResourceData();
            ViewBag.datasource = resourceData.Concat(timelineResourceData);

            List<ResourceDataSourceModel> projects = new List<ResourceDataSourceModel>();
            projects.Add(new ResourceDataSourceModel { text = "PROJECT 1", id = 1, color = "#cb6bb2" });
            projects.Add(new ResourceDataSourceModel { text = "PROJECT 2", id = 2, color = "#56ca85" });
            projects.Add(new ResourceDataSourceModel { text = "PROJECT 3", id = 3, color = "#df5286" });
            ViewBag.Projects = projects;

            List<ResourceDataSourceModel> categories = new List<ResourceDataSourceModel>();
            categories.Add(new ResourceDataSourceModel { text = "Nancy", id= 1, groupId= 1, color= "#df5286" });
            categories.Add(new ResourceDataSourceModel { text= "Steven", id= 2, groupId= 1, color= "#7fa900" });
            categories.Add(new ResourceDataSourceModel { text = "Robert", id = 3, groupId = 2, color = "#ea7a57" });
            categories.Add(new ResourceDataSourceModel { text = "Smith", id = 4, groupId = 2, color = "#5978ee" });
            categories.Add(new ResourceDataSourceModel { text = "Micheal", id = 5, groupId = 3, color = "#df5286" });
            categories.Add(new ResourceDataSourceModel { text = "Root", id = 6, groupId = 3, color = "#00bdae" });
            ViewBag.Categories = categories;

            ViewBag.Resources = new string[] { "Projects", "Categories" };
            return View();
        }
Exemplo n.º 15
0
        private void btnSearchTeacher_Click(object sender, EventArgs e)
        {
            string    name = txtSearchTeacher.Text;
            DataTable data = ScheduleData.Instance().SearchTeacher(name);

            teachers.DataSource = data;
        }
Exemplo n.º 16
0
        private void btnEditSchedule_Click(object sender, EventArgs e)
        {
            string date      = dtpkDate.Value.ToString().Split(' ')[0];
            string datecheck = dtpkDate.Value.ToString();

            string slotID         = cbSlotID.Text;
            string groupID        = cbGroupID.Text;
            string courseID       = CourseData.GetInstance().GetCourseIDByCourseName(cbCourseID.Text);
            string userNameBooker = user.UserName;
            string index          = dtgvSchedule.SelectedCells[0].OwningRow.Cells["Index"].Value.ToString();

            if (checkDuplicateData(datecheck, slotID, groupID))
            {
                if (ScheduleData.Instance().EditSchedule(date, slotID, groupID, courseID, userNameBooker, index))
                {
                    MessageBox.Show("Edit Successful");
                    loadScheduleData();
                }
                else
                {
                    MessageBox.Show("Edit Fail");
                }
            }
            else
            {
                MessageBox.Show("Duplicate Data");
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Prepares and schedules a task for execution.
        /// </summary>
        /// <param name="task">The task.</param>
        public static void ScheduleTask(TaskWrapper task)
        {
            if (_taskQueue == null)
            {
                throw new Exception("TaskManager failed to initialize.");
            }

            var nextAttempt = task.NextAttempt = DateTime.Now + (task.ConfigurationData.DelayStart ?? ConfigurationHelpers.DefaultDelayStart);

            ScheduleData current = task.ConfigurationData.GetScheduleFor(task.NextAttempt);

            lock (_taskLock)
            {
                _tasks.Add(task);

                for (int index = 0, total = current.Spawn.Value; index < total; index++)
                {
                    _taskQueue.Enqueue(task);

                    _stats.ScheduledTasks.Increment();
                    _stats.Tasks.Increment();
                }
            }

            EnsureExecution();
        }
Exemplo n.º 18
0
        public int SendAppoinments()
        {
            // string[] rooms = ScheduleUpdateController.GetWatchingRooms();

            int        sentCount = 0;
            ITransport transport = TransportFactory.Transport;

            foreach (RoomConfig room in RoomConfigurations.Values)
            {
                try
                {
                    ScheduleData roomSchedule = ExchangeHelper.LoadResouceCallendar(room.Location);
                    if (roomSchedule != null && roomSchedule.Schedule != null)
                    {
                        transport.SendAppointments(roomSchedule, room);
                        sentCount += roomSchedule.Schedule.Length;
                        Console.Out.WriteLine("Sucessfully sent {0} appointments for the room {1}", new object[] { roomSchedule.Schedule.Length, room.Location });
                    }
                    else
                    {
                        Console.Out.WriteLine("Nothing sent for the room {0}", room.Location);
                    }
                }catch (Exception ex)
                {
                    Console.Out.WriteLine(String.Format("Error {0} sending data for room {1}", new object[] { ex.Message, room.Location }));
                }
            }

            return(sentCount);
        }
Exemplo n.º 19
0
        public ActionResult InlineEditing()
        {
            ScheduleData data = new ScheduleData();
            List <ScheduleData.ResourceData> resourceData         = data.GetResourceData();
            List <ScheduleData.ResourceData> timelineResourceData = data.GetTimelineResourceData();

            ViewBag.datasource = resourceData.Concat(timelineResourceData);

            List <ResourceDataSourceModel> categories = new List <ResourceDataSourceModel>();

            categories.Add(new ResourceDataSourceModel {
                text = "Nancy", id = 1, groupId = 1, color = "#df5286"
            });
            categories.Add(new ResourceDataSourceModel {
                text = "Steven", id = 2, groupId = 1, color = "#7fa900"
            });
            categories.Add(new ResourceDataSourceModel {
                text = "Robert", id = 3, groupId = 2, color = "#ea7a57"
            });
            categories.Add(new ResourceDataSourceModel {
                text = "Smith", id = 4, groupId = 2, color = "#5978ee"
            });
            categories.Add(new ResourceDataSourceModel {
                text = "Michael", id = 5, groupId = 3, color = "#df5286"
            });
            categories.Add(new ResourceDataSourceModel {
                text = "Root", id = 6, groupId = 3, color = "#00bdae"
            });
            ViewBag.Categories = categories;

            ViewBag.Resources = new string[] { "Categories" };
            return(View());
        }
Exemplo n.º 20
0
        /// <summary>
        /// Option to load user data on application load in order you want.
        /// </summary>
        /// <remarks>
        ///     Try to get data of each section...
        ///     if the data cannot be loaded, create a new data instance with triggered <see cref="ADataContentBaseViewModel.SetDefaults"/> method.
        ///     The method should be called only during initialization here!
        /// </remarks>
        public void Setup()
        {
            // Preferences.
            PreferencesData = IoC.SettingsStorage.PreferencesData ?? PreferencesDataViewModel.NewDataInstance;
            PreferencesData.Init();
            PreferencesData.SetDefaults();

            // APM Calculator
            ApmCalculatorData = IoC.SettingsStorage.ApmCalculatorData ?? ApmCalculatorDataViewModel.NewDataInstance;
            ApmCalculatorData.Init();
            ApmCalculatorData.SetDefaults();

            // Timer
            TimerData = IoC.SettingsStorage.TimerData ?? TimerDataViewModel.NewDataInstance;
            TimerData.Init();
            TimerData.SetDefaults();

            // Schedule
            ScheduleData = IoC.SettingsStorage.ScheduleData ?? ScheduleDataViewModel.NewDataInstance;
            ScheduleData.Init();
            ScheduleData.SetDefaults();

            // Watchdog
            WatchdogData = IoC.SettingsStorage.WatchdogData ?? WatchdogDataViewModel.NewDataInstance;
            WatchdogData.Init();
            WatchdogData.SetDefaults();

            // Overlay
            OverlayData = IoC.SettingsStorage.OverlayData ?? OverlayDataViewModel.NewDataInstance;
            OverlayData.Init();
            OverlayData.SetDefaults();
        }
Exemplo n.º 21
0
        /// <summary>
        /// Schedule the robot.
        /// </summary>
        /// <param name="scheduleData">Schedule data.</param>
        public void Schedule(ScheduleData scheduleData)
        {
            if (scheduleData == null) return;
            if (!scheduleData.IsValid()) return;

            byte[] command =
            {
                (byte)RoombaOpcodes.SCHEDULE,
                (byte)scheduleData.Days,
                (byte)scheduleData.Sunday.Hour,
                (byte)scheduleData.Sunday.Minute,
                (byte)scheduleData.Monday.Hour,
                (byte)scheduleData.Monday.Minute,
                (byte)scheduleData.Tuesday.Hour,
                (byte)scheduleData.Tuesday.Minute,
                (byte)scheduleData.Wednesday.Hour,
                (byte)scheduleData.Wednesday.Minute,
                (byte)scheduleData.Thursday.Hour,
                (byte)scheduleData.Thursday.Minute,
                (byte)scheduleData.Friday.Hour,
                (byte)scheduleData.Friday.Minute,
                (byte)scheduleData.Saturday.Hour,
                (byte)scheduleData.Saturday.Minute,
            };

            this.commandQueue.PutToQue(command);
        }
Exemplo n.º 22
0
        public ActionResult AddRemoveResources()
        {
            List <CalendarRes> calendarCollections = new List <CalendarRes>();

            calendarCollections.Add(new CalendarRes {
                CalendarName = "My Calendar", CalendarId = 1, CalendarColor = "#c43081"
            });
            ViewBag.Calendars = calendarCollections;

            ScheduleData data = new ScheduleData();
            List <ScheduleData.ResourceEventsData> holidayData  = data.GetHolidayData();
            List <ScheduleData.ResourceEventsData> birthdayData = data.GetBirthdayData();
            List <ScheduleData.ResourceEventsData> companyData  = data.GetCompanyData();
            List <ScheduleData.ResourceEventsData> personalData = data.GetPersonalData();

            ViewBag.datasource = holidayData.Concat(birthdayData).Concat(companyData).Concat(personalData);

            List <ScheduleViewsModel> viewOption = new List <ScheduleViewsModel>()
            {
                new ScheduleViewsModel {
                    Option = Syncfusion.EJ2.Schedule.View.Month
                }
            };

            ViewBag.view = viewOption;

            string[] resources = new string[] { "Calendars" };
            ViewBag.Resources = resources;

            return(View());
        }
Exemplo n.º 23
0
        public static void DecideSuccessHarmonyPostfix(WorkResultSceneMode sceneMode, int index, bool commu)
        {
            if (!configEntryUtill["DecideSuccess_log"])
            {
                MyLog.LogMessage("ScheduleAPI.DecideSuccess.HarmonyPostfix"
                                 , sceneMode
                                 , index
                                 , commu
                                 );
            }

            if (!configEntryUtill["DecideSuccess_Perfect2"])
            {
                return;
            }

            ScheduleData scheduleData = GameMain.Instance.CharacterMgr.status.scheduleSlot[index];

            if (sceneMode == WorkResultSceneMode.Noon)
            {
                if (scheduleData.noon_success_level != ScheduleData.WorkSuccessLv.Unexecuted)
                {
                    scheduleData.noon_success_level = ScheduleData.WorkSuccessLv.Perfect;
                }
            }
            else if (sceneMode == WorkResultSceneMode.Night)
            {
                if (scheduleData.night_success_level != ScheduleData.WorkSuccessLv.Unexecuted)
                {
                    scheduleData.night_success_level = ScheduleData.WorkSuccessLv.Perfect;
                }
            }
        }
Exemplo n.º 24
0
    // create an entry that begins at the given time between two key points. return the time the next entry should begin at.
    private int build_schedule_part(int start_min, KeyPoint from, KeyPoint to, ref ScheduleData schedule_data, string map_id, TileMapScript map_data)
    {
        var from_point = map_data.get_key_point(from);
        var to_point   = map_data.get_key_point(to);

        // get the path between the two points
        var path = world_generator.get_path(from_point, to_point, map_data.get_raw_data(), false);

        // make sure that a path exists first (if not there's a bug somewhere. this shouldn't happen because world gen ensures a path exists.)
        if (path.Count == 0)
        {
            Debug.Log(string.Format("Can't make entry in {4} from ({0}, {1}) to ({2},{3})",
                                    from_point[0], from_point[1], to_point[0], to_point[1], map_id));
            map_data.print_map();
            return(-1);
        }

        var path_length           = path.Count - 1;
        var MERCHANT_MIN_PER_TILE = 1.0f;

        // the time to be at the destination is proportional to the length of the path times the merchant's speed
        // it's set so that it gives the perfect amount of time for the merchant to get there on time
        int finish_time = start_min + (int)(MERCHANT_MIN_PER_TILE * path_length);

        schedule_data.insertEntry(create_schedule_entry(start_min, map_id, from_point[0], from_point[1]));
        schedule_data.insertEntry(create_schedule_entry(finish_time, map_id, to_point[0], to_point[1]));

        // return the next time to create an entry at, which is WAITING_TIME more than the finish time, because the merchant waits at the spot for WAITING_TIME
        var WAITING_TIME_IN_MIN = 25;

        finish_time += WAITING_TIME_IN_MIN;
        return(finish_time);
    }
Exemplo n.º 25
0
 public List <PlayerStandingsResultsDto> GetStandings(string divisionName, string seasonName, string leagueName)
 {
     using (var data = new ScheduleData())
     {
         return(data.GetStandings(divisionName, seasonName, leagueName));
     }
 }
Exemplo n.º 26
0
        private static void TimerElapsed(Timer timer, ScheduleData data)
        {
            timer?.Stop();
            timer?.Dispose();

            ExecuteTask(data);
        }
Exemplo n.º 27
0
        private void Schedule(string scheduleName, int schedulTime, Delegate scheduleHandler)
        {
            ScheduleData scheduleEntry = new ScheduleData(scheduleName, new Timer(2123156465));

            scheduleEntry.timer.Elapsed += scheduleHandler;

            serviceTimerList.Add(scheduleEntry);
        }
        public ActionResult GetScheduleById(int id)
        {
            var results = ScheduleData.GetScheduleById(id);

            var jsonResult = SerializeObjectToJson(results);

            return(jsonResult);
        }
        public ActionResult GetCaptions()
        {
            var results = ScheduleData.GetCaptions();

            var jsonResult = SerializeObjectToJson(results);

            return(jsonResult);
        }
Exemplo n.º 30
0
    /**
    * Load a schedule from a file
    * @param filename - filename of schedule data to load
    */
    public void loadSchedule(string filename)
    {
        _scheduleData = SaveDataScript.save_data.schedule;

        /*IFormatter formatter = new BinaryFormatter();
        Stream stream = new FileStream(".\\Assets\\Resources\\" + filename, FileMode.Open);
        _scheduleData = (ScheduleData)formatter.Deserialize(stream);
        stream.Close(); */
    }
Exemplo n.º 31
0
    private bool at_point(GameObject merchant, ScheduleData.ScheduleEntry entry_point)
    {
        var current_pos = merchant.transform.position;

        var same_world = tile_map.get_map_id() == entry_point.world_id;
        var same_position = current_pos.x == entry_point.x_pos && current_pos.z == entry_point.y_pos;

        return same_position && same_world;
    }
Exemplo n.º 32
0
 /// <summary>
 /// Helper method to convert a <see cref="ScheduleData"/> instance
 /// to a <see cref="ScheduleInfo"/> instance.
 /// </summary>
 /// <param name="data">The data instance.</param>
 /// <returns>The converted data.</returns>
 public static ScheduleInfo ToScheduleInfo(this ScheduleData data)
 {
     return(new ScheduleInfo()
     {
         Uuid = data?.Uuid,
         Link = data?.Link,
         Name = data?.Name
     });
 }
        private void scheduleBuild()
        {
            this.scheduleDataList_ = new ObservableCollection<ScheduleData>();

            List<DateTime> eventDates = this.scheduleInfoVM_.dates();

            int scheduleLength = eventDates.Count;

            for (int i = 0; i < scheduleLength ; i++)
			{
			    ScheduleData data = new ScheduleData();

                data.Type_ = ("autocall").ToUpper();
                data.EventDate_ = eventDates[0].ToString("yyyyMMdd");
                data.Trigger_ = autoCallTrigger_[i];
                data.Coupon_ = "0.06";

                this.scheduleDataList_.Add(data);
			}
        }
        private Excel_simpleCalculationViewModel excel_simpleCalculationVMBuild(ScheduleData scheduleData)
        {
            Excel_simpleCalculationViewModel e_cvm = new Excel_simpleCalculationViewModel();

            e_cvm.EventDate_ = scheduleData.EventDate_;

            #region EventCal
            //---------------------------------------------------------------
            {
                Excel_singleRangeEventCalViewModel e_srecvm = new Excel_singleRangeEventCalViewModel();

                e_srecvm.LowerRng_ = scheduleData.Trigger_;

                //처음꺼만 사용함
                e_srecvm.Excel_underlyingCalcID_ = this.excel_underlyingCalcInfoVM_.Excel_underlyingCalcIDViewModel_[0];

                e_cvm.Excel_eventCalcInfoViewModel_.Excel_eventCalcViewModel_.Add(e_srecvm);

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함

            }

            #endregion

            #region ReturnCal
            //---------------------------------------------------------------
            {
                Excel_constReturnCalViewModel e_crcvm = new Excel_constReturnCalViewModel();

                e_crcvm.ConstReturn_ = scheduleData.Coupon_;

                e_cvm.Excel_returnCalcInfoViewModel_.Excel_returnCalcViewModel_.Add(e_crcvm);

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함

            }
            #endregion

            #region AutoCall_Event

            //---------------------------------------------------------------
            {
                Excel_singleRangeEventCalViewModel e_srecvm = new Excel_singleRangeEventCalViewModel();

                e_srecvm.LowerRng_ = scheduleData.Trigger_;

                //처음꺼만 사용함
                e_srecvm.Excel_underlyingCalcID_ = this.excel_underlyingCalcInfoVM_.Excel_underlyingCalcIDViewModel_[0];

                e_cvm.Excel_eventCalcInfo_CallViewModel_.Excel_eventCalcViewModel_.Add(e_srecvm);

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함

            }

            #endregion

            #region AutoCall_ReturnCal

            //---------------------------------------------------------------
            {
                Excel_constReturnCalViewModel e_crcvm = new Excel_constReturnCalViewModel();

                e_crcvm.ConstReturn_ = "1.0"; // 원금

                e_cvm.Excel_returnCalcInfo_CallViewModel_.Excel_returnCalcViewModel_.Add(e_crcvm);

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함

            }
            
            #endregion

            return e_cvm;
        }
Exemplo n.º 35
0
        public void Render()
        {
            if (Questionnaire == null || Questionnaire.Form.Settings == null) {
                BrightVision.Common.UI.NotificationDialog.Information("Scheduling / Booking", "Questionnaire must be initialized with Json first.");
                return;
            }

            //var answerOpt = Questionnaire.Form.Settings.AnswerOptions[0] as ISchedule;
            //caller = new ContactAttendie() {
            //    AccountID = account_id,
            //    ContactID = ca.id,
            //    Name = ca.first_name + (ca.last_name.Length > 0 ? " " + ca.last_name : ""),
            //    Address = ca.complete_address,
            //    City = "",
            //    Email = ca.email,
            //    Telephone = ca.direct_phone,
            //    Attending = true
            //};

            //if (CalendarDataSource == null) {
            //    if (answerOpt != null) {
            //        if (answerOpt.CalendarOption != null && answerOpt.CalendarOption.CalendarValues.Count > 0)
            //            CalendarDataSource = answerOpt.CalendarOption.CalendarValues;
            //        else {
            //            MessageBox.Show("\"CalendarDataSource\" property must be set first.","Schedule Component");
            //            return;
            //        }
            //    } else {
            //        MessageBox.Show("\"CalendarDataSource\" property must be set first.", "Schedule Component");
            //        return;
            //    }
            //}

            //#endregion

            isLoaded = false;
            IList<AnswerOption> _lstAnswerOptions = Questionnaire.Form.Settings.AnswerOptions;
            ISchedule _AnswerData = null;

            /**
             * set caller.
             */
            m_Caller = null;
            if (ContactPerson != null) {
                m_Caller = new ContactAttendie() {
                    AccountID = AccountId,
                    ContactID = ContactPerson.id,
                    Name = ContactPerson.first_name + (ContactPerson.last_name.Length > 0 ? " " + ContactPerson.last_name : ""),
                    Address = ContactPerson.complete_address,
                    City = "",
                    Email = ContactPerson.email,
                    Telephone = ContactPerson.direct_phone,
                    Attending = true
                };
            }

            for (int i = 0; i < _lstAnswerOptions.Count; i++) {
                _AnswerData = _lstAnswerOptions[i] as ISchedule;

                /*
                 * https://brightvision.jira.com/browse/PLATFORM-3015
                 */
                if (_AnswerData.ScheduleType != null && _AnswerData.ScheduleValue != null)
                {
                    if (!string.IsNullOrEmpty(_AnswerData.ScheduleValue.ScheduleId) && this.lblScheduleDetails != null)
                    {
                        this.lblScheduleDetails.Text = _AnswerData.ScheduleValue.Description;
                        if (_AnswerData.ScheduleSalesPerson.SalesPersonSelectedValue.Name != null && _AnswerData.ScheduleSalesPerson.SalesPersonSelectedValue.Name != "")
                            this.lblScheduleDetails.Text += " | " + _AnswerData.ScheduleSalesPerson.SalesPersonSelectedValue.Name;

                        this.PreviewBooking.Enabled = true;
                    }
                    if (string.IsNullOrEmpty(_AnswerData.ScheduleValue.ScheduleId) && this.lblScheduleDetails != null)
                    {
                        this.lblScheduleDetails.Text = "";
                        this.DeleteMeeting.Enabled = false;
                        this.PreviewBooking.Enabled = false;
                    }
                }

                /**
                 * sales person.
                 */
                if (_AnswerData.ScheduleSalesPerson == null || _AnswerData.ScheduleSalesPerson.SalesPersonSelectedValue == null)
                    this.lookUpEdit1.EditValue = null;
                else
                    this.lookUpEdit1.EditValue = _AnswerData.ScheduleSalesPerson.SalesPersonSelectedValue.Id;

                /**
                 * list of bookings selected schedule id.
                 */
                if (_AnswerData.ScheduleType != null && _AnswerData.ScheduleValue != null) {
                    if (!string.IsNullOrEmpty(_AnswerData.ScheduleValue.ScheduleId))
                        lookUpEdit2.EditValue = int.Parse(_AnswerData.ScheduleValue.ScheduleId);
                    else
                        lookUpEdit2.EditValue = null;
                }

                /**
                 * list of bookings label value.
                 */
                this.lciListOfScheduleDropDown.Text = "List of Available Schedules";
                if (!string.IsNullOrEmpty(_AnswerData.ListOfBookingsAvailableLabel))
                    this.lciListOfScheduleDropDown.Text = _AnswerData.ListOfBookingsAvailableLabel.Trim();

                /**
                 * preview booking text value.
                 */
                this.PreviewBooking.Text = "Preview Details";
                if (!string.IsNullOrEmpty(_AnswerData.ViewDetailSummaryButtonLabel))
                    this.PreviewBooking.Text = _AnswerData.ViewDetailSummaryButtonLabel;

                /**
                 * create button text value.
                 */
                this.CreateMeeting.Text = "Create/Edit Meeting";
                if (!string.IsNullOrEmpty(_AnswerData.CreateMeetingButtonLabel))
                    if (_AnswerData.CreateMeetingButtonLabel.Trim().ToLower() != "create meeting")
                        this.CreateMeeting.Text = _AnswerData.CreateMeetingButtonLabel;

                if (_AnswerData.ScheduleType != null && _AnswerData.ScheduleType.ScheduleTypeSelectedValue == "Meeting") {
                    this.lciListOfScheduleCreateEditButton.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                    this.CreateMeeting.Tag = "HasMeeting";
                }
                else
                    this.lciListOfScheduleCreateEditButton.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

                /**
                 * delete button text value.
                 */
                if (_AnswerData.ScheduleType != null && _AnswerData.ScheduleType.ScheduleTypeSelectedValue == "Meeting") {
                    this.DeleteMeeting.Tag = "HasMeeting";
                    this.lciListOfScheduleDeleteButton.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                }
                else
                    this.lciListOfScheduleDeleteButton.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

                /**
                 * set attendies grid.
                 */
                this.SetCurrentAttendies();
                ScheduleData _ScheduleData = new ScheduleData() {
                    Required = _AnswerData.AttendiesRequired
                };
                if (gridView1.GridControl.DataSource != null) {
                    List<ContactAttendie> _lstAttendies = gridView1.GridControl.DataSource as List<ContactAttendie>;
                    if (_lstAttendies != null && _lstAttendies.Count > 0)
                        _ScheduleData.HasValue = true;
                }
                this.gridView1.Tag = _ScheduleData;

                /**
                 * set labels.
                 */
                this.lciGridControl.Text = "Attendies";
                if (!string.IsNullOrEmpty(_AnswerData.AttendiesLabel))
                    this.lciGridControl.Text = _AnswerData.AttendiesLabel;

                this.simpleButton1.Text = "Add Caller";
                if (!string.IsNullOrEmpty(_AnswerData.AddCallerButtonLabel))
                    this.simpleButton1.Text = _AnswerData.AddCallerButtonLabel;

                this.simpleButton2.Text = "Add Additional";
                if (!string.IsNullOrEmpty(_AnswerData.AddAdditionalAttendieButtonLabel))
                    this.simpleButton2.Text = _AnswerData.AddAdditionalAttendieButtonLabel;

                this.simpleButton3.Text = "Delete";
                if (!string.IsNullOrEmpty(_AnswerData.DeleteAttendieButtonLabel))
                    this.simpleButton3.Text = _AnswerData.DeleteAttendieButtonLabel;

                /**
                 * set other choices.
                 */
                foreach (OtherChoice _OtherChoice in _AnswerData.OtherChoices) {
                    if (_OtherChoice.Enabled) {
                        if (_OtherChoice.DefaultInputValue != null) {
                            this.memoEdit1.Text = _OtherChoice.DefaultInputValue.Trim();
                            _OtherChoice.InputValue = _OtherChoice.DefaultInputValue.Trim();
                        }
                    }
                }
            }

            if (this.memoEdit1 != null)
                BackColor = this.memoEdit1.BackColor;

            isLoaded = true;
            //this.SetEditableGroupControls(this.layoutControlGroupQuestion1, false);
        }
Exemplo n.º 36
0
        /*
         * https://brightvision.jira.com/browse/PLATFORM-3015
         */
        public void BindControls()
        {
            #region Initialization
            if (Questionnaire == null)
                MessageBox.Show("Questionnaire must be bind with JSON first.", "Schedule Component");

            var answerOpt = Questionnaire.Form.Settings.AnswerOptions[0] as ISchedule;

            //if (CalendarDataSource == null) {
            //    if (answerOpt != null) {
            //        if (answerOpt.CalendarOption != null && answerOpt.CalendarOption.CalendarValues.Count > 0)
            //            CalendarDataSource = answerOpt.CalendarOption.CalendarValues;
            //        else {
            //            MessageBox.Show("\"CalendarDataSource\" property must be set first.","Schedule Component");
            //            return;
            //        }
            //    } else {
            //        MessageBox.Show("\"CalendarDataSource\" property must be set first.", "Schedule Component");
            //        return;
            //    }
            //}

            #endregion

            isLoaded = false;
            this.layoutControlGroupQuestion1.Clear();
            Settings oSettings = Questionnaire.Form.Settings;

            // layoutControlGroupQuestion1
            this.layoutControlGroupQuestion1.Name = "layoutControlGroupQuestion" + Guid.NewGuid().ToString();
            this.layoutControlGroupQuestion1.AppearanceGroup.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);
            this.layoutControlGroupQuestion1.AppearanceGroup.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
            this.layoutControlGroupQuestion1.AppearanceGroup.Options.UseFont = true;
            this.layoutControlGroupQuestion1.ExpandButtonVisible = false;
            this.layoutControlGroupQuestion1.GroupBordersVisible = true;
            this.layoutControlGroupQuestion1.TextVisible = false;
            this.layoutControlGroupQuestion1.Padding = new DevExpress.XtraLayout.Utils.Padding(1, 1, 1, 1);
            this.layoutControlGroupQuestion1.ShowInCustomizationForm = false;
            //this.layoutControlGroupQuestion1.Text = oSettings.Label + " " + oSettings.QuestionText;
            this.layoutControlGroupQuestion1.BeginUpdate();

            #region Footer
            this.lciFooter = new LayoutControlItem();
            this.lciFooter.Name = "layoutControlItem" + Guid.NewGuid().ToString();

            //bool isCustomerOwnershipOnly = false;
            //if (oSettings.CustomerOwnership && oSettings.BVOwnership)
            //    isCustomerOwnershipOnly = true;

            //ctlFooter = new Footer() {
            //    IsAccountLevel = oSettings.DataBindings.account_level,
            //    IsCustomerOwnershipOnly = isCustomerOwnershipOnly,
            //    HelpText = oSettings.QuestionHelp,
            //    LanguageCode = oSettings.DataBindings.language_code
            //};

            ctlFooter = new Footer()
            {
                IsAccountLevel = oSettings.DataBindings.account_level,
                IsCustomerOwned = oSettings.CustomerOwnership,
                IsBrightvisionOwned = oSettings.BVOwnership,
                HelpText = oSettings.QuestionHelp,
                LanguageCode = oSettings.DataBindings.language_code,
                QuestionText = oSettings.Label + " " + oSettings.QuestionText
            };

            ctlFooter.InitializeFooter();
            ctlFooter.Dock = DockStyle.Fill;
            ctlFooter.Height = 20;
            this.lciFooter.Control = ctlFooter;
            this.lciFooter.ShowInCustomizationForm = false;
            this.lciFooter.TextVisible = false;
            this.lciFooter.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
            this.lciFooter.MinSize = new Size(0, 24);
            this.lciFooter.MaxSize = new Size(0, 24);
            this.lciFooter.Click += new EventHandler(layoutControlGroupQuestion1_Click);
            this.lciFooter.SizeConstraintsType = SizeConstraintsType.Custom;
            this.layoutControlGroupQuestion1.AddItem(this.lciFooter);
            #endregion

            IList<AnswerOption> answeroptionList = Questionnaire.Form.Settings.AnswerOptions;
            ISchedule answeroption = null;
            int iAnswerOptions = answeroptionList.Count;
            //System.Drawing.Size newSize;
            int idx = 0;
            ScheduleSalesPerson oSalesPerson;
            for (int x = 0; x < iAnswerOptions; ++x)
            {
                answeroption = answeroptionList[x] as ISchedule;

                LayoutControlItem lciScheduleDetails = new LayoutControlItem();
                this.lblScheduleDetails = new Label();
                this.lblScheduleDetails.Text = "";
                lciScheduleDetails.Control = this.lblScheduleDetails;
                lciScheduleDetails.TextVisible = false;
                this.layoutControlGroupQuestion1.AddItem(lciScheduleDetails);

                #region Sales Person
                // layoutControlItem1
                this.lciSalesPerson = new LayoutControlItem();
                //lookUpEdit1
                this.lookUpEdit1 = new LookUpEdit();
                this.lookUpEdit1.Name = "SalesPerson_lookUpEdit" + Guid.NewGuid().ToString();
                this.lookUpEdit1.Properties.NullText = "";
                //this.lookUpEdit1.Properties.DisplayMember = "Name";
                //this.lookUpEdit1.Properties.ValueMember = "Id";
                this.lookUpEdit1.Properties.DisplayMember = "resource_name";
                this.lookUpEdit1.Properties.ValueMember = "resource_id";
                //this.lookUpEdit1.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Name", "SalesPerson"));
                this.lookUpEdit1.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("resource_name", "SalesPerson"));
                this.lookUpEdit1.Properties.ShowFooter = false;
                this.lookUpEdit1.Properties.ShowHeader = false;
                this.lookUpEdit1.Properties.ReadOnly = true;
                this.lookUpEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;

                oSalesPerson = answeroption.ScheduleSalesPerson;
                if (oSalesPerson != null)
                {
                    if (oSalesPerson.SalesPersonSelectedValue != null)
                    {
                        this.lookUpEdit1.Properties.DataSource = new List<SalesPerson> { oSalesPerson.SalesPersonSelectedValue };
                        this.lookUpEdit1.EditValue = oSalesPerson.SalesPersonSelectedValue.Id;
                    }
                }

                this.lookUpEdit1.Tag = new ScheduleData()
                {
                    Name = "SalesPerson",
                    PositionIndex = "IndexPosition" + x,
                    ControlContainer = lciSalesPerson
                };
                this.lookUpEdit1.Size = new System.Drawing.Size(155, 20);
                this.lookUpEdit1.StyleController = this.StyleController;
                //this.lookUpEdit1.EditValueChanged += new EventHandler(lookUpEdit1_SelectedIndexChanged);
                this.lookUpEdit1.Click += new EventHandler(layoutControlGroupQuestion1_Click);

                // lciSalesPerson
                this.lciSalesPerson.Name = "layoutControlItem" + Guid.NewGuid().ToString();
                this.lciSalesPerson.Control = this.lookUpEdit1;
                if (oSalesPerson != null && !string.IsNullOrEmpty(oSalesPerson.TextPrefix))
                {
                    this.lciSalesPerson.Text = oSalesPerson.TextPrefix.Trim();

                }
                else
                {
                    this.lciSalesPerson.Text = "Sales Person:";
                }
                this.lciSalesPerson.TextLocation = DevExpress.Utils.Locations.Top;
                this.lciSalesPerson.TextSize = new System.Drawing.Size(108, 13);
                this.lciSalesPerson.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.lciSalesPerson.MaxSize = new System.Drawing.Size(160, 20);
                this.lciSalesPerson.MinSize = new System.Drawing.Size(160, 20);
                this.lciSalesPerson.Size = new System.Drawing.Size(50, 20);
                this.lciSalesPerson.ShowInCustomizationForm = false;
                this.lciSalesPerson.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                //this.layoutControlGroupQuestion1.AddItem(this.lciSalesPerson);

                #endregion

                #region Schedule Type
                // emptySpaceItem1
                this.emptySpaceItem1 = new EmptySpaceItem();
                this.emptySpaceItem1.Name = "emptySpaceItem" + Guid.NewGuid().ToString();
                this.emptySpaceItem1.Size = new System.Drawing.Size(25, 20);
                this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
                this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.emptySpaceItem1.MaxSize = new System.Drawing.Size(0, 20);
                this.emptySpaceItem1.MinSize = new System.Drawing.Size(0, 20);
                this.emptySpaceItem1.ShowInCustomizationForm = false;
                this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click);

                //
                // comboBoxEdit1
                this.lciScheduleType = new DevExpress.XtraLayout.LayoutControlItem();
                this.comboBoxEdit1 = new ComboBoxEdit();
                this.comboBoxEdit1.Tag = new ScheduleData()
                {
                    Name = "ScheduleType",
                    PositionIndex = "IndexPosition" + x,
                    ControlContainer = lciScheduleType
                };

                this.comboBoxEdit1.Size = new System.Drawing.Size(50, 20);
                this.comboBoxEdit1.Name = "ScheduleType_comboBoxEdit" + Guid.NewGuid().ToString();
                this.comboBoxEdit1.Properties.ReadOnly = true;
                this.comboBoxEdit1.StyleController = this.StyleController;
                this.comboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
                this.comboBoxEdit1.SelectedIndexChanged += new EventHandler(comboBoxEdit1_SelectedIndexChanged);
                this.comboBoxEdit1.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                if (answeroption.ScheduleType == null)
                {
                    answeroption.ScheduleType = new ScheduleType();
                }
                if (answeroption.ScheduleType.ScheduleTypeSelectedValue == null)
                {
                    answeroption.ScheduleType.ScheduleTypeSelectedValue = "";
                }
                answeroption.ScheduleType.ScheduleTypeValues = new List<string> { "Seminar", "Webinar", "Meeting" };

                answeroption.ScheduleType.ScheduleTypeValues.ForEach(delegate(string strValue)
                {
                    this.comboBoxEdit1.Properties.Items.Add(strValue);
                });

                // lciScheduleType
                this.lciScheduleType.Name = "layoutControlItem" + Guid.NewGuid().ToString();
                //this.layoutControlItem2.AppearanceItemCaption.Options.UseTextOptions = true;
                //this.layoutControlItem2.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
                this.lciScheduleType.Control = this.comboBoxEdit1;
                this.lciScheduleType.TextLocation = DevExpress.Utils.Locations.Top;
                this.lciScheduleType.TextSize = new System.Drawing.Size(60, 13);
                if (!string.IsNullOrEmpty(answeroption.ScheduleType.TextPrefix))
                {
                    this.lciScheduleType.Text = answeroption.ScheduleType.TextPrefix;
                }
                else
                {
                    this.lciScheduleType.Text = "Schedule Type:";
                }

                this.lciScheduleType.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.lciScheduleType.MaxSize = new System.Drawing.Size(160, 24);
                this.lciScheduleType.MinSize = new System.Drawing.Size(160, 24);
                this.lciScheduleType.Size = new System.Drawing.Size(160, 24);
                this.lciScheduleType.ShowInCustomizationForm = false;
                this.lciScheduleType.Click += new EventHandler(layoutControlGroupQuestion1_Click);

                this.lciSalesPerson.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
                this.lciScheduleType.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
                this.emptySpaceItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;

                this.layoutControlGroupQuestion1.AddItem(this.lciScheduleType);
                this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1, this.lciScheduleType, DevExpress.XtraLayout.Utils.InsertType.Right);
                this.layoutControlGroupQuestion1.AddItem(this.lciSalesPerson, this.emptySpaceItem1, DevExpress.XtraLayout.Utils.InsertType.Right);

                // emptySpaceItem1
                this.emptySpaceItem1 = new EmptySpaceItem();
                this.emptySpaceItem1.Name = "emptySpaceItem" + Guid.NewGuid().ToString();
                this.emptySpaceItem1.Size = new System.Drawing.Size(1, 15);
                this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
                this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.emptySpaceItem1.MaxSize = new System.Drawing.Size(0, 15);
                this.emptySpaceItem1.MinSize = new System.Drawing.Size(0, 15);
                this.emptySpaceItem1.ShowInCustomizationForm = false;
                this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                //this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1);
                #endregion

                #region List of Schedules Available
                // lciListOfSchedule
                this.lciListOfScheduleDropDown = new DevExpress.XtraLayout.LayoutControlItem();
                //lookUpEdit1
                this.lookUpEdit2 = new LookUpEdit();
                this.lookUpEdit2.Name = "lookUpEdit" + Guid.NewGuid().ToString();
                this.lookUpEdit2.Properties.NullText = "";
                this.lookUpEdit2.Properties.DisplayMember = "title";
                this.lookUpEdit2.Properties.ValueMember = "id";
                this.lookUpEdit2.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("title", "List of Bookings"));
                comboBoxEdit1_SelectedIndexChanged(this.comboBoxEdit1, null);
                this.lookUpEdit2.Properties.ShowFooter = true;
                this.lookUpEdit2.Properties.ShowHeader = false;
                this.lookUpEdit2.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;

                this.lookUpEdit2.Tag = new ScheduleData()
                {
                    Name = "ListOfBookingsAvailable",
                    PositionIndex = "IndexPosition" + x,
                    ControlContainer = lciListOfScheduleDropDown,
                    Required = answeroption.ListOfBookingsAvailableRequired,
                    HasValue = answeroption.ScheduleValue != null && !string.IsNullOrEmpty(answeroption.ScheduleValue.ScheduleId) ? true : false
                };
                this.lookUpEdit2.Size = new System.Drawing.Size(155, 20);
                this.lookUpEdit2.StyleController = this.StyleController;
                //load answer values
                if (answeroption.ScheduleType != null)
                {
                    if (answeroption.ScheduleValue != null)
                    {
                        if (!string.IsNullOrEmpty(answeroption.ScheduleValue.ScheduleId))
                        {
                            int schedid = int.Parse(answeroption.ScheduleValue.ScheduleId);

                            lookUpEdit2.EditValue = schedid;
                            //if (answeroption.ScheduleType.ScheduleTypeSelectedValue.ToLower() == "meeting") {
                            //    CreateMeeting.Enabled = true;
                            //}
                        }
                    }
                }
                //this.lookUpEdit2.EditValueChanged += new EventHandler(lookUpEdit2_EditValueChanged);
                this.lookUpEdit2.Click += new EventHandler(layoutControlGroupQuestion1_Click);

                this.comboBoxEdit1.EditValue = answeroption.ScheduleType.ScheduleTypeSelectedValue;

                // layoutControlItem1
                this.lciListOfScheduleDropDown.Name = "layoutControlItem" + Guid.NewGuid().ToString();
                this.lciListOfScheduleDropDown.Control = this.lookUpEdit2;

                if (!string.IsNullOrEmpty(answeroption.ListOfBookingsAvailableLabel))
                {
                    this.lciListOfScheduleDropDown.Text = answeroption.ListOfBookingsAvailableLabel.Trim();
                }
                else
                {
                    this.lciListOfScheduleDropDown.Text = "List of Schedules Available:";
                }
                this.lciListOfScheduleDropDown.TextLocation = DevExpress.Utils.Locations.Top;
                this.lciListOfScheduleDropDown.ShowInCustomizationForm = false;
                this.lciListOfScheduleDropDown.Click += new EventHandler(layoutControlGroupQuestion1_Click);

                this.lciListOfScheduleDropDown.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
                this.layoutControlGroupQuestion1.AddItem(this.lciListOfScheduleDropDown);
                //
                // simpleButton1
                //
                this.PreviewBooking = new SimpleButton();
                //this.PreviewBooking.Name = "PreviewDetails_simpleButton" + Guid.NewGuid().ToString();
                this.PreviewBooking.Name = "PreviewBooking";
                this.PreviewBooking.Size = new System.Drawing.Size(130, 22);
                this.PreviewBooking.StyleController = this.StyleController;
                if (!string.IsNullOrEmpty(answeroption.ViewDetailSummaryButtonLabel))
                    this.PreviewBooking.Text = answeroption.ViewDetailSummaryButtonLabel;
                else
                    this.PreviewBooking.Text = "Preview Details";

                this.PreviewBooking.Click += new EventHandler(viewDetailSummary_Click);
                this.PreviewBooking.Enabled = false;

                // lciListOfSchedulePreviewButton
                this.lciListOfSchedulePreviewButton = new LayoutControlItem();
                this.lciListOfSchedulePreviewButton.Name = "layoutControlItem" + Guid.NewGuid().ToString();
                this.lciListOfSchedulePreviewButton.Control = this.PreviewBooking;
                this.lciListOfSchedulePreviewButton.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.lciListOfSchedulePreviewButton.MaxSize = new System.Drawing.Size(100, 24);
                this.lciListOfSchedulePreviewButton.MinSize = new System.Drawing.Size(80, 24);
                this.lciListOfSchedulePreviewButton.Size = new System.Drawing.Size(80, 24);
                this.lciListOfSchedulePreviewButton.TextVisible = false;
                this.lciListOfSchedulePreviewButton.ShowInCustomizationForm = false;
                this.lciListOfSchedulePreviewButton.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                this.layoutControlGroupQuestion1.AddItem(this.lciListOfSchedulePreviewButton);

                //
                // simpleButton1
                //
                this.CreateMeeting = new SimpleButton();
                //this.CreateMeeting.Name = "CreateMeeting_simpleButton" + Guid.NewGuid().ToString();
                this.CreateMeeting.Name = "CreateMeeting";
                this.CreateMeeting.Size = new System.Drawing.Size(130, 22);
                this.CreateMeeting.StyleController = this.StyleController;
                if (!string.IsNullOrEmpty(answeroption.CreateMeetingButtonLabel))
                {
                    if (answeroption.CreateMeetingButtonLabel.Trim().ToLower() == "create meeting")
                    {
                        this.CreateMeeting.Text = "Create/Edit Meeting";
                    }
                    else
                    {
                        this.CreateMeeting.Text = answeroption.CreateMeetingButtonLabel;
                    }
                }
                else
                {
                    this.CreateMeeting.Text = "Create/Edit Meeting";
                }
                this.CreateMeeting.Click += new EventHandler(createMeeting_Click);
                this.CreateMeeting.Enabled = false;

                // layoutControlItem1
                this.lciListOfScheduleCreateEditButton = new LayoutControlItem();
                if (answeroption.ScheduleType != null && answeroption.ScheduleType.ScheduleTypeSelectedValue == "Meeting")
                {
                    //lookUpEdit2.Properties.ReadOnly = true;
                    this.CreateMeeting.Tag = "HasMeeting";
                }
                else
                    this.lciListOfScheduleCreateEditButton.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                //this.lciListOfScheduleCreateEditButton.Name = "layoutControlItem" + Guid.NewGuid().ToString();
                this.lciListOfScheduleCreateEditButton.Name = "lciListOfScheduleCreateEditButton";
                this.lciListOfScheduleCreateEditButton.Control = this.CreateMeeting;
                this.lciListOfScheduleCreateEditButton.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.lciListOfScheduleCreateEditButton.MaxSize = new System.Drawing.Size(115, 24);
                this.lciListOfScheduleCreateEditButton.MinSize = new System.Drawing.Size(115, 24);
                this.lciListOfScheduleCreateEditButton.Size = new System.Drawing.Size(115, 24);
                this.lciListOfScheduleCreateEditButton.TextVisible = false;
                this.lciListOfScheduleCreateEditButton.ShowInCustomizationForm = false;
                this.lciListOfScheduleCreateEditButton.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                this.layoutControlGroupQuestion1.AddItem(this.lciListOfScheduleCreateEditButton, this.lciListOfSchedulePreviewButton, DevExpress.XtraLayout.Utils.InsertType.Right);
                //
                // simpleButton1
                //
                this.DeleteMeeting = new SimpleButton();
                //this.DeleteMeeting.Name = "DeleteMeeting_simpleButton" + Guid.NewGuid().ToString();
                this.DeleteMeeting.Name = "DeleteMeeting";
                this.DeleteMeeting.Size = new System.Drawing.Size(130, 22);
                this.DeleteMeeting.StyleController = this.StyleController;
                this.DeleteMeeting.Text = "Delete Meeting";
                this.DeleteMeeting.Click += new EventHandler(deleteMeeting_Click);
                this.DeleteMeeting.Enabled = false;

                // lciListOfScheduleDeleteButton
                this.lciListOfScheduleDeleteButton = new LayoutControlItem();
                if (answeroption.ScheduleType != null && answeroption.ScheduleType.ScheduleTypeSelectedValue == "Meeting")
                {
                    this.DeleteMeeting.Tag = "HasMeeting";
                    //lookUpEdit2.Properties.ReadOnly = true;
                    var lueData = lookUpEdit2.Tag as ScheduleData;
                    lueData.IsMeeting = true;
                }
                else
                    this.lciListOfScheduleDeleteButton.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                this.lciListOfScheduleDeleteButton.Name = "layoutControlItem" + Guid.NewGuid().ToString();
                this.lciListOfScheduleDeleteButton.Control = this.DeleteMeeting;
                this.lciListOfScheduleDeleteButton.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.lciListOfScheduleDeleteButton.MaxSize = new System.Drawing.Size(100, 24);
                this.lciListOfScheduleDeleteButton.MinSize = new System.Drawing.Size(80, 24);
                this.lciListOfScheduleDeleteButton.Size = new System.Drawing.Size(80, 24);
                this.lciListOfScheduleDeleteButton.TextVisible = false;
                this.lciListOfScheduleDeleteButton.ShowInCustomizationForm = false;
                this.lciListOfScheduleDeleteButton.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                this.layoutControlGroupQuestion1.AddItem(this.lciListOfScheduleDeleteButton, this.lciListOfScheduleCreateEditButton, DevExpress.XtraLayout.Utils.InsertType.Right);

                ////load answer values
                //if (answeroption.ScheduleType != null) {
                //    if (answeroption.ScheduleValue != null) {
                //        if (!string.IsNullOrEmpty(answeroption.ScheduleValue.ScheduleId)) {
                //            int schedid = int.Parse(answeroption.ScheduleValue.ScheduleId);

                //            lookUpEdit2.EditValue = schedid;
                //            //if (answeroption.ScheduleType.ScheduleTypeSelectedValue.ToLower() == "meeting") {
                //            //    CreateMeeting.Enabled = true;
                //            //}
                //        }
                //    }
                //}

                // emptySpaceItem1
                this.emptySpaceItem1 = new EmptySpaceItem();
                this.emptySpaceItem1.Name = "emptySpaceItem" + Guid.NewGuid().ToString();
                this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.emptySpaceItem1.MaxSize = new System.Drawing.Size(0, 20);
                this.emptySpaceItem1.MinSize = new System.Drawing.Size(0, 20);
                this.emptySpaceItem1.Size = new System.Drawing.Size(200, 20);
                this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
                this.emptySpaceItem1.ShowInCustomizationForm = false;
                this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1, this.lciListOfScheduleDeleteButton, DevExpress.XtraLayout.Utils.InsertType.Right);
                #endregion

                #region Customer Attendies

                #region Grid
                simpleLabelItemValidation = new SimpleLabelItem();
                simpleLabelItemValidation.AppearanceItemCaption.BackColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
                simpleLabelItemValidation.Name = Guid.NewGuid().ToString();
                simpleLabelItemValidation.TextAlignMode = TextAlignModeItem.CustomSize;
                simpleLabelItemValidation.TextSize = new Size(212, 20);
                simpleLabelItemValidation.Text = "  Please add at least one contact attendie.";
                simpleLabelItemValidation.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                this.layoutControlGroupQuestion1.AddItem(simpleLabelItemValidation);

                //create our gridcontrol
                //
                // gridColumn1
                //
                this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn();
                this.gridColumn1.Caption = "Name";
                this.gridColumn1.FieldName = "Name";
                this.gridColumn1.Name = "gridColumn" + Guid.NewGuid().ToString();
                this.gridColumn1.Visible = true;
                this.gridColumn1.OptionsColumn.AllowEdit = false;
                this.gridColumn1.VisibleIndex = 0;
                this.gridColumn1.Width = 66;
                //
                // gridColumn2
                //
                this.gridColumn2 = new DevExpress.XtraGrid.Columns.GridColumn();
                this.gridColumn2.Caption = "Address";
                this.gridColumn2.FieldName = "Address";
                this.gridColumn2.Name = "gridColumn" + Guid.NewGuid().ToString();
                this.gridColumn2.Visible = true;
                this.gridColumn2.OptionsColumn.AllowEdit = false;
                this.gridColumn2.VisibleIndex = 1;
                this.gridColumn2.Width = 66;
                //
                // gridColumn3
                //
                //this.gridColumn3 = new DevExpress.XtraGrid.Columns.GridColumn();
                //this.gridColumn3.Caption = "City";
                //this.gridColumn3.FieldName = "City";
                //this.gridColumn3.Name = "gridColumn" + Guid.NewGuid().ToString();
                //this.gridColumn3.Visible = true;
                //this.gridColumn3.OptionsColumn.AllowEdit = false;
                //this.gridColumn3.VisibleIndex = 2;
                //this.gridColumn3.Width = 66;
                //
                // gridColumn4
                //
                this.gridColumn4 = new DevExpress.XtraGrid.Columns.GridColumn();
                this.gridColumn4.Caption = "Telephone";
                this.gridColumn4.FieldName = "Telephone";
                this.gridColumn4.Name = "gridColumn" + Guid.NewGuid().ToString();
                this.gridColumn4.Visible = true;
                this.gridColumn4.OptionsColumn.AllowEdit = false;
                this.gridColumn4.VisibleIndex = 3;
                this.gridColumn4.Width = 66;
                //
                // gridColumn5
                //
                this.gridColumn5 = new DevExpress.XtraGrid.Columns.GridColumn();
                this.gridColumn5.Caption = "Email";
                this.gridColumn5.FieldName = "Email";
                this.gridColumn5.Name = "gridColumn" + Guid.NewGuid().ToString();
                this.gridColumn5.Visible = true;
                this.gridColumn5.OptionsColumn.AllowEdit = false;
                this.gridColumn5.VisibleIndex = 4;
                this.gridColumn5.Width = 70;
                //
                // gridColumn6
                //
                this.gridColumn6 = new DevExpress.XtraGrid.Columns.GridColumn();
                this.gridColumn6.Caption = "AccountID";
                this.gridColumn6.FieldName = "AccountID";
                this.gridColumn6.Name = "gridColumn" + Guid.NewGuid().ToString();
                this.gridColumn6.Visible = false;
                //
                // gridColumn7
                //
                this.gridColumn7 = new DevExpress.XtraGrid.Columns.GridColumn();
                this.gridColumn7.Caption = "ContactID";
                this.gridColumn7.FieldName = "ContactID";
                this.gridColumn7.Name = "gridColumn" + Guid.NewGuid().ToString();
                this.gridColumn7.Visible = false;

                //
                // gridView1
                //
                this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
                this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
                this.gridColumn1,
                this.gridColumn2,
                //this.gridColumn3,
                this.gridColumn4,
                this.gridColumn5,
                this.gridColumn6,
                this.gridColumn7});
                this.gridView1.GridControl = this.gridControl1;
                this.gridView1.Name = "gridView" + Guid.NewGuid().ToString();
                this.gridView1.OptionsFind.AlwaysVisible = false;
                this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
                this.gridView1.OptionsSelection.MultiSelect = true;
                this.gridView1.OptionsView.ShowGroupPanel = false;
                this.gridView1.OptionsView.ColumnAutoWidth = true;
                this.gridView1.DataSourceChanged += new EventHandler(gridView1_DataSourceChanged);
                //
                // gridControl1
                //
                this.gridControl1 = new DevExpress.XtraGrid.GridControl();
                this.gridControl1.LookAndFeel.UseDefaultLookAndFeel = false;
                this.gridControl1.MainView = this.gridView1;
                this.gridControl1.Name = "gridControl" + Guid.NewGuid().ToString();
                this.gridControl1.Size = new System.Drawing.Size(150, 74);
                this.gridControl1.TabIndex = 11;
                this.gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
                this.gridView1});
                SetCurrentAttendies();
                var schedData = new ScheduleData()
                {
                    Required = answeroption.AttendiesRequired
                };
                if (gridView1.GridControl.DataSource != null)
                {
                    List<ContactAttendie> gvDs = gridView1.GridControl.DataSource as List<ContactAttendie>;
                    if (gvDs != null && gvDs.Count > 0)
                        schedData.HasValue = true;
                }
                this.gridView1.Tag = schedData;
                //
                // lciGridControl
                //
                this.lciGridControl = new LayoutControlItem();
                this.lciGridControl.Control = this.gridControl1;
                this.lciGridControl.Name = "layoutControlItem" + Guid.NewGuid().ToString();
                if (!string.IsNullOrEmpty(answeroption.AttendiesLabel))
                    this.lciGridControl.Text = answeroption.AttendiesLabel;
                else
                    this.lciGridControl.Text = "Attendies:";
                this.lciGridControl.TextLocation = DevExpress.Utils.Locations.Top;
                this.lciGridControl.TextSize = new System.Drawing.Size(108, 13);
                this.lciGridControl.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.lciGridControl.MaxSize = new System.Drawing.Size(0, 90);
                this.lciGridControl.MinSize = new System.Drawing.Size(0, 90);
                this.lciGridControl.Size = new System.Drawing.Size(200, 90);
                this.lciGridControl.ShowInCustomizationForm = false;
                this.layoutControlGroupQuestion1.AddItem(this.lciGridControl);
                #endregion

                //
                // simpleButton1
                //
                this.simpleButton1 = new SimpleButton();
                this.simpleButton1.Name = "simpleButton" + Guid.NewGuid().ToString();
                this.simpleButton1.Size = new System.Drawing.Size(130, 22);
                this.simpleButton1.StyleController = this.StyleController;
                this.simpleButton1.Enabled = false;
                if (!string.IsNullOrEmpty(answeroption.AddCallerButtonLabel))
                    this.simpleButton1.Text = answeroption.AddCallerButtonLabel;
                else
                    this.simpleButton1.Text = "Add Caller";
                this.simpleButton1.Click += new EventHandler(AddCaller_Click);

                // lciAddCaller
                this.lciAddCaller = new LayoutControlItem();
                this.lciAddCaller.Name = "layoutControlItem" + Guid.NewGuid().ToString();
                this.lciAddCaller.Control = this.simpleButton1;
                this.lciAddCaller.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.lciAddCaller.MaxSize = new System.Drawing.Size(80, 24);
                this.lciAddCaller.MinSize = new System.Drawing.Size(80, 24);
                this.lciAddCaller.Size = new System.Drawing.Size(80, 24);
                this.lciAddCaller.TextVisible = false;
                this.lciAddCaller.ShowInCustomizationForm = false;
                this.lciAddCaller.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                this.layoutControlGroupQuestion1.AddItem(this.lciAddCaller);

                //
                // simpleButton2
                //
                this.simpleButton2 = new SimpleButton();
                this.simpleButton2.Name = "simpleButton" + Guid.NewGuid().ToString();
                this.simpleButton2.Size = new System.Drawing.Size(130, 22);
                this.simpleButton2.StyleController = this.StyleController;
                this.simpleButton2.Enabled = false;
                if (!string.IsNullOrEmpty(answeroption.AddAdditionalAttendieButtonLabel))
                    this.simpleButton2.Text = answeroption.AddAdditionalAttendieButtonLabel;
                else
                    this.simpleButton2.Text = "Add Additional";
                this.simpleButton2.Click += new EventHandler(AddAdditional_Click);

                // layoutControlItem1
                this.lciAddAdditional = new LayoutControlItem();
                this.lciAddAdditional.Name = "layoutControlItem" + Guid.NewGuid().ToString();
                this.lciAddAdditional.Control = this.simpleButton2;
                this.lciAddAdditional.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.lciAddAdditional.MaxSize = new System.Drawing.Size(100, 24);
                this.lciAddAdditional.MinSize = new System.Drawing.Size(80, 24);
                this.lciAddAdditional.Size = new System.Drawing.Size(80, 24);
                this.lciAddAdditional.TextVisible = false;
                this.lciAddAdditional.ShowInCustomizationForm = false;
                this.lciAddAdditional.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                this.layoutControlGroupQuestion1.AddItem(this.lciAddAdditional, this.lciAddCaller, DevExpress.XtraLayout.Utils.InsertType.Right);

                //
                // simpleButton3
                //
                this.simpleButton3 = new SimpleButton();
                this.simpleButton3.Name = "simpleButton" + Guid.NewGuid().ToString();
                this.simpleButton3.Size = new System.Drawing.Size(130, 22);
                this.simpleButton3.StyleController = this.StyleController;
                this.simpleButton3.Enabled = false;
                if (!string.IsNullOrEmpty(answeroption.DeleteAttendieButtonLabel))
                    this.simpleButton3.Text = answeroption.DeleteAttendieButtonLabel;
                else
                    this.simpleButton3.Text = "Delete";
                this.simpleButton3.Click += new EventHandler(DeleteAttendie_Click);

                // layoutControlItem2
                this.lciDeleteCaller = new LayoutControlItem();
                this.lciDeleteCaller.Name = "layoutControlItem" + Guid.NewGuid().ToString();
                this.lciDeleteCaller.Control = this.simpleButton3;
                this.lciDeleteCaller.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.lciDeleteCaller.MaxSize = new System.Drawing.Size(70, 24);
                this.lciDeleteCaller.MinSize = new System.Drawing.Size(70, 24);
                this.lciDeleteCaller.Size = new System.Drawing.Size(70, 24);
                this.lciDeleteCaller.TextVisible = false;
                this.lciDeleteCaller.ShowInCustomizationForm = false;
                this.lciDeleteCaller.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                this.layoutControlGroupQuestion1.AddItem(this.lciDeleteCaller, this.lciAddAdditional, DevExpress.XtraLayout.Utils.InsertType.Right);

                // emptySpaceItem1
                this.emptySpaceItem1 = new EmptySpaceItem();
                this.emptySpaceItem1.Name = "emptySpaceItem" + Guid.NewGuid().ToString();
                this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
                this.emptySpaceItem1.MaxSize = new System.Drawing.Size(0, 20);
                this.emptySpaceItem1.MinSize = new System.Drawing.Size(0, 20);
                this.emptySpaceItem1.Size = new System.Drawing.Size(200, 20);
                this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
                this.emptySpaceItem1.ShowInCustomizationForm = false;
                this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1, this.lciDeleteCaller, DevExpress.XtraLayout.Utils.InsertType.Right);

                #endregion

                #region Other Choices
                idx = 0;
                //EmptySpaceItem esitem = new EmptySpaceItem();
                //esitem.Size = new Size(100, 20);
                //this.layoutControlGroupQuestion1.AddItem(esitem);
                foreach (OtherChoice oChoice in answeroption.OtherChoices)
                {
                    if (oChoice.Enabled)
                    {
                        //if (!string.IsNullOrEmpty(oChoice.TextPrefix)) {
                        //    // simpleLabelItem1
                        //    this.simpleLabelItem1 = new DevExpress.XtraLayout.SimpleLabelItem();

                        //    this.simpleLabelItem1.Name = "simpleLabelItem" + Guid.NewGuid().ToString();
                        //    //this.simpleLabelItem1.ShowInCustomizationForm = false;
                        //    //this.simpleLabelItem1.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
                        //    this.simpleLabelItem1.Text = oChoice.TextPrefix;
                        //    //newSize = new System.Drawing.Size(100, 20);
                        //    newSize = new System.Drawing.Size(20, 20);
                        //    this.simpleLabelItem1.SizeConstraintsType = SizeConstraintsType.Custom;
                        //    this.simpleLabelItem1.MaxSize = newSize;
                        //    this.simpleLabelItem1.MinSize = newSize;
                        //    this.simpleLabelItem1.Size = newSize;
                        //    this.simpleLabelItem1.AppearanceItemCaption.BackColor = System.Drawing.Color.Transparent;
                        //    this.simpleLabelItem1.ShowInCustomizationForm = false;
                        //    this.simpleLabelItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                        //    this.layoutControlGroupQuestion1.AddItem(this.simpleLabelItem1);
                        //} else {
                        //    this.simpleLabelItem1 = null;
                        //}
                        // layoutControlItem1
                        this.lciOtherChoice = new LayoutControlItem();
                        //add textEdit1 to layout
                        this.memoEdit1 = new MemoEdit();
                        this.memoEdit1.Tag = new ScheduleData()
                        {
                            ParentPositionIndex = "IndexPosition" + x.ToString(),
                            PositionIndex = "IndexPosition" + idx.ToString(),
                            ControlContainer = lciOtherChoice,
                            Required = oChoice.Required,
                            HasValue = !string.IsNullOrWhiteSpace(oChoice.DefaultInputValue) ? true : false,
                            ChoiceOption = oChoice
                        };
                        this.memoEdit1.Name = "textEdit" + Guid.NewGuid().ToString();
                        this.memoEdit1.Properties.ScrollBars = System.Windows.Forms.ScrollBars.None;
                        this.memoEdit1.StyleController = this.StyleController;
                        if (oChoice.DefaultInputValue != null)
                        {
                            this.memoEdit1.Text = oChoice.DefaultInputValue.Trim();
                            oChoice.InputValue = oChoice.DefaultInputValue.Trim();
                        }
                        memoEdit1.TextChanged += new EventHandler(memoEdit1_TextChanged);
                        memoEdit1.Resize += new EventHandler(memoEdit1_Resize);
                        memoEdit1.Click += new EventHandler(layoutControlGroupQuestion1_Click);

                        this.lciOtherChoice.Name = "layoutControlItem" + Guid.NewGuid().ToString();
                        this.lciOtherChoice.Control = this.memoEdit1;

                        if (!string.IsNullOrEmpty(oChoice.TextPrefix))
                        {
                            this.lciOtherChoice.Text = oChoice.TextPrefix;
                            this.lciOtherChoice.TextVisible = true;
                            this.lciOtherChoice.TextLocation = DevExpress.Utils.Locations.Top;
                            this.lciOtherChoice.MaxSize = new Size(0, 41);
                            this.lciOtherChoice.MinSize = new Size(0, 41);
                        }
                        else
                        {
                            this.lciOtherChoice.TextVisible = false;
                            this.lciOtherChoice.MaxSize = new Size(0, 24);
                            this.lciOtherChoice.MinSize = new Size(0, 24);
                        }
                        this.lciOtherChoice.SizeConstraintsType = SizeConstraintsType.Custom;
                        this.lciOtherChoice.Click += new EventHandler(layoutControlGroupQuestion1_Click);
                        this.lciOtherChoice.ShowInCustomizationForm = false;
                        this.layoutControlGroupQuestion1.AddItem(this.lciOtherChoice);
                        idx++;
                    }
                }
                #endregion

            }

            #region Footer
            //string prioText = oSettings.Priority;
            //if (oSettings.CustomerOwnership && oSettings.BVOwnership) {
            //    prioText += "(Cust+BV)";
            //} else if (oSettings.CustomerOwnership) {
            //    prioText += "(Cust)";
            //} else if (oSettings.BVOwnership) {
            //    prioText += "(BV)";
            //}
            //if (oSettings.PlotDoneStatus.Trim().ToLower() == "done") {
            //    prioText += " Done";
            //}

            //// simpleLabelItem1 status
            //this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
            //this.emptySpaceItem1.Name = "simpleLabelItem" + Guid.NewGuid().ToString();
            //this.emptySpaceItem1.AppearanceItemCaption.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);
            //this.emptySpaceItem1.AppearanceItemCaption.Options.UseTextOptions = true;
            //this.emptySpaceItem1.ShowInCustomizationForm = false;
            //this.emptySpaceItem1.SizeConstraintsType = SizeConstraintsType.Custom;
            //this.emptySpaceItem1.Text = prioText;
            //this.emptySpaceItem1.TextVisible = true;
            //this.emptySpaceItem1.ShowInCustomizationForm = false;
            //this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click);
            //this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1);

            //if (!string.IsNullOrEmpty(oSettings.QuestionHelp)) {
            //    this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem();
            //    this.emptySpaceItem2.Name = "simpleLabelItem" + Guid.NewGuid().ToString();
            //    this.emptySpaceItem2.AppearanceItemCaption.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);
            //    this.emptySpaceItem2.AppearanceItemCaption.Options.UseTextOptions = true;
            //    this.emptySpaceItem2.ShowInCustomizationForm = false;
            //    this.emptySpaceItem2.Text = "Help";
            //    this.emptySpaceItem2.OptionsToolTip.ToolTip = oSettings.QuestionHelp.Trim();

            //    //apply tooltip controller from parent
            //    //if (this.ToolTipController != null && this.ToolTipController.DefaultController != null) {
            //    //    this.emptySpaceItem2.OptionsToolTip.ToolTipController = ToolTipController.DefaultController;
            //    //}

            //    this.emptySpaceItem2.TextVisible = true;
            //    this.emptySpaceItem2.Size = new Size(50, 20);
            //    this.emptySpaceItem2.MaxSize = new Size(50, 20);
            //    this.emptySpaceItem2.MinSize = new Size(50, 20);
            //    this.emptySpaceItem2.SizeConstraintsType = SizeConstraintsType.Custom;
            //    this.emptySpaceItem2.ShowInCustomizationForm = false;
            //    this.emptySpaceItem2.Click += new EventHandler(layoutControlGroupQuestion1_Click);
            //    this.emptySpaceItem2.AppearanceItemCaption.TextOptions.HAlignment = HorzAlignment.Far;
            //    this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem2, this.emptySpaceItem1, DevExpress.XtraLayout.Utils.InsertType.Right);
            //}
            #endregion

            this.layoutControlGroupQuestion1.Click += new EventHandler(layoutControlGroupQuestion1_Click);
            this.layoutControlGroupQuestion1.EndUpdate();
            Image bg = BGImage(this);
            if (bg != null)
            {
                this.layoutControlGroupQuestion1.BackgroundImage = bg;
                this.layoutControlGroupQuestion1.BackgroundImageVisible = true;
            }
            if (this.memoEdit1 != null)
                BackColor = this.memoEdit1.BackColor;

            //lookUpEdit2.EditValue = null;
            //lookUpEdit2.ItemIndex = 0;

            this.ControlGroup = this.layoutControlGroupQuestion1;
            this.ControlGroup.Tag = this;
            isLoaded = true;
        }
Exemplo n.º 37
0
    // create an entry that begins at the given time between two key points. return the time the next entry should begin at.
    private int build_schedule_part(int start_min, KeyPoint from, KeyPoint to, ref ScheduleData schedule_data, string map_id, TileMapScript map_data)
    {
        var from_point = map_data.get_key_point(from);
        var to_point = map_data.get_key_point(to);

        // get the path between the two points
        var path = world_generator.get_path(from_point, to_point, map_data.get_raw_data(), false);

        // make sure that a path exists first (if not there's a bug somewhere. this shouldn't happen because world gen ensures a path exists.)
        if (path.Count == 0) {
            Debug.Log(string.Format("Can't make entry in {4} from ({0}, {1}) to ({2},{3})",
                from_point[0], from_point[1], to_point[0], to_point[1], map_id));
            map_data.print_map();
            return -1;
        }

        var path_length = path.Count - 1;
        var MERCHANT_MIN_PER_TILE = 1.0f;

        // the time to be at the destination is proportional to the length of the path times the merchant's speed
        // it's set so that it gives the perfect amount of time for the merchant to get there on time
        int finish_time = start_min + (int) (MERCHANT_MIN_PER_TILE * path_length);

        schedule_data.insertEntry(create_schedule_entry(start_min, map_id, from_point[0], from_point[1]));
        schedule_data.insertEntry(create_schedule_entry(finish_time, map_id, to_point[0], to_point[1]));

        // return the next time to create an entry at, which is WAITING_TIME more than the finish time, because the merchant waits at the spot for WAITING_TIME
        var WAITING_TIME_IN_MIN = 25;
        finish_time += WAITING_TIME_IN_MIN;
        return finish_time;
    }
Exemplo n.º 38
0
    /**
    Method creates the schedule and stores it on disk
    */
    public void generate_schedule()
    {
        var timer = System.Diagnostics.Stopwatch.StartNew();

        // get the map data to use to build the schedule

        var red_map = gameObject.AddComponent<TileMapScript>();
        red_map.loadMap("red_overworld_map_data.bin");

        var blue_map = gameObject.AddComponent<TileMapScript>();
        blue_map.loadMap("blue_overworld_map_data.bin");

        var green_map = gameObject.AddComponent<TileMapScript>();
        green_map.loadMap("green_overworld_map_data.bin");

        var purple_map = gameObject.AddComponent<TileMapScript>();
        purple_map.loadMap("purple_overworld_map_data.bin");

        var yellow_map = gameObject.AddComponent<TileMapScript>();
        yellow_map.loadMap("yellow_overworld_map_data.bin");

        var schedule_data = new ScheduleData();

        // build the schedule by creating its parts. the variable next_time stores the time for the next part to begin at.

        var next_time = build_schedule_part(0, KeyPoint.PORTAL_ENTRANCE, KeyPoint.TOWN_1, ref schedule_data, "red", red_map);
        next_time = build_schedule_part(next_time, KeyPoint.TOWN_1, KeyPoint.TOWN_2, ref schedule_data, "red", red_map);
        next_time = build_schedule_part(next_time, KeyPoint.TOWN_2, KeyPoint.TOWN_3, ref schedule_data, "red", red_map);

        next_time = build_schedule_part(next_time, KeyPoint.PORTAL_ENTRANCE, KeyPoint.TOWN_1, ref schedule_data, "blue", blue_map);
        next_time = build_schedule_part(next_time, KeyPoint.TOWN_1, KeyPoint.TOWN_2, ref schedule_data, "blue", blue_map);
        next_time = build_schedule_part(next_time, KeyPoint.TOWN_2, KeyPoint.TOWN_3, ref schedule_data, "blue", blue_map);

        next_time = build_schedule_part(next_time, KeyPoint.PORTAL_ENTRANCE, KeyPoint.TOWN_1, ref schedule_data, "green", green_map);
        next_time = build_schedule_part(next_time, KeyPoint.TOWN_1, KeyPoint.TOWN_2, ref schedule_data, "green", green_map);
        next_time = build_schedule_part(next_time, KeyPoint.TOWN_2, KeyPoint.TOWN_3, ref schedule_data, "green", green_map);

        next_time = build_schedule_part(next_time, KeyPoint.PORTAL_ENTRANCE, KeyPoint.TOWN_1, ref schedule_data, "purple", purple_map);
        next_time = build_schedule_part(next_time, KeyPoint.TOWN_1, KeyPoint.TOWN_2, ref schedule_data, "purple", purple_map);
        next_time = build_schedule_part(next_time, KeyPoint.TOWN_2, KeyPoint.TOWN_3, ref schedule_data, "purple", purple_map);

        next_time = build_schedule_part(next_time, KeyPoint.PORTAL_ENTRANCE, KeyPoint.TOWN_1, ref schedule_data, "yellow", yellow_map);
        next_time = build_schedule_part(next_time, KeyPoint.TOWN_1, KeyPoint.TOWN_2, ref schedule_data, "yellow", yellow_map);
        next_time = build_schedule_part(next_time, KeyPoint.TOWN_2, KeyPoint.TOWN_3, ref schedule_data, "yellow", yellow_map);

        var end_point = yellow_map.get_key_point(KeyPoint.TOWN_3);
        schedule_data.insertEntry(create_schedule_entry(next_time, "yellow", end_point[0], end_point[1]));

        // add padding to make it get to 24 hours

        var padding_amount = ((24 * 60) - (next_time)) / 15;
        schedule_data.addPadding(padding_amount);

        schedule_data.saveToDisk("schedule_data.bin");

        #if UNITY_EDITOR
        File.WriteAllText(".\\Assets\\Resources\\schedule_data.txt", schedule_data.ToString());
        #endif

        Debug.Log(string.Format("Time to generate schedule: {0} ms", timer.ElapsedMilliseconds));
        Debug.Log(schedule_data.ToString());
    }