示例#1
0
 public void SetCurrentCaller(CTScSubCampaignContactList ca, int account_id)
 {
     m_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
     };
 }
示例#2
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);
        }