//private void m_CampaignBookingModule_EventFollowupLog_WorkNurtureEvent(MyFollowUps.CampaignBookingArgs e) private void m_CampaignBookingModule_EventFollowupLog_WorkNurtureEvent(CampaignBookingProperty.CampaignBoookingArguments e) { if (e == null) return; using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) { sub_campaign_account_lists _item = _efDbContext.sub_campaign_account_lists.FirstOrDefault(i => i.account_id == e.oAppointment.AccountId && i.final_list_id == e.oAppointment.FinalListId ); if (_item != null) _efDbContext.Detach(_item); if (_item.locked && _item.locked_by != UserSession.CurrentUser.UserId) { user _user = _efDbContext.users.FirstOrDefault(i => i.id == _item.locked_by); if (_user != null) _efDbContext.Detach(_user); NotificationDialog.Error("Bright Sales", string.Format("You cannot work on this follow up.{0}This follow up is currently worked by{0}{1}", Environment.NewLine, _user.fullname)); return; } } this.LoadSpecificData(e); }
private void m_oEventFollowupLog_WorkNurtureEvent(CampaignBookingProperty.CampaignBoookingArguments e) { if (EventFollowupLog_WorkNurtureEvent != null) EventFollowupLog_WorkNurtureEvent(e); }
//public void LoadSpecificData(MyFollowUps.CampaignBookingArgs pCampaignBookingArgs) private void LoadSpecificData(CampaignBookingProperty.CampaignBoookingArguments pCampaignBookingArgs) { if (pCampaignBookingArgs == null || pCampaignBookingArgs.oAppointment == null) return; using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) { subcampaign_users _User = _efDbContext.subcampaign_users.FirstOrDefault(i => i.subcampaign_id == pCampaignBookingArgs.oAppointment.SubCampaignId && i.user_id == UserSession.CurrentUser.UserId && i.internal_user == true ); if (_User != null) _efDbContext.Detach(_User); else { if (!pCampaignBookingArgs.IsAssignedToTeam) { NotificationDialog.Warning("Bright Sales", string.Format("You are not a member of this sub-campaign.{0}Please contact your administrator.", Environment.NewLine)); return; } } } bool _found = false; int _idx = 0; for (; _idx < m_lstSubCampaigns.Count; _idx++) { string[] _ids = m_lstSubCampaigns[_idx].id.Split(';'); string[] _sub_campaign = _ids[2].Split('|'); if (Convert.ToInt32(_sub_campaign[0]) == pCampaignBookingArgs.oAppointment.SubCampaignId) { _found = true; break; } } /** * if match is found, then load that sub campaign, only if not the same account and contact. * if the same, no reason to reload it. cost of process only. */ if (_found) { //if (m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId == pCampaignBookingArgs.oAppointment.AccountId && // m_BrightSalesProperty.CommonProperty.CurrentWorkedContactId == pCampaignBookingArgs.ContactId) { // NotificationDialog.Error("Bright Sales", "You cannot reload the same subcampaign / account / contact."); // return; //} //if (m_LoadSpecificDataAccountId == pCampaignBookingArgs.oAppointment.AccountId && // m_LoadSpecificDataContactId == pCampaignBookingArgs.ContactId) { // NotificationDialog.Error("Bright Sales", "You cannot reload the same subcampaign / account / contact."); // return; //} /** * this code part is intended so that the campaign list will force * trigger the EditValueChanged() event. Since if the last index is the same, * it will not proceed to performming the EditValueChanged(). */ m_OutsideModuleCall = true; this.cboCampaignList.EditValueChanged -= new System.EventHandler(this.cboCampaignList_EditValueChanged); this.cboCampaignList.EditValue = null; this.cboCampaignList.EditValueChanged += new System.EventHandler(this.cboCampaignList_EditValueChanged); m_LoadSpecificDataAccountId = pCampaignBookingArgs.oAppointment.AccountId; m_LoadSpecificDataContactId = pCampaignBookingArgs.ContactId; cboCampaignList.ItemIndex = _idx; //if (m_CampaignListModule != null) // m_CampaignListModule.CompanySetFocus(pCampaignBookingArgs.oAppointment.AccountId); //if (m_CampaignBookingModule != null) // m_CampaignBookingModule.ContactSetFocus(pCampaignBookingArgs.ContactId); } else NotificationDialog.Warning("Bright Sales", "This particular sub-campaign is not on your sub-campaign lists."); }
public void SetCampaignInfo(CampaignBookingProperty.CampaignBoookingArguments pArgs) { using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) { event_followup_log _data = _efDbContext.event_followup_log.FirstOrDefault(i => i.id == pArgs.Id); account _efoCompany = _efDbContext.accounts.FirstOrDefault(i => i.id == AccountId); lblCompanyInfo.Text = string.Format("Company: {0}{1}", _efoCompany.company_name, string.IsNullOrEmpty(_efoCompany.city) ? string.Empty : ", " + _efoCompany.city ); tbxRemarks.Text = _data.short_message; cbxDone.Checked = _data.done; lciHide.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; lciClear.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; cboContact.EditValue = _data.contact_id; dbxDate.EditValue = _data.date_of_transaction; cboTime.Text = Convert.ToDateTime(_data.start_time.ToString()).ToString("HH:mm"); FollowUpId = pArgs.Id; _efDbContext.Detach(_data); _efDbContext.Detach(_efoCompany); } }