public void GetSalesTrendDataByCompany(Company company, Action<IEnumerable<SalesTrend>> callback)
        {
            if (company == null)
            {
                callback(Enumerable.Empty<SalesTrend>());
                return;
            }

            var companyID = company.CompanyID;
            this.LoadQuery<SalesTrend>(this.Context.GetTrendsByCompanyIDQuery(companyID), callback);
        }
        public void GetContactsByCompany(Company company, Action<IEnumerable<Contact>> callback)
        {
            if (company == null)
            {
                callback(Enumerable.Empty<Contact>());
                return;
            }

            var companyID = company.CompanyID;
            this.LoadQuery<Contact>(this.Context.GetContactsByCompanyIDQuery(companyID), callback);
        }
        public void GetOpenOpportunitiesByCompany(Company company, Action<IEnumerable<Opportunity>> callback)
        {
            if (company == null)
            {
                callback(Enumerable.Empty<Opportunity>());
                return;
            }

            var companyID = company.CompanyID;
            this.LoadQuery<Opportunity>(this.Context.GetCompanyOverviewOpportunitiesQuery(companyID), callback);
        }
 public void GetContactsMetadata(Company company, Action<ContactsMetadata> callback)
 {
     if (isLoading)
     {
         return;
     }
     isLoading = true;
     this.Context.GetContactsMetadata(company.CompanyID, (operation) =>
     {
         isLoading = false;
         callback(operation.Value);
     }, null);
 }
 private string ComposeAddress(Company company)
 {
     string address = this.ParseTextToCorrectSendingFormat(company.Address);
     string city = this.ParseTextToCorrectSendingFormat(company.City);
     string state = this.ParseTextToCorrectSendingFormat(company.State);
     string postcode = this.ParseTextToCorrectSendingFormat(company.Postcode);
     string country = this.ParseTextToCorrectSendingFormat(company.Country, false);
     string result = string.Format("{0}{1}{2}{3}{4}", address, city, postcode, state, country);
     return result;
 }
        public void LocateOnMap(Company company)
        {
            if (company == null || (string.IsNullOrEmpty(company.Address) && string.IsNullOrEmpty(company.City) && string.IsNullOrEmpty(company.Country)) || this.SearchProvider == null)
            {
                this.BestView = new LocationRect(new Location(0,0),new Location(0,0));
                this.PinPoints.Clear();
                return;
            }

            string address = this.ComposeAddress(company);

            SearchRequest searchRequest = new SearchRequest();
            searchRequest.Culture = System.Globalization.CultureInfo.CurrentCulture;
            searchRequest.Query = address;
            System.Diagnostics.Debug.WriteLine("Address : {0}", address);
            System.Diagnostics.Debug.WriteLine("Address in Company : {0} {1} {2} {3} {4}", company.Address, company.City, company.State, company.Postcode, company.Country);
            this.SearchProvider.SearchCompleted += new EventHandler<SearchCompletedEventArgs>(this.SearchProvider_SearchCompleted);
            this.SearchProvider.SearchAsync(searchRequest);
        }
        public void OnSelectedCompanyChanged(Company company)
        {
            if (company == null || company.CompanyID == 0)
            {
                return;
            }
            this.SelectedCompany = company;

            this.ContactRepository.GetContactsMetadata(company, cm =>
            {
                this.Metadata = cm;
            });
        }
 public void GetOpportunitiesByCompany(Company company, Action<IEnumerable<Procbel.Apps.Model.Main.Opportunity>> callback)
 {
     this.GetOpportunitiesByCompanyID(company.CompanyID, callback);
 }
 public void GetOpportunitiesByCompany(Company company, Action<IEnumerable<Opportunity>> callback)
 {
     this.GetOpportunitiesByCompanyID(company.CompanyID, callback);
 }
 public void OnSelectedCompanyChanged(Company company)
 {
     this.selectedCompany = company;
     if (this.selectedCompany != null && this.selectedCompany.CompanyID == 0)
     {
         this.DataHasPendingUpdates = true;
     }
 }
 public void OnSelectedCompanyChanged(Company company)
 {
     this.SelectedCompany = company;
     this.DataHasPendingUpdates = true;
 }
 public void OnSelectedCompanyChanged(Company company)
 {
     this.selectedCompany = company;
     this.SelectedCompanyAppointments.Clear();
     this.SelectedCompanyActivities.Clear();
     this.DataHasPendingUpdates = true;
 }
 private bool FilterCompany(Company entity)
 {
     return (entity.CompanyID == this.CompanyID);
 }
 private bool FilterCompanies(Company entity)
 {
     return (entity.ImageId == this.Id);
 }