Ejemplo n.º 1
0
        private void btnEditFollowUpDetails_Click(object sender, EventArgs e)
        {
            if (EventId < 1)
            {
                NotificationDialog.Error("Bright Sales", "No editable data is available.");
                return;
            }

            m_EventBus.Notify(new FollowUpBarEvents.GetCampaignBookingArgs() {
                ForWorkModePurpose = false
            });

            //CampaignBookingProperty.CampaignBoookingArguments _args = GetCampaignBookingArgs(false);
            if (m_BrightSalesProperty.EventsProperty.CampaignBookingArgs == null || m_BrightSalesProperty.EventsProperty.CampaignBookingArgs.oAppointment == null)
                return;

            WaitDialog.Show("Loading Data ...");
            #region Initialize Editor
            m_Editor = new FollowUpEditor() {
                Dock = DockStyle.Fill,
                IsNurtureEvent = false
            };
            m_Editor.btnSave_OnClick += new FollowUpEditor.btnSaveOnClickEventHandler(m_Editor_btnSave_OnClick);
            m_dlgEditor = new PopupDialog() {
                FormBorderStyle = FormBorderStyle.FixedSingle,
                MinimizeBox = false,
                MaximizeBox = false,
                StartPosition = FormStartPosition.CenterScreen,
                Text = "Edit Current Follow Up",
                ClientSize = new Size(m_Editor.Width + 2, m_Editor.Height + 2),
                CloseBox = false
            };
            m_dlgEditor.Controls.Add(m_Editor);
            #endregion

            CampaignBookingProperty.CampaignBoookingArguments _args = m_BrightSalesProperty.EventsProperty.CampaignBookingArgs;
            //bool IsDeActivated = false;
            int _FinalListId;
            event_followup_log _data;
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                _data = _efDbContext.event_followup_log.FirstOrDefault(i => i.id == _args.Id);
                _FinalListId = (int)_efDbContext.final_lists.FirstOrDefault(i => i.sub_campaign_id == _data.subcampaign_id).id;
                _efDbContext.Detach(_data);

                /*
                 * https://brightvision.jira.com/browse/PLATFORM-3070
                 * DAN: Inrelated to fixing the issue as must not be able to edit when account is already deactivated.
                 */
                sub_campaign_account_lists _eftSubCampaignAccount = _efDbContext.sub_campaign_account_lists.FirstOrDefault(p =>
                   p.account_id == _data.account_id &&
                   p.final_list_id == _FinalListId &&
                   p.active == true
                );

                if (_eftSubCampaignAccount == null) {
                    NotificationDialog.Warning("Bright Sales", "This account has been de-activated");
                    WaitDialog.Close();
                    return;
                }

                _efDbContext.Detach(_eftSubCampaignAccount);

                //if (_eftSubCampaignAccount != null)
                //    _efDbContext.Detach(_eftSubCampaignAccount);
                //else
                //    IsDeActivated = true;
            }

            //if (IsDeActivated)
            //{
            //    NotificationDialog.Warning("Bright Sales", "This account has been de-activated");
            //    //return;
            //}

            if (_data.event_type.Equals("Nurture Event"))
                m_Editor.IsNurtureEvent = true;

            m_Editor.SubCampaignId = _args.oAppointment.SubCampaignId;
            m_Editor.AccountId = _args.oAppointment.AccountId;
            m_Editor.Prepare();

            if (!_data.event_type.Equals("Nurture Event")) {
                m_Editor.GetEventTypes(0, _data.event_type);
                m_Editor.LoadSalesUsers((int)_data.subcampaign_id, (int)((_data.assigned_user != null)?_data.assigned_user:0));
                m_Editor.SetCampaignInfo(_args);
                m_ContactList = ObjectSubCampaign.GetSubCampaignContacts(_args.oAppointment.SubCampaignId, _args.oAppointment.AccountId, _args.oAppointment.FinalListId);
            }
            else {
                m_Editor.GetEventTypes((int)_data.source_sub_campaign_id);
                m_Editor.SetSelectedEventType((int)_data.subcampaign_id);
                m_Editor.LoadSalesUsers((int)_data.subcampaign_id, (int)_data.assigned_user);
                m_Editor.SetCampaignInfo(_data);
                m_ContactList = ObjectSubCampaign.GetSubCampaignContacts((int)_data.subcampaign_id, (int)_data.account_id, _FinalListId);
            }

            if (m_ContactList.Count > 0) {
                m_Editor.LoadContactPersons(m_ContactList);
                CTScSubCampaignContactList _contact = m_ContactList.Find(i => i.id == (int)_data.contact_id);
                if (_contact != null) {
                    m_Editor.ContactPerson = _contact;
                    m_Editor.LoadSelectedContact(false);
                }
            }

            WaitDialog.Close();
            m_dlgEditor.ShowDialog(this);
        }
Ejemplo n.º 2
0
        public FrmSalesConsultant()
        {
            InitializeComponent();

            #region Background Thread for Event Logging
            nextRefreshTime = DateTime.Now;
            refreshInterval = TimeSpan.FromSeconds(0.20);

            stats = new int[6];

            work = new WorkQueue();
            work.ConcurrentLimit = 100;
            work.AllWorkCompleted += new EventHandler(work_AllWorkCompleted);
            work.WorkerException += new ResourceExceptionEventHandler(work_WorkerException);
            work.ChangedWorkItemState += new ChangedWorkItemStateEventHandler(work_ChangedWorkItemState);

            minThreads = ((WorkThreadPool)work.WorkerPool).MinThreads;
            maxThreads = ((WorkThreadPool)work.WorkerPool).MaxThreads;
            concurrentLimit = work.ConcurrentLimit;
            #endregion
            #region Toggle Bar Menu
            m_oCallViewBar = new CallViewBar() {
                Dock = DockStyle.Fill
            };

            m_oCallLogBar = new CallLogBar() {
                Dock = DockStyle.Fill,
                Visible = false
            };

            pnlToggleBar.Controls.Clear();
            pnlToggleBar.Controls.AddRange(new Control[] { m_oCallViewBar, m_oCallLogBar });
            #endregion
            #region Follow Up Popup Window
            m_oFollowUp = new FollowUpEditor() {
                Dock = DockStyle.Fill
            };
            m_oFollowUp.btnSave_OnClick += new FollowUpEditor.btnSaveOnClickEventHandler(m_oFollowUp_btnSave_OnClick);
            m_oFollowUp.GetListSource += new FollowUpEditor.GetListSourceEventHandler(m_oFollowUp_GetListSource);
            m_oFollowUpDialog = new PopupDialog() {
                FormBorderStyle = FormBorderStyle.FixedSingle,
                MinimizeBox = false,
                MaximizeBox = false,
                StartPosition = FormStartPosition.CenterScreen,
                Text = "Follow Up Window",
                ClientSize = new Size(m_oFollowUp.Width + 2, m_oFollowUp.Height + 2),
                CloseBox = false
            };
            m_oFollowUpDialog.Controls.Add(m_oFollowUp);
            //m_oFollowUpDialog.FormClosing += new FormClosingEventHandler(m_oFollowUpDialog_FormClosing);
            #endregion
            #region Call & Follow Up Toggle Bar
            m_oFollowUpBar = new FollowUpBar() {
                Dock = DockStyle.Fill
            };
            //m_oFollowUpBar.btnTop_OnClick += new FollowUpBar.btnTopOnClickEventHandler(m_oFollowUpBar_btnTop_OnClick);
            //m_oFollowUpBar.btnPrevious_OnClick += new FollowUpBar.btnPreviousOnClickEventHandler(m_oFollowUpBar_btnPrevious_OnClick);
            //m_oFollowUpBar.btnNext_OnClick += new FollowUpBar.btnNextOnClickEventHandler(m_oFollowUpBar_btnNext_OnClick);
            //m_oFollowUpBar.btnLoad_OnClick += new FollowUpBar.btnLoadOnClickEventHandler(m_oFollowUpBar_btnLoad_OnClick);
            //m_oFollowUpBar.GetCampaignBookingContactList += new FollowUpBar.GetCampaignBookingContactListEventHandler(m_oFollowUpBar_GetCampaignBookingContactList);
            //m_oFollowUpBar.GetCampaignBookingArgs += new FollowUpBar.GetCampaignBookingArgsEventHandler(m_oFollowUpBar_GetCampaignBookingArgs);
            //m_oFollowUpBar.HasBrowsableData += new FollowUpBar.HasBrowsableDataEventHandler(m_oFollowUpBar_HasBrowsableData);
            //m_oFollowUpBar.HasPendingCallAndLog += new FollowUpBar.HasPendingCallAndLogEventHandler(m_oFollowUpBar_HasPendingCallAndLog);
            //m_oFollowUpBar.btnSave_OnClick += new FollowUpBar.btnSaveOnClickEventHandler(m_oFollowUpBar_btnSave_OnClick);
            //m_oFollowUpBar.LoadFollowUps += new FollowUpBar.LoadFollowUpsEventHandler(m_oFollowUpBar_LoadFollowUps);
            //m_oFollowUpBar.CanWorkOnCompany += new FollowUpBar.CanWorkOnCompanyEventHandler(m_oFollowUpBar_CanWorkOnCompany); //+= new FollowUpBar.DialogOnEditModeEventHandler(m_oFollowUpBar_DialogOnEditMode);

            m_oCallLogRemarksBar = new CallLogRemarks() {
                Dock = DockStyle.Fill,
                Visible = false
            };
            m_oCallLogRemarksBar.btnSaveCallLog_OnClick += new CallLogRemarks.btnSaveCallLogOnClickEventHandler(m_oCallLogRemarksBar_btnSaveCallLog_OnClick);
            m_oCallLogRemarksBar.EndCall_Initiated += new CallLogRemarks.EndCallInitiatedEventHandler(m_oCallLogRemarksBar_EndCall_Initiated);
            m_oCallLogRemarksBar.GetContactPerson += new CallLogRemarks.GetContactPersonEventHandler(m_oCallLogRemarksBar_GetContactPerson);
            m_oCallLogRemarksBar.UserOnCall += new CallLogRemarks.UserOnCallEventHandler(m_oCallLogRemarksBar_UserOnCall);
            m_oCallLogRemarksBar.UserOnCallForceStop += new CallLogRemarks.UserOnCallForceStopEventHandler(m_oCallLogRemarksBar_UserOnCallForceStop);
            pnlCallLogAndFollowUp.Controls.Clear();
            pnlCallLogAndFollowUp.Controls.AddRange(new Control[] {
                m_oFollowUpBar,
                m_oCallLogRemarksBar
            });
            #endregion
            #region Help Information Form
            m_HelpInfo.Shown += new EventHandler(m_HelpInfo_Shown);
            m_HelpInfo.FormClosed += new FormClosedEventHandler(m_HelpInfo_FormClosed);
            #endregion

            this.RegisterEvents();
            this.SetStateCallerBarGroup(false);

            tcSalesConsultant.CustomHeaderButtons[0].Enabled = false;
            tcSalesConsultant.CustomHeaderButtons[0].Visible = false;

            /**
             * https://brightvision.jira.com/browse/PLATFORM-3141
             * disable the mouse wheel scrolling.
             */
            cboCampaignList.MouseWheel += cboCampaignList_MouseWheel;
        }
Ejemplo n.º 3
0
        private void GridUtilityMenu_EditEventOnClick()
        {
            if (gvEventLog.RowCount < 1)
                return;

            if (m_BrightSalesProperty.CampaignBooking.Questionnaire.Mode == SelectionProperty.DialogSaveMode.Edit) {
                NotificationDialog.Warning("Bright Sales", "This dialog is currently being edited.");
                return;
            }

            SalesConsultant.Business.BrightSalesGridUtility.EditEventOnClick -= new SalesConsultant.Business.BrightSalesGridUtility.EditEventOnClickEventHandler(GridUtilityMenu_EditEventOnClick);
            CTScEventAndFollowUpLog _item = gvEventLog.GetFocusedRow() as CTScEventAndFollowUpLog;
            if (_item == null || _item.event_type.Equals("Call Log") || _item.event_type.Equals("Nurture Log"))
                return;

            bool _EditAllowed = false;
            if (_item.assigned_user == UserSession.CurrentUser.UserId || _item.created_by.Equals(UserSession.CurrentUser.UserFullName))
                _EditAllowed = true;

            if (!_EditAllowed)
                return;

            /** /
            bool _EditAllowed = false;
            if (_item.event_type.Equals("Nurture Event") || _item.event_type.Equals("Make Call"))
                _EditAllowed = true;

            if (!_EditAllowed)
                return;
            /**/

            int _FinalListId;
            event_followup_log _data;
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                _data = _efDbContext.event_followup_log.FirstOrDefault(i => i.id == _item.id);
                _FinalListId = (int)_efDbContext.final_lists.FirstOrDefault(i => i.sub_campaign_id == _data.subcampaign_id).id;
                _efDbContext.Detach(_data);
            }

            if (_data == null)
                return;

            #region Initialize Editor
            FollowUpEditor _control = new FollowUpEditor() {
                Dock = DockStyle.Fill,
                IsNurtureEvent = false
            };
            _control.btnSave_OnClick += new FollowUpEditor.btnSaveOnClickEventHandler(_control_btnSave_OnClick);

            PopupDialog _dlg = new PopupDialog() {
                FormBorderStyle = FormBorderStyle.FixedSingle,
                MinimizeBox = false,
                MaximizeBox = false,
                StartPosition = FormStartPosition.CenterScreen,
                Text = "Edit Task",
                ClientSize = new Size(_control.Width + 2, _control.Height + 2),
                CloseBox = false
            };
            _dlg.Controls.Add(_control);
            #endregion

            int _EventType = 0;
            if (_item.event_type.Equals("Nurture Event")) {
                _EventType = (int)_data.subcampaign_id;
                _control.IsNurtureEvent = true;
            }
            else if (_item.event_type.Equals("Make Call"))
                _EventType = -1;
            else if (_item.event_type.Equals("Todo"))
                _EventType = -3;

            _control.SubCampaignId = SubCampaignId;
            _control.Prepare();
            _control.GetEventTypes(SubCampaignId);
            _control.SetSelectedEventType(_EventType);
            _control.LoadSalesUsers((int)_data.subcampaign_id, (int)_data.assigned_user);
            _control.SetCampaignInfo(_data);

            List<CTScSubCampaignContactList> _ContactList = ObjectSubCampaign.GetSubCampaignContacts((int)_data.subcampaign_id, (int)_data.account_id, _FinalListId);
            if (_ContactList.Count > 0) {
                _control.LoadContactPersons(_ContactList);
                CTScSubCampaignContactList _contact = _ContactList.Find(i => i.id == (int)_data.contact_id);
                if (_contact != null) {
                    _control.ContactPerson = _contact;
                    _control.LoadSelectedContact(false);
                }
            }

            _dlg.ShowDialog(this);
        }
Ejemplo n.º 4
0
        private string m_oFollowUp_GetListSource(FollowUpEditor.GetListSourceArgs e)
        {
            string _ListSource = string.Empty;
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                int _FinalListId = (int)_efDbContext.final_lists.FirstOrDefault(i => i.sub_campaign_id == m_SubCampaignId).id;
                if (e.CompanyId > 0) {
                    sub_campaign_account_lists _item = _efDbContext.sub_campaign_account_lists.FirstOrDefault(i =>
                        i.final_list_id == _FinalListId &&
                        i.account_id == e.CompanyId
                    );
                    if (_item != null) {
                        _ListSource = _item.list_source;
                        _efDbContext.Detach(_item);
                    }
                }
                else if (e.ContactId > 0) {
                    sub_campaign_contact_lists _item = _efDbContext.sub_campaign_contact_lists.FirstOrDefault(i =>
                        i.final_list_id == _FinalListId &&
                        i.contact_id == e.ContactId
                    );
                    if (_item != null) {
                        _ListSource = _item.list_source;
                        _efDbContext.Detach(_item);
                    }
                }
            }

            return string.Format("{0}>{1}>{2}{3}",
                m_CustomerName,
                m_CampaignName,
                m_SubCampaignName,
                string.IsNullOrEmpty(_ListSource) ? "" : " (" + _ListSource + ")"
            );
        }