private void objDeActivateAccount_AfterSave(object sender, EventArgs e) { WaitDialog.Show(ParentForm, "Loading list."); var x = Business.ObjectLocking.ReleaseLock(m_FinalListId, m_AccountId); this.LoadCampaignList(eCampaignListLoadCallee.DeActivateAccount); if (gvCampaignList.RowCount > 0 && btnRemoveCompany_OnClick != null) { this.SetCampaignListAppointmentParams(); CampaignListArgs _Args = new CampaignListArgs() { ContactId = m_ContactId, CompanyName = m_CompanyName, CampaignBookingAppointment = m_objSubCampaignAppointmentParams, //CampaignListMode = CampaignListMode, BreadCrumb = string.Format("{0}{1}{2} ({3})", string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry, ObjectSubCampaign.GetSubCampaignAppointmentLastUpdtedInfo( m_FinalListId, m_AccountId ) ) //BreadCrumb = string.Format("{0} > {1} > {2} > {3}{4}{5}", // CustomerName, // CampaignName, // SubCampaignName, // string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, // string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, // string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry //) }; btnRemoveCompany_OnClick(this, _Args); } else if (gvCampaignList.RowCount < 1 && OnCampaignListEmpty != null) OnCampaignListEmpty(); WaitDialog.Close(); }
public CampaignListArgs GetCampaignListArguments() { this.SetCampaignListAppointmentParams(); CampaignListArgs _Args = new CampaignListArgs(); _Args.ContactId = m_ContactId; _Args.CompanyName = m_CompanyName; _Args.CampaignBookingAppointment = m_objSubCampaignAppointmentParams; //_Args.CampaignListMode = CampaignListMode; //_Args.AccountLeadStatusSelectedIndex = m_AccountLeadStatusSelectedIndex; //_Args.AccountStatusSelectedIndex = m_AccountStatusSelectedIndex; //_Args.ContactStatusSelectedIndex = m_ContactStatusSelectedIndex; //_Args.AccountLeadStatusNotQualifiedIndex = m_AccountLeadStatusNotQualifiedIndex; //_Args.AccountStatusNotQualifiedIndex = m_AccountStatusNotQualifiedIndex; //_Args.ContactStatusNotQualifiedIndex = m_ContactStatusNotQualifiedIndex; _Args.AccountLeadStatuses = m_lstAccountLeadStatuses; _Args.AccountStatuses = m_lstAccountStatuses; _Args.ContactStatuses = m_lstContactStatuses; _Args.BreadCrumb = string.Format("{0}{1}{2} ({3})", string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry, ObjectSubCampaign.GetSubCampaignAppointmentLastUpdtedInfo( m_FinalListId, m_AccountId ) ); //_Args.BreadCrumb = // string.Format("{0} > {1} > {2} > {3}{4}{5}", // CustomerName, // CampaignName, // SubCampaignName, // string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, // string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, // string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry // ); return _Args; }
private void gvCampaignList_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { this.SetRowProperty(); if (gvCampaignList.FocusedRowHandle == DevExpress.XtraGrid.GridControl.InvalidRowHandle) return; this.SetGridChangeRowEvent(false); m_CampaignListSelectedRow = gvCampaignList.FocusedRowHandle; //m_CampaignListSelectedRow = 0; //m_CampaignListSelectedRow = gvCampaignList.RowCount >= e.PrevFocusedRowHandle ? (gvCampaignList.RowCount > 0 ? gvCampaignList.RowCount - 1 : 0) : e.PrevFocusedRowHandle; //if (m_ChangingCampaignListFocusedRow) // return; //m_ChangingCampaignListFocusedRow = true; //bool _isSameIndexes = false; //if (m_RefreshingCampaignList) // m_CampaignListSelectedRow = e.PrevFocusedRowHandle; //else if (e.FocusedRowHandle == 0 && e.PrevFocusedRowHandle > 0) { // if (m_AllowRowChange) // m_CampaignListSelectedRow = 0; // else // m_CampaignListSelectedRow = gvCampaignList.RowCount >= e.PrevFocusedRowHandle ? (gvCampaignList.RowCount > 0 ? gvCampaignList.RowCount - 1 : 0) : e.PrevFocusedRowHandle; //} //else //{ // if (m_CampaignListSelectedRow == e.FocusedRowHandle) // _isSameIndexes = true; // m_CampaignListSelectedRow = e.FocusedRowHandle; //} //if (m_ChangingCampaignList) // m_CampaignListSelectedRow = 0; //else { // if (m_RefreshingCampaignList) // m_CampaignListSelectedRow = e.PrevFocusedRowHandle; // else if (e.FocusedRowHandle == 0 && e.PrevFocusedRowHandle > 0) // { // if (m_AllowRowChange) // m_CampaignListSelectedRow = 0; // else // m_CampaignListSelectedRow = gvCampaignList.RowCount >= e.PrevFocusedRowHandle ? (gvCampaignList.RowCount > 0 ? gvCampaignList.RowCount - 1 : 0) : e.PrevFocusedRowHandle; // } // else // { // if (m_CampaignListSelectedRow == e.FocusedRowHandle) // _isSameIndexes = true; // m_CampaignListSelectedRow = e.FocusedRowHandle; // } //} //this.GetSelectedCampaignListRowCommonlyUsedFields(); //this.SetDefaultSelectedCampaignListItem(); //--------- //if (m_DoneLoadingCampaignList) { // bool islocked = (bool)gvCampaignList.GetRowCellValue(gvCampaignList.FocusedRowHandle, "locked"); // int? lockedBy = ValidationUtility.TryParseInt(ValidationUtility.IFNullString(gvCampaignList.GetRowCellValue(gvCampaignList.FocusedRowHandle, "locked_by"), "0")); // if (islocked && lockedBy != UserSession.CurrentUser.UserId) { // btnWorkOnCompany.Enabled = false; // btnRemoveCompany.Enabled = false; // } //} //else { // if (gvCampaignList.RowCount > 0) { // btnRemoveCompany.Enabled = true; // btnWorkOnCompany.Enabled = true; // lblTotalRows.Text = "Records: " + gvCampaignList.RowCount.ToString(); // } // else { // btnRemoveCompany.Enabled = false; // btnWorkOnCompany.Enabled = false; // lblTotalRows.Text = "Records: 0"; // } //} //------------- //this.CampaignListFocusedRowChange(sender, m_CampaignListSelectedRow); //if (gvCampaignList.RowCount > 0) { // btnRemoveCompany.Enabled = true; // btnWorkOnCompany.Enabled = true; // lblTotalRows.Text = "Records: " + gvCampaignList.RowCount.ToString(); //} //else { // btnRemoveCompany.Enabled = false; // btnWorkOnCompany.Enabled = false; // lblTotalRows.Text = "Records: 0"; //} //m_AllowRowChange = false; /** * m_ChangingCampaignList: * we will not fire the event in this case, since there will be another event that will * be raised when changing from sub-campaigns * * m_RefreshingCampaignList: * if just refreshing the list, do not fire subscribed events */ //if (m_ChangingCampaignList || m_RefreshingCampaignList) //if (m_RefreshingCampaignList) //{ // //m_ChangingCampaignListFocusedRow = false; // m_CampaignListParamsLoaded = false; // return; //} if (gvCampaignList.RowCount > 0 && gvCampaignList_OnFocusedRowChange != null) { this.SetCampaignListAppointmentParams(); CampaignListArgs _Args = new CampaignListArgs(); _Args.ContactId = m_ContactId == 0 ? -1 : m_ContactId; _Args.CompanyName = m_CompanyName; _Args.CampaignBookingAppointment = m_objSubCampaignAppointmentParams; _Args.BreadCrumb = string.Format("{0}{1}{2} ({3})", string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry, ObjectSubCampaign.GetSubCampaignAppointmentLastUpdtedInfo( m_FinalListId, m_AccountId ) ); gvCampaignList_OnFocusedRowChange(this, _Args); } else if (gvCampaignList.RowCount < 1 && OnCampaignListEmpty != null) OnCampaignListEmpty(); if (gvCampaignList.RowCount > 0) { btnRemoveCompany.Enabled = true; btnWorkOnCompany.Enabled = true; lblTotalRows.Text = "Records: " + gvCampaignList.RowCount.ToString(); m_CompanyWorkable = true; } else { btnRemoveCompany.Enabled = false; btnWorkOnCompany.Enabled = false; lblTotalRows.Text = "Records: 0"; m_CompanyWorkable = false; } if (m_DoneLoadingCampaignList) { try { bool islocked = (bool)gvCampaignList.GetRowCellValue(gvCampaignList.FocusedRowHandle, "locked"); int? lockedBy = ValidationUtility.TryParseInt(ValidationUtility.IFNullString(gvCampaignList.GetRowCellValue(gvCampaignList.FocusedRowHandle, "locked_by"), "0")); if (islocked && lockedBy != UserSession.CurrentUser.UserId) { btnWorkOnCompany.Enabled = false; btnRemoveCompany.Enabled = false; m_CompanyWorkable = false; } //else { // btnWorkOnCompany.Enabled = true; // btnRemoveCompany.Enabled = true; // m_CompanyWorkable = true; //} } catch { } } //m_ChangingCampaignListFocusedRow = false; //m_CampaignListParamsLoaded = false; this.SetGridChangeRowEvent(true); }
private void gvCampaignList_ColumnFilterChanged(object sender, EventArgs e) { /** * will force the grid to fire focused row change when the * current position is 0. * when omitted, some needed focused row change logic will not * be fired. */ gvCampaignList.FocusedRowHandle = DevExpress.XtraGrid.GridControl.InvalidRowHandle; if (gvCampaignList.RowCount > 0) { btnRemoveCompany.Enabled = true; btnWorkOnCompany.Enabled = true; lblTotalRows.Text = "Records: " + gvCampaignList.RowCount.ToString(); } else { btnRemoveCompany.Enabled = false; btnWorkOnCompany.Enabled = false; lblTotalRows.Text = "Records: 0"; } //if (m_ChangingCampaignListFocusedRow) { // m_ChangingCampaignListFocusedRow = false; // return; //} this.SetDefaultSelectedCampaignListItem(); /** * event raiser */ if (gvCampaignList.RowCount > 0 && gvCampaignList_OnColumnFilterChange != null) { CampaignListArgs _Args = new CampaignListArgs(); _Args.ContactId = m_ContactId; _Args.CompanyName = m_CompanyName; _Args.CampaignBookingAppointment = m_objSubCampaignAppointmentParams; //_Args.CampaignListMode = CampaignListMode; _Args.BreadCrumb = string.Format("{0}{1}{2} ({3})", string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry, ObjectSubCampaign.GetSubCampaignAppointmentLastUpdtedInfo( m_FinalListId, m_AccountId ) ); //_Args.BreadCrumb = // string.Format("{0} > {1} > {2} > {3}{4}{5}", // CustomerName, // CampaignName, // SubCampaignName, // string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, // string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, // string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry // ); gvCampaignList_OnColumnFilterChange(this, _Args); } else if (gvCampaignList.RowCount < 1 && OnCampaignListEmpty != null) OnCampaignListEmpty(); }
private void btnSaveAsNotQualified_Click(object sender, EventArgs e) { if (gvCampaignList.RowCount < 1) return; //if (UserOnWorkMode) { // MessageBox.Show("You are currently working on a company. Please kindly close it first.", "Bright Sales", MessageBoxButtons.OK, MessageBoxIcon.Information); // return; //} int _AcctId = ValidationUtility.TryParseInt(gvCampaignList.GetRowCellValue(m_CampaignListSelectedRow, "account_id").ToString()); int _FinalListId = ValidationUtility.TryParseInt(gvCampaignList.GetRowCellValue(m_CampaignListSelectedRow, "final_list_id").ToString()); BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection); sub_campaign_account_lists _item = _efDbContext.sub_campaign_account_lists.FirstOrDefault(i => i.account_id == _AcctId && i.final_list_id == _FinalListId ); DialogResult _dlg; if (_item.locked && _item.locked_by == UserSession.CurrentUser.UserId) { _dlg = MessageBox.Show( string.Format("You're currently working on this company.{0}Are you sure to save this company as Not Qualified?", Environment.NewLine), "Bright Sales", MessageBoxButtons.YesNo, MessageBoxIcon.Question ); if (_dlg == DialogResult.No) return; } else if (_item.locked && _item.locked_by != UserSession.CurrentUser.UserId) { user _user = _efDbContext.users.FirstOrDefault(i => i.id == _item.locked_by); NotificationDialog.Error("Bright Sales", string.Format("This company is currently worked by {0}.", _user.fullname)); return; } _dlg = MessageBox.Show("Are you sure to save this company as NOT QUALIFIED?", "Bright Sales", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (_dlg == DialogResult.No) return; WaitDialog.Show(ParentForm, "Saving..."); this.GetCurrentCampaignListAccount(); this.SaveCompanyAppointment(); this.ReleaseCurrentCompanyLock(); //gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Company Status", m_lstAccountStatuses[m_AccountStatusNotQualifiedIndex]); //if (m_AccountLeadStatusNotQualifiedIndex > -1) // gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Company Lead Status", m_lstAccountLeadStatuses[m_AccountLeadStatusNotQualifiedIndex]); if (btnSaveAsNotQualified_OnClick != null) { this.SetCampaignListAppointmentParams(); CampaignListArgs _Args = new CampaignListArgs(); _Args.ContactId = m_ContactId; _Args.CompanyName = m_CompanyName; _Args.CampaignBookingAppointment = m_objSubCampaignAppointmentParams; //_Args.CampaignListMode = CampaignListMode; _Args.BreadCrumb = string.Format("{0}{1}{2} ({3})", string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry, ObjectSubCampaign.GetSubCampaignAppointmentLastUpdtedInfo( m_FinalListId, m_AccountId ) ); //_Args.BreadCrumb = // string.Format("{0} > {1} > {2} > {3}{4}{5}", // CustomerName, // CampaignName, // SubCampaignName, // string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, // string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, // string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry // ); btnSaveAsNotQualified_OnClick(this, _Args); } WaitDialog.Close(); }
private void btnRefreshList_Click(object sender, EventArgs e) { //if (UserOnWorkMode) //{ // MessageBox.Show("You are currently working on a company. Please kindly close it first before refreshing the dropdown list.", "Bright Sales", MessageBoxButtons.OK, MessageBoxIcon.Information); // return; //} //if (!m_RefreshingCampaignList) // WaitDialog.Show("Refreshing list."); WaitDialog.Show("Refreshing list."); //m_RefreshingCampaignList = true; this.LoadCampaignList(eCampaignListLoadCallee.Refresh); this.gvCampaignList_FocusedRowChanged(null, null); //gcCampaignList.RefreshDataSource(); if (btnRefresh_OnClick != null) { //this.SetCampaignListAppointmentParams(); CampaignListArgs _Args = new CampaignListArgs(); _Args.ContactId = m_ContactId; _Args.CompanyName = m_CompanyName; _Args.CampaignBookingAppointment = m_objSubCampaignAppointmentParams; //_Args.CampaignListMode = CampaignListMode; _Args.BreadCrumb = string.Format("{0}{1}{2} ({3})", string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry, ObjectSubCampaign.GetSubCampaignAppointmentLastUpdtedInfo( m_FinalListId, m_AccountId ) ); //_Args.BreadCrumb = // string.Format("{0} > {1} > {2} > {3}{4}{5}", // CustomerName, // CampaignName, // SubCampaignName, // string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, // string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, // string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry // ); btnRefresh_OnClick(this, _Args); } //m_RefreshingCampaignList = false; WaitDialog.Close(); }
private void btnChangeView_Click(object sender, EventArgs e) { //if (UserOnWorkMode) { // MessageBox.Show("You are currently working on a company. Please kindly close it first before refreshing the dropdown list.", "Bright Sales", MessageBoxButtons.OK, MessageBoxIcon.Information); // return; //} m_ChangingCampaignListMode = true; if (btnChangeView.Text.Equals("Show Companies && Contacts")) { WaitDialog.Show(this.ParentForm, "Loading components..."); btnChangeView.Text = "Show Companies Only"; m_BrightSalesProperty.CampaignList.CampaignListMode = SelectionProperty.CampaignListMode.CampaniesAndContacts; //m_BrightSalesProperty.CampaignList.CampaignListMode = eCampaignListMode.CompaniesAndContacts; } else { WaitDialog.Show(this.ParentForm, "Loading components..."); btnChangeView.Text = "Show Companies && Contacts"; m_BrightSalesProperty.CampaignList.CampaignListMode = SelectionProperty.CampaignListMode.CompaniesOnly; //CampaignListMode = eCampaignListMode.CompaniesOnly; } this.LoadCampaignList(eCampaignListLoadCallee.ChangeView); m_ChangingCampaignListMode = false; if (gvCampaignList.RowCount > 0 && btnChangeView_OnClick != null) { //this.SetCampaignListAppointmentParams(); CampaignListArgs _Args = new CampaignListArgs(); _Args.ContactId = m_ContactId; _Args.CompanyName = m_CompanyName; _Args.CampaignBookingAppointment = m_objSubCampaignAppointmentParams; //_Args.CampaignListMode = CampaignListMode; _Args.BreadCrumb = string.Format("{0}{1}{2} ({3})", string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry, ObjectSubCampaign.GetSubCampaignAppointmentLastUpdtedInfo( m_FinalListId, m_AccountId ) ); //_Args.BreadCrumb = // string.Format("{0} > {1} > {2} > {3}{4}{5}", // CustomerName, // CampaignName, // SubCampaignName, // string.IsNullOrEmpty(m_CompanyName) ? "" : m_CompanyName, // string.IsNullOrEmpty(m_CompanyCity) ? "" : ", " + m_CompanyCity, // string.IsNullOrEmpty(m_CompanyCountry) ? "" : ", " + m_CompanyCountry // ); btnChangeView_OnClick(this, _Args); } else if (gvCampaignList.RowCount < 1 && OnCampaignListEmpty != null) OnCampaignListEmpty(); //this.LoadSelectedPage(m_SelectedPageName); //todo: get this on campaign booking details //m_EventBus.Notify(new CampaignListChangedViewEventNotifier()); WaitDialog.Close(); }