private void m_oContactView_gvContact_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { m_objStandardQuestionView.StandardQuestionData = null; m_objCollectedDataView.CollectedDataResult = null; #region Enable / Disable Buttons if (m_oContactView.SelectedContact == null) { this.SetContactViewButtons(false); this.SetDialogViewButtons(false); } else { this.SetContactViewButtons(true); this.SetDialogViewButtons(true); } #endregion #region Map Contact if (m_SelectedPageName == lcgCollectedData.Name && m_oContactView.SelectedContact != null) m_objCollectedDataView.ContactId = m_oContactView.SelectedContact.id; if (m_DoneLoadingContactMap) { if (m_oContactView.SelectedContact != null) { if (m_oContactView.SelectedContact.latitude != 0 || m_oContactView.SelectedContact.longitude != 0) { GeoLocationViewer.GeoMapLocation Location = new GeoLocationViewer.GeoMapLocation(); Location.Latitude = m_oContactView.SelectedContact.latitude; Location.Longitude = m_oContactView.SelectedContact.longitude; m_objGeoLocationViewerContact.LocationFocus(Location); } else { //MessageBox.Show("No coordinates available for this contact. Please check address.", m_MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); m_objGeoLocationViewerContact.ShowLocations(); } } else m_objGeoLocationViewerContact.ShowLocations(); } if (!m_SelectedPageName.Equals(lcgMapContacts.Name)) this.LoadSelectedPage(m_SelectedPageName); #endregion #region Follow-Up View & Call Log this.InitEventAndFollowUpObjects(); #endregion #region Disable Call buttons btnCallBoard.Enabled = false; btnCallDirect.Enabled = false; btnCallMobile.Enabled = false; btnHangUp.Enabled = false; if (!string.IsNullOrEmpty(oAppointment.CompanyBoardNumber)) btnCallBoard.Enabled = true; if (m_oContactView.SelectedContact != null) { if (!string.IsNullOrEmpty(m_oContactView.SelectedContact.direct_phone)) btnCallDirect.Enabled = true; if (!string.IsNullOrEmpty(m_oContactView.SelectedContact.mobile)) btnCallMobile.Enabled = true; } #endregion #region Disable View and Delete buttons //btnDeleteDialog.Enabled = false; btnEditDialog.Enabled = false; if (m_oContactView.SelectedContact != null) { ViewDialog(); //btnDeleteDialog.Enabled = true; btnEditDialog.Enabled = true; } #endregion }
/// <summary> /// Load geo map locations /// </summary> private void LoadContactGeoLocations() { double Latitude = 0; double Longitude = 0; GeoLocationViewer.GeoMapLocation Location = null; m_GeoMapListContact = null; m_objGridViewContact = null; m_GeoMapListContact = new List<GeoLocationViewer.GeoMapLocation>(); m_objGridViewContact = (DevExpress.XtraGrid.Views.Grid.GridView)m_oContactView.gcContact.FocusedView; for (int i = 0; i < m_objGridViewContact.RowCount; i++) { m_objContact = null; m_objContact = (CTScSubCampaignContactList)m_objGridViewContact.GetRow(i); string strAddress = m_objContact.complete_address; if (string.IsNullOrEmpty(strAddress)) continue; string[] objGeoData = m_objMapUtility.GetGeographicalData(strAddress).Split(','); /** * where: * objGeoData[2] = latitude * objGeoData[3] = longitude */ Latitude = 0; Longitude = 0; if (objGeoData[2] != null) if (ValidationUtility.IsCurrency(objGeoData[2])) Latitude = Convert.ToDouble(objGeoData[2], CultureInfo.InvariantCulture); if (objGeoData[3] != null) if (ValidationUtility.IsCurrency(objGeoData[3])) Longitude = Convert.ToDouble(objGeoData[3], CultureInfo.InvariantCulture); // display geo data on grid m_objGridViewContact.SetRowCellValue(i, "latitude", Latitude.ToString()); m_objGridViewContact.SetRowCellValue(i, "longitude", Longitude.ToString()); //m_objGridViewCompany.SetRowCellValue(i, "geo_status", objGeoData[2].Equals("0") && objGeoData[3].Equals("0") ? "not found" : "found"); if (Latitude != 0 || Longitude != 0) { Location = null; Location = new GeoLocationViewer.GeoMapLocation(); Location.Latitude = Latitude; Location.Longitude = Longitude; Location.Tooltip = m_objContact.first_name + " " + m_objContact.last_name; m_GeoMapListContact.Add(Location); } } }