Example #1
0
        public ErpKpiViewModel UpdateKPI(ErpKpi kpi)
        {
            ObservableCollection<ErpKpiViewModel> list = null;
            ErpKpiViewModel viewKpi = null;

            if (kpi == null)
            {
                return null;
            }

            if (kpi.Channel.Equals("Sales"))
            {
                list = SalesItems;
            }
            else if (kpi.Channel.Equals("CashFlow"))
            {
                list = CashFlowItems;
            }
            else if (kpi.Channel.Equals("Expense"))
            {
                list = ExpenseItems;
            }

            if (list != null)
            {
                foreach (ErpKpiViewModel item in list)
                {
                    if (item.Type.Equals(kpi.Type))
                    {
                        item.Total = kpi.Total.ToString("C");
                        item.NumberOf = kpi.NumberOf.ToString();
                        item.Last = kpi.Last.ToString("C");
                        item.Largest = kpi.Largest.ToString("C");
                        item.Smallest = kpi.Smallest.ToString("C");
                        item.Average = kpi.Average.ToString("C");

                        return item;
                    }
                }

                viewKpi = new ErpKpiViewModel(kpi);

                list.Add(viewKpi);
            }

            return viewKpi;
        }
Example #2
0
        private void OnUpdateKPI(ErpKpi kpi)
        {
            if (kpi != null)
            {
                Dispatcher.BeginInvoke(() =>
                {
                    ErpKpiViewModel viewKpi = App.ViewModel.UpdateKPI(kpi);

                    if ((viewKpi != null) && (_ActiveControl != null))
                    {
                        for (int i = 0; i < _ActiveControl.Items.Count; i++)
                        {
                            ListBoxItem item = (ListBoxItem)(_ActiveControl.ItemContainerGenerator.ContainerFromIndex(i));

                            if ((item.DataContext != null) && (item.DataContext is ErpKpiViewModel))
                            {
                                if (viewKpi.Type.Equals(((ErpKpiViewModel)item.DataContext).Type))
                                {
                                    StartAnimation(item);
                                }
                            }
                        }
                    }
                }
                );
            }
        }
Example #3
0
        private void SalesChannel_DoubleTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            ErpKpi k = new ErpKpi();
            k.Channel = "Sales";
            k.Type = "Orders";
            k.Total = 1345.23M;

            OnUpdateKPI(k);

            OnAlertUpdate("Sales", string.Format("This is a test {0}", Environment.TickCount));
        }
Example #4
0
 public ErpKpiViewModel(ErpKpi kpi)
 {
     if (kpi != null)
     {
         _Type = kpi.Type;
         _Channel = kpi.Channel;
         _Total = kpi.Total.ToString("C");
         _NumberOf = kpi.NumberOf.ToString();
         _Last = kpi.Last.ToString("C");
         _Largest = kpi.Largest.ToString("C");
         _Smallest = kpi.Smallest.ToString("C");
         _Average = kpi.Average.ToString("C");
     }
 }