private void CampaignBookingOnSave(ManageCampaignBookingEvents.OnSave.FrmSalesConsultant e) { /** * execute only if not called by send email. * since we dont need to disable anything yet when just sending email, just saving data only. */ if (e.CalledFromSendEmail) { //if (m_CampaignBookingModule.ParentView == ManageCampaignBooking.eParentView.CampaignList) if (m_BrightSalesProperty.CampaignBooking.ParentView == SelectionProperty.ParentView.CampaignList) m_CampaignListModule.SetCompanyDetails(m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId); //else if (m_CampaignBookingModule.ParentView == ManageCampaignBooking.eParentView.MyFollowUp) else if (m_BrightSalesProperty.CampaignBooking.ParentView == SelectionProperty.ParentView.MyFollowUp) m_MyFollowUpModule.SaveCompanyAppointment(); return; } this.CampaignBookingDataSaved(); this.SetStateCallerBarGroup(false); //if (m_CampaignBookingModule.ParentView == ManageCampaignBooking.eParentView.CampaignList) { if (m_BrightSalesProperty.CampaignBooking.ParentView == SelectionProperty.ParentView.CampaignList) { m_CampaignListModule.SetCompanyDetails(m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId); m_CampaignListModule.ReleaseCurrentCompanyLock(); } //else if (m_CampaignBookingModule.ParentView == ManageCampaignBooking.eParentView.MyFollowUp) { else if (m_BrightSalesProperty.CampaignBooking.ParentView == SelectionProperty.ParentView.MyFollowUp) { m_MyFollowUpModule.SaveCompanyAppointment(); m_MyFollowUpModule.ReleaseCompanyLock(); } m_oCallLogBar.EndClock(); m_oCallLogBar.Default(); m_oCallViewBar.PhoneCallEnded(); m_oCallViewBar.Default(); }
private void OnCompanyRelease(ManageCampaignBookingEvents.OnCompanyRelease e) { //if (m_CampaignBookingModule.ParentView == ManageCampaignBooking.eParentView.CampaignList) { if (m_BrightSalesProperty.CampaignBooking.ParentView == SelectionProperty.ParentView.CampaignList) { m_CampaignListModule.ReleaseCurrentCompanyLock(); m_BrightSalesProperty.CommonProperty.UserOnWorkModeState = false; } //else if (m_CampaignBookingModule.ParentView == ManageCampaignBooking.eParentView.MyFollowUp) { else if (m_BrightSalesProperty.CampaignBooking.ParentView == SelectionProperty.ParentView.MyFollowUp) { m_MyFollowUpModule.ReleaseCompanyLock(); m_BrightSalesProperty.CommonProperty.UserOnWorkModeState = false; } ////if (m_CampaignBookingModule.ParentView == ManageCampaignBooking.eParentView.CampaignList) { //if (m_BrightSalesProperty.CampaignBooking.ParentView == SelectionProperty.ParentView.CampaignList) // m_CampaignListModule.ReleaseCurrentCompanyLock(); // m_BrightSalesProperty.CommonProperty.UserOnWorkModeState = false; //} ////else if (m_CampaignBookingModule.ParentView == ManageCampaignBooking.eParentView.MyFollowUp) { //else if (m_BrightSalesProperty.CampaignBooking.ParentView == SelectionProperty.ParentView.MyFollowUp) { // m_MyFollowUpModule.ReleaseCurrentCompanyLock(); // m_BrightSalesProperty.CommonProperty.UserOnWorkModeState = false; //} }
//private void LoadPreviousCompany(ManageCampaignBookingEvents.OnLoadPreviousCompany e) //{ // m_BrightSalesProperty.CampaignBooking.LoadPreviousCompanySuccess = false; // //m_CompanyWorkedByAnotherConsultant = false; // //m_CampaignBookingModule.CompanyWorkedByAnotherConsultant = false; // //if (m_CampaignBookingModule.ParentView == ManageCampaignBooking.eParentView.CampaignList) // if (m_BrightSalesProperty.CampaignBooking.ParentView == SelectionProperty.ParentView.CampaignList) // m_BrightSalesProperty.CampaignBooking.LoadPreviousCompanySuccess = m_CampaignListModule.MovePrevious(); // if (!m_BrightSalesProperty.CommonProperty.CompanyLocked && m_BrightSalesProperty.CampaignBooking.LoadPreviousCompanySuccess) // this.SetStateCallerBarGroup(true); // else // this.SetStateCallerBarGroup(false); //} //private void LoadNextCompany(ManageCampaignBookingEvents.OnLoadNextCompany e) //{ // //m_BrightSalesProperty.CampaignBooking.LoadNextCompanySuccess = false; // //m_CompanyWorkedByAnotherConsultant = false; // //m_CampaignBookingModule.CompanyWorkedByAnotherConsultant = false; // //if (m_CampaignBookingModule.ParentView == ManageCampaignBooking.eParentView.CampaignList) // if (m_BrightSalesProperty.CampaignBooking.ParentView == SelectionProperty.ParentView.CampaignList) // m_CampaignListModule.MoveNext(); // //m_BrightSalesProperty.CampaignBooking.LoadNextCompanySuccess = m_CampaignListModule.MoveNext(); // if (!m_BrightSalesProperty.CommonProperty.CompanyLocked && m_BrightSalesProperty.CampaignBooking.LoadNextCompanySuccess) // this.SetStateCallerBarGroup(true); // else // this.SetStateCallerBarGroup(false); //} private void SetStateCallerBarGroup(ManageCampaignBookingEvents.SetCallViewBarState e) { this.SetStateCallerBarGroup(e.State); }
private void OnCampaignBookingLoad(ManageCampaignBookingEvents.OnFormLoad e) { if (m_BrightSalesProperty.CommonProperty.UserOnWorkModeState) this.SetStateCallerBarGroup(true); m_oCallViewBar.AccountId = m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId; m_oCallViewBar.SubCampaignId = m_BrightSalesProperty.CommonProperty.SubCampaignId; m_oCallViewBar.FinalListId = m_BrightSalesProperty.CommonProperty.FinalListId; m_oCallViewBar.CompanyBoardNo = m_BrightSalesProperty.CampaignBooking.Appointment.CompanyBoardNumber; m_oCallViewBar.ContactPerson = e.ContactPerson; m_oCallViewBar.Default(); m_oCallViewBar.SetContactNumbers(); m_oCallLogBar.AccountId = m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId; m_oCallLogBar.SubCampaignId = m_BrightSalesProperty.CommonProperty.SubCampaignId; m_oCallLogBar.Default(); m_oFollowUp.AccountId = m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId; m_oFollowUp.SetCompanyInfo(); }
private void DialogEditorOnSaveCompleted(ManageCampaignBookingEvents.OnDialogEditorSaved e) { SaveCompanyAppointment(); }
private void MovePrevious(ManageCampaignBookingEvents.OnLoadPreviousCompany.CampaignList e) { m_BrightSalesProperty.CampaignBooking.LoadPreviousCompanySuccess = false; if (gvCampaignList.RowCount < 1) return; /** * check current company if being released by the the user before loading the next company. */ sub_campaign_account_lists _item = null; int _AcctId = ValidationUtility.TryParseInt(gvCampaignList.GetRowCellValue(m_CampaignListSelectedRow, "account_id").ToString()); int _FinalListId = ValidationUtility.TryParseInt(gvCampaignList.GetRowCellValue(m_CampaignListSelectedRow, "final_list_id").ToString()); using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) { _item = _efDbContext.sub_campaign_account_lists.FirstOrDefault(i => i.account_id == _AcctId && i.final_list_id == _FinalListId ); if (_item != null) _efDbContext.Detach(_item); if ((_item.locked && _item.locked_by == UserSession.CurrentUser.UserId) || !_item.locked) { gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked", false); this.GetCurrentCampaignListAccount(); this.ReleaseCurrentCompanyLock(); } /** * [@jeff 10.18.2013]: https://brightvision.jira.com/browse/PLATFORM-2638 * added logic to go to the next company if campaign list is on companies and contacts mode. */ int _Row = 0; if (gvCampaignList.FocusedRowHandle > 0) _Row = gvCampaignList.FocusedRowHandle - 1; for (; _Row < gvCampaignList.RowCount; _Row--) { int _PrevAcctId = ValidationUtility.TryParseInt(ValidationUtility.IFNullString(gvCampaignList.GetRowCellValue(_Row, "account_id"),"0")); if (_AcctId != _PrevAcctId) break; } /** * now, we will load the next company and re-check if this is currently worked by other consultants. */ m_BrightSalesProperty.CommonProperty.CompanyLocked = false; gvCampaignList.FocusedRowHandle = _Row; _AcctId = ValidationUtility.TryParseInt(gvCampaignList.GetRowCellValue(m_CampaignListSelectedRow, "account_id").ToString()); _FinalListId = ValidationUtility.TryParseInt(gvCampaignList.GetRowCellValue(m_CampaignListSelectedRow, "final_list_id").ToString()); _item = _efDbContext.sub_campaign_account_lists.FirstOrDefault(i => i.account_id == _AcctId && i.final_list_id == _FinalListId ); if (_item.locked && _item.locked_by > 0 && _item.locked_by != UserSession.CurrentUser.UserId) { user _user = _efDbContext.users.FirstOrDefault(i => i.id == _item.locked_by); if (_user != null) _efDbContext.Detach(_user); m_BrightSalesProperty.CommonProperty.CompanyLocked = true; NotificationDialog.Warning("Bright Sales", string.Format("{0}This company is currently worked by{0}{1}", Environment.NewLine, _user.fullname)); } this.SetCampaignListAppointmentParams(); if (!m_BrightSalesProperty.CommonProperty.CompanyLocked) { bool islocked = m_CurrentCampaignListAccount.locked; int? lockedBy = m_CurrentCampaignListAccount.locked_by; bool _State = islocked && lockedBy != UserSession.CurrentUser.UserId ? false : true; btnWorkOnCompany.Enabled = _State; btnRemoveCompany.Enabled = _State; if ((islocked && lockedBy == UserSession.CurrentUser.UserId) || !islocked) { //var BPContext = new BrightPlatformEntities(UserSession.EntityConnection); m_CurrentCampaignListAccount.locked = true; m_CurrentCampaignListAccount.locked_by = UserSession.CurrentUser.UserId; m_CurrentCampaignListAccount.locked_timestamp = _efDbContext.FIUpdateUserLock( m_FinalListId, m_AccountId, m_CurrentCampaignListAccount.locked, m_CurrentCampaignListAccount.locked_by ).FirstOrDefault(); gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked", m_CurrentCampaignListAccount.locked); gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked_by", m_CurrentCampaignListAccount.locked_by); gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Locked_By_User", UserSession.CurrentUser.UserFullName); gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked_timestamp", m_CurrentCampaignListAccount.locked_timestamp); } gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked", true); } } m_CampaignListSelectedRow = gvCampaignList.FocusedRowHandle < 0 ? 0 : gvCampaignList.FocusedRowHandle; m_BrightSalesProperty.CampaignBooking.LoadPreviousCompanySuccess = true; return; }
private void CampaignBookingOnStatusChange(ManageCampaignBookingEvents.OnStatusChange e) { ObjectSubCampaign.SaveSubCampaignCompanyAppointmentStatus( m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId, m_BrightSalesProperty.CommonProperty.FinalListId, m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentStatus, m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentLeadStatus ); m_CompanyAppointmentStatus = m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentStatus; m_CompanyAppointmentLeadStatus = m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentLeadStatus; gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Company_Status", m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentStatus); gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Company_Last_Contact", DateTime.Today.ToShortDateString()); gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Company_Last_User", UserSession.CurrentUser.UserFullName); gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Lead_Status", m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentLeadStatus); this.BestFitGridColumns(); }
private void CampaignBookingOnSave(ManageCampaignBookingEvents.OnSave.ManageCampaignList e) { if (m_CompanyAppointmentLeadStatus != m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentLeadStatus || e.IsReleasedCancel == false) { ObjectSubCampaign.SaveSubCampaignCompanyAppointmentStatus( m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId, m_BrightSalesProperty.CommonProperty.FinalListId, m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentStatus, m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentLeadStatus ); m_CompanyAppointmentStatus = m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentStatus; m_CompanyAppointmentLeadStatus = m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentLeadStatus; /* * https://brightvision.jira.com/browse/PLATFORM-3047 * DAN: As it is the reason why the issue occur. */ m_objSubCampaignAppointmentParams.CompanyAppointmentStatus = m_CompanyAppointmentStatus; m_objSubCampaignAppointmentParams.CompanyAppointmentLeadStatus = m_CompanyAppointmentLeadStatus; //gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Company_Status", m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentStatus); //gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Company_Last_Contact", DateTime.Today.ToShortDateString()); //gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Company_Last_User", UserSession.CurrentUser.UserFullName); //gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Lead_Status", m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentLeadStatus); int _AcctId = 0; for (int i = 0; i < gvCampaignList.RowCount; i++) { _AcctId = ValidationUtility.TryParseInt(gvCampaignList.GetRowCellValue(i, "account_id")); if (_AcctId == m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId) { gvCampaignList.SetRowCellValue(i, "Company_Status", m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentStatus); gvCampaignList.SetRowCellValue(i, "Company_Last_Contact", DateTime.Today.ToShortDateString()); gvCampaignList.SetRowCellValue(i, "Company_Last_User", UserSession.CurrentUser.UserFullName); gvCampaignList.SetRowCellValue(i, "Lead_Status", m_BrightSalesProperty.CampaignBooking.Appointment.CompanyAppointmentLeadStatus); } } this.BestFitGridColumns(); } //gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Company_Last_Contact", DateTime.Today.ToShortDateString()); //gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Company_Last_User", UserSession.CurrentUser.UserFullName); }