当前位置: 首页>>代码示例>>C#>>正文


C# BrightPlatformEntities.FISaveGeographicalData方法代码示例

本文整理汇总了C#中BrightPlatformEntities.FISaveGeographicalData方法的典型用法代码示例。如果您正苦于以下问题:C# BrightPlatformEntities.FISaveGeographicalData方法的具体用法?C# BrightPlatformEntities.FISaveGeographicalData怎么用?C# BrightPlatformEntities.FISaveGeographicalData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BrightPlatformEntities的用法示例。


在下文中一共展示了BrightPlatformEntities.FISaveGeographicalData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Save

        private void Save()
        {
            if (vgridCompanyInfo.GetRecordObject(0) == null)
                return;

            account accnt = vgridCompanyInfo.GetRecordObject(0) as account;
            if (accnt == null)
                return;

            //if (CompanyRemarks != null)
            //    accnt.remarks = CompanyRemarks;

            /**
             * [@jeff 06.20.2012]: https://brightvision.jira.com/browse/PLATFORM-1460
             * add event logging for edited accounts.
             */
            accnt.last_modified_machine = UserSession.CurrentUser.ComputerName;
            accnt.last_modified_source = BrightVision.EventLog.Business.FacadeEventLog.Source_Bright_Sales_Company_Information;
            accnt.modified_by = UserSession.CurrentUser.UserId;
            accnt.modified_date = DateTime.Now;
            m_objDatabaseModel.accounts.FirstOrDefault(i => i.id == accnt.id);
            m_objDatabaseModel.accounts.ApplyCurrentValues(accnt);

            int SubCampaignId = m_objDatabaseModel.final_lists.FirstOrDefault(i => i.id == m_FinalListId).sub_campaign_id;
            sub_campaign_account_remarks _efeCompanyRemarks = m_objDatabaseModel.sub_campaign_account_remarks.FirstOrDefault(i => i.sub_campaign_id == SubCampaignId && i.account_id == m_AccountId);
            if (_efeCompanyRemarks == null) {
                m_objDatabaseModel.sub_campaign_account_remarks.AddObject(
                    new sub_campaign_account_remarks() {
                        sub_campaign_id = SubCampaignId,
                        account_id = m_AccountId,
                        remarks = tbxAccountSubCampaignRemark.Text
                    }
                );
            }
            else {
                _efeCompanyRemarks.remarks = tbxAccountSubCampaignRemark.Text;
                m_objDatabaseModel.sub_campaign_account_remarks.ApplyCurrentValues(_efeCompanyRemarks);
            }

            m_objDatabaseModel.SaveChanges();
            CompanyPhone = accnt.telephone;
            CompanyWebsite = accnt.www;

            //if (OnCompanyInformationSaved != null) {
            //    CompanyInformationArgs cargs = new CompanyInformationArgs(accnt);
            //    OnCompanyInformationSaved(this, cargs);
            //}

            /**
             * save company geo code information
             */
            #region Code Logic
            StringBuilder _address = new StringBuilder();
            if (!string.IsNullOrEmpty(accnt.box_address))
                _address.Append(accnt.box_address);
            if (!string.IsNullOrEmpty(accnt.street_address))
                _address.Append(_address.Length > 0 ? "," + accnt.street_address : accnt.street_address);
            if (!string.IsNullOrEmpty(accnt.zipcode))
                _address.Append(_address.Length > 0 ? "," + accnt.zipcode : accnt.zipcode);
            if (!string.IsNullOrEmpty(accnt.city))
                _address.Append(_address.Length > 0 ? "," + accnt.city : accnt.city);
            if (!string.IsNullOrEmpty(accnt.country))
                _address.Append(_address.Length > 0 ? "," + accnt.country : accnt.country);

            GoogleMapUtility _oMapUtility = new GoogleMapUtility();
            if (!string.IsNullOrEmpty(_address.ToString()) || !GoogleMapUtility.IsValidGeoAddress(_address.ToString()))
            {
                string[] _oGeoData = _oMapUtility.GetGeographicalData(_address.ToString()).Split(',');
                double _Latitude = 0;
                double _Longitude = 0;

                // save only if returned success code
                if (_oGeoData[0].ToString().Equals("200"))
                {
                    if (_oGeoData[2] != null)
                        if (ValidationUtility.IsCurrency(_oGeoData[2]))
                            _Latitude = Convert.ToDouble(_oGeoData[2], CultureInfo.InvariantCulture);

                    if (_oGeoData[3] != null)
                        if (ValidationUtility.IsCurrency(_oGeoData[3]))
                            _Longitude = Convert.ToDouble(_oGeoData[3], CultureInfo.InvariantCulture);

                    if (_Latitude != 0 || _Longitude != 0)
                    {
                        BrightPlatformEntities _efDbModel = new BrightPlatformEntities(UserSession.EntityConnection);
                        _efDbModel.FISaveGeographicalData(0, accnt.id, (decimal)_Latitude, (decimal)_Longitude, UserSession.CurrentUser.UserId);
                    }
                }
            }
            #endregion
        }
开发者ID:,项目名称:,代码行数:91,代码来源:

示例2: btnSave_Click


//.........这里部分代码省略.........
            #region Code Logic
            StringBuilder _address = new StringBuilder();
            if (!string.IsNullOrEmpty(contact.address_1))
                _address.Append(contact.address_1);
            if (!string.IsNullOrEmpty(contact.address_2))
                _address.Append(_address.Length > 0 ? "," + contact.address_2 : contact.address_2);
            if (!string.IsNullOrEmpty(contact.zipcode))
                _address.Append(_address.Length > 0 ? "," + contact.zipcode : contact.zipcode);
            if (!string.IsNullOrEmpty(contact.city))
                _address.Append(_address.Length > 0 ? "," + contact.city : contact.city);
            if (!string.IsNullOrEmpty(contact.country))
                _address.Append(_address.Length > 0 ? "," + contact.country : contact.country);

            GoogleMapUtility _oMapUtility = new GoogleMapUtility();
            if (!string.IsNullOrEmpty(_address.ToString()) || !GoogleMapUtility.IsValidGeoAddress(_address.ToString()))
            {
                string[] _oGeoData = _oMapUtility.GetGeographicalData(_address.ToString()).Split(',');
                double _Latitude = 0;
                double _Longitude = 0;

                // save only if returned success code
                if (_oGeoData[0].Equals("200")) {
                    if (_oGeoData[2] != null)
                        if (ValidationUtility.IsCurrency(_oGeoData[2]))
                            _Latitude = Convert.ToDouble(_oGeoData[2], CultureInfo.InvariantCulture);

                    if (_oGeoData[3] != null)
                        if (ValidationUtility.IsCurrency(_oGeoData[3]))
                            _Longitude = Convert.ToDouble(_oGeoData[3], CultureInfo.InvariantCulture);

                    if (_Latitude != 0 || _Longitude != 0)
                    {
                        BrightPlatformEntities _efDbModel = new BrightPlatformEntities(UserSession.EntityConnection);
                        _efDbModel.FISaveGeographicalData(1, contact.id, (decimal)_Latitude, (decimal)_Longitude, UserSession.CurrentUser.UserId);
                    }
                }
            }
            #endregion

            this.GetContactInformation();
            if (m_CallingEnvironment == SelectionProperty.CallingEnvironment.CampaignBooking) {
                m_EventBus.Notify(new ContactInformationEvents.OnSave.ManageCampaignBooking() {
                    OnSaveArgs = new ContactInformationEvents.ContactInformationArgs() {
                        ContactDetail = m_ContactDetail,
                        IsNewContact = m_IsNewContact,
                        NewContactId = m_ContactId
                    }
                });
            }
            else if (m_CallingEnvironment == SelectionProperty.CallingEnvironment.CampaignList) {
                m_EventBus.Notify(new ContactInformationEvents.OnSave.ManageCampaignList() {
                    OnSaveArgs = new ContactInformationEvents.ContactInformationArgs() {
                        ContactDetail = m_ContactDetail,
                        IsNewContact = m_IsNewContact,
                        NewContactId = m_ContactId
                    }
                });
            }

            //if (btnSave_OnClick != null)
            //    btnSave_OnClick(this, this.GetArguments());

            this.Show(contact.id, m_FinalListId, false, _AcctId);
            btnNew.Enabled = true;
            btnSave.Enabled = true;
            btnCancel.Enabled = false;
开发者ID:,项目名称:,代码行数:67,代码来源:


注:本文中的BrightPlatformEntities.FISaveGeographicalData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。