public SalesDashboardLeadsViewModel(Command pushTabbedLeadPageCommand, INavigation navigation = null)
            : base(navigation)
        {
            _PushTabbedLeadPageCommand = pushTabbedLeadPageCommand;

            _CustomerDataClient = DependencyService.Get <ICustomerDataClient>();

            Leads = new ObservableCollection <Account>();

            MessagingCenter.Subscribe <Account>(this, MessagingServiceConstants.SAVE_ACCOUNT, (account) =>
            {
                var index = Leads.IndexOf(account);
                if (index >= 0)
                {
                    Leads[index] = account;
                }
                else
                {
                    Leads.Add(account);
                }
                Leads = new ObservableCollection <Account>(Leads.OrderBy(l => l.Company));
            });

            IsInitialized = false;
        }
        public CustomerDetailViewModel(Account account)
        {
            if (account == null)
            {
                Account = new Account();
                Account.Industry = Account.IndustryTypes[0];
                Account.OpportunityStage = Account.OpportunityStages[0];

                this.Title = "New Account";
            }
            else
            {
                Account = account;
                this.Title = "Account";
            }

            this.Icon = "account.png";

            _DataManager = DependencyService.Get<ICustomerDataClient>();
            _GeoCodingService = DependencyService.Get<IGeoCodingService>();

            MessagingCenter.Subscribe<Account>(this, MessagingServiceConstants.ACCOUNT, (Account) =>
                {
                    IsInitialized = false;
                });
        }
Example #3
0
        public CustomerDetailViewModel(Account account)
        {
            if (account == null)
            {
                Account                  = new Account();
                Account.Industry         = Account.IndustryTypes[0];
                Account.OpportunityStage = Account.OpportunityStages[0];

                this.Title = "New Account";
            }
            else
            {
                Account    = account;
                this.Title = "Account";
            }

            this.Icon = "account.png";

            _DataManager      = DependencyService.Get <ICustomerDataClient>();
            _GeoCodingService = DependencyService.Get <IGeoCodingService>();

            MessagingCenter.Subscribe <Account>(this, MessagingServiceConstants.ACCOUNT, (Account) =>
            {
                IsInitialized = false;
            });
        }
        public OrderDetailViewModel(Account account, Order order = null)
        {
            Account = account;

            if (order == null)
            {
                Order = new Order()
                {
                    AccountId = Account.Id
                };
            }
            else
            {
                Order = order;
            }

            this.Title = "Order Details";

            _DataManager = DependencyService.Get <ICustomerDataClient>();

            _CatalogDataClient = DependencyService.Get <ICatalogDataClient>();

            DependencyService.Get <ILocalize>();

            MessagingCenter.Subscribe <CatalogProduct>(this, MessagingServiceConstants.UPDATE_ORDER_PRODUCT, async catalogProduct =>
            {
                Order.Item        = catalogProduct.Name;
                Order.Price       = catalogProduct.Price;
                OrderItemImageUrl = null;
                await ExecuteLoadOrderItemImageUrlCommand();     // this is to account for Android not calling OnAppearing() when the product selection modal disappears.
                OnPropertyChanged("Order");
            });
        }
        public LeadDetailViewModel(INavigation navigation, Account lead = null)
        {
            if (navigation == null)
            {
                throw new ArgumentNullException("navigation", "An instance of INavigation must be passed to the LeadDetailViewModel constructor.");
            }

            Navigation = navigation;

            if (lead == null)
            {
                Lead = new Account();
                this.Title = TextResources.Leads_NewLead;
            }
            else
            {
                Lead = lead;
                this.Title = lead.Company;
            }

            this.Icon = "contact.png";

            _DataManager = DependencyService.Get<ICustomerDataClient>();

            _GeoCodingService = DependencyService.Get<IGeoCodingService>();
        }
Example #6
0
        public OrdersViewModel(Account account)
        {
            Account = account;

            _Orders = new List <Order>();

            _DataManager = DependencyService.Get <ICustomerDataClient>();

            OrderGroups = new ObservableCollection <Grouping <Order, string> >();

            MessagingCenter.Subscribe <Order>(this, MessagingServiceConstants.SAVE_ORDER, order =>
            {
                var index = _Orders.IndexOf(order);
                if (index >= 0)
                {
                    _Orders[index] = order;
                }
                else
                {
                    _Orders.Add(order);
                }

                GroupOrders();
            });
        }
        public OrderDetailViewModel(Account account, Order order = null)
        {
            Account = account;

            if (order == null)
            {
                Order = new Order() { AccountId = Account.Id };
            }
            else
            {
                Order = order;
            }

            this.Title = "Order Details";

            _DataManager = DependencyService.Get<ICustomerDataClient>();

            _CatalogDataClient = DependencyService.Get<ICatalogDataClient>();

            DependencyService.Get<ILocalize>();

            MessagingCenter.Subscribe<CatalogProduct>(this, MessagingServiceConstants.UPDATE_ORDER_PRODUCT, async catalogProduct =>
                {
                    Order.Item = catalogProduct.Name;
                    Order.Price = catalogProduct.Price;
                    OrderItemImageUrl = null;
                    await ExecuteLoadOrderItemImageUrlCommand(); // this is to account for Android not calling OnAppearing() when the product selection modal disappears.
                    OnPropertyChanged("Order");
                }); 
        }
Example #8
0
        public LeadDetailViewModel(INavigation navigation, Account lead = null)
        {
            if (navigation == null)
            {
                throw new ArgumentNullException("navigation", "An instance of INavigation must be passed to the LeadDetailViewModel constructor.");
            }

            Navigation = navigation;

            if (lead == null)
            {
                Lead       = new Account();
                this.Title = TextResources.Leads_NewLead;
            }
            else
            {
                Lead       = lead;
                this.Title = lead.Company;
            }

            this.Icon = "contact.png";

            _DataManager = DependencyService.Get <ICustomerDataClient>();

            _GeoCodingService = DependencyService.Get <IGeoCodingService>();
        }
        /// <summary>
        /// Initializes and instance of Processor class
        /// </summary>
        /// <param name="client"> customerDataClient that handles the calls to web service</param>
        public Processor(ICustomerDataClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client", "customerDataClient must not be null");
            }

            this.customerDataClient = client;
        }
        public SalesDashboardChartViewModel(INavigation navigation = null)
            : base(navigation)
        {
            _CustomerDataClient = DependencyService.Get <ICustomerDataClient>();

            _ChartDataService = DependencyService.Get <IChartDataService>();

            Orders = new ObservableCollection <Order>();

            WeeklySalesChartDataPoints = new ObservableCollection <ChartDataPoint>();

            IsInitialized = false;
        }
        public SalesDashboardChartViewModel(INavigation navigation = null)
            : base(navigation)
        {
            _CustomerDataClient = DependencyService.Get<ICustomerDataClient>();

            _ChartDataService = DependencyService.Get<IChartDataService>();

            Orders = new ObservableCollection<Order>();

            WeeklySalesChartDataPoints = new ObservableCollection<ChartDataPoint>();

            IsInitialized = false;
        }
        public CustomersViewModel(INavigation navigation = null) : base(navigation)
        {
            this.Title = "Accounts";
            this.Icon = "list.png";

            dataManager = DependencyService.Get<ICustomerDataClient>();
            Accounts = new ObservableCollection<Account>();

            MessagingCenter.Subscribe<Account>(this, MessagingServiceConstants.ACCOUNT, (account) =>
                {
                    IsInitialized = false;
                });
        }
Example #13
0
        public CustomersViewModel(INavigation navigation = null) : base(navigation)
        {
            this.Title = "Accounts";
            this.Icon  = "list.png";

            dataManager = DependencyService.Get <ICustomerDataClient>();
            Accounts    = new ObservableCollection <Account>();

            MessagingCenter.Subscribe <Account>(this, MessagingServiceConstants.ACCOUNT, (account) =>
            {
                IsInitialized = false;
            });
        }
        public CustomerSalesViewModel(Account account, INavigation navigation = null)
            : base(navigation)
        {
            _Account = account;

            _CustomerDataClient = DependencyService.Get <ICustomerDataClient>();

            _ChartDataService = DependencyService.Get <IChartDataService>();

            Orders = new ObservableCollection <Order>();

            WeeklySalesChartDataPoints = new ObservableCollection <ChartDataPoint>();

            CategorySalesChartDataPoints = new ObservableCollection <ChartDataPoint>();

            IsInitialized = false;
        }
        public CustomerSalesViewModel(Account account, INavigation navigation = null)
            : base(navigation)
        {
            _Account = account;

            _CustomerDataClient = DependencyService.Get<ICustomerDataClient>();

            _ChartDataService = DependencyService.Get<IChartDataService>();

            Orders = new ObservableCollection<Order>();

            WeeklySalesChartDataPoints = new ObservableCollection<ChartDataPoint>();

            CategorySalesChartDataPoints = new ObservableCollection<ChartDataPoint>();

            IsInitialized = false;
        }