Пример #1
0
        /// <summary>
        /// Gets the data from server.
        /// </summary>
        /// <remarks>
        /// Build paging and sort parameters
        /// </remarks>
        private void GetData()
        {
            WSEntryManagerClient wsClient = Globals.NewWSClient;

            int firstResult = DataList.PageIndex * DataList.PageSize;
            int maxResult   = DataList.PageSize;

            if (null == this.SearchText)
            {
                wsClient.getByCondition_MediaCompleted += (s, e) =>
                {
                    if (null != e.Error)
                    {
                        // TODO: error handling
                        return;
                    }
                    LoadData(e.Result);
                };
                wsClient.getByCondition_MediaAsync("id", true, firstResult, maxResult); // Always order by "id"
            }
            else
            {
                wsClient.searchByText_MediaCompleted += (s, e) =>
                {
                    if (null != e.Error)
                    {
                        return;
                    }
                    LoadData(e.Result);
                };
                wsClient.searchByText_MediaAsync(this.SearchText, firstResult, maxResult);
            }
        }
Пример #2
0
        public DashBoardPage2()
        {
            InitializeComponent();

            DateTime startTime = DateTime.Now.AddDays(-7);

            WSEntryManagerClient wsClient = Globals.NewWSClient;

            wsClient.getNewUserTrendCompleted += (s, e) =>
            {
                ColumnSeries cs = TestColumnChart.Series[0] as ColumnSeries;
                cs.ItemsSource = e.Result;
            };
            wsClient.getNewUserTrendAsync(startTime, HappyDog.SL.Beelun.Shoppro.WSEntryManager.timeAccuracyEnum.DAY, 7);
        }
Пример #3
0
        public DashBoardPage1()
        {
            InitializeComponent();

            DateTime startTime = DateTime.Now.AddDays(-7);

            WSEntryManagerClient wsClient = Globals.NewWSClient;

            wsClient.getSalesByBrandCompleted += (s, e) =>
            {
                PieSeries ps = BrandSalesPieChart.Series[0] as PieSeries;
                ps.ItemsSource = e.Result;
            };
            wsClient.getSalesByBrandAsync(startTime, HappyDog.SL.Beelun.Shoppro.WSEntryManager.timeAccuracyEnum.DAY, 7);
        }
        /// <summary>
        /// 'Delete' button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Delete_Button_Click(object sender, RoutedEventArgs e)
        {
            if (this.selectedItemId != null && this.selectedItemId.Count != 0)
            {
                ShopproHelper.ShowBusyIndicator(this);

                WSEntryManagerClient wsClient = Globals.NewWSClient;

                wsClient.removeMany_BrandCompleted += (s, e1) =>
                {
                    // Won't check status. Do this in any event
                    this.selectedItemId.Clear();
                    this.NeedUpdateTableData = true;
                    this.NeedUpdateTableUI   = true;
                    this.BeginUpdateEntireUI();
                };
                wsClient.removeMany_BrandAsync(this.selectedItemId.ToArray());
            }
            else
            {
                ShopproHelper.ShowMessageWindow(this, "Warning", "There are no selected records.", false);
            }
        }
Пример #5
0
        /// <summary>
        /// Get total item count from server
        /// </summary>
        private void GetTotalItemCount()
        {
            WSEntryManagerClient wsClient = Globals.NewWSClient;

            if (null == this.SearchText)
            {
                // TODO: where to release h1?
                EventHandler <getAllCount_MediaCompletedEventArgs> h1 = (s, e) =>
                {
                    DataList.TotalItemCount = e.Result;
                };

                wsClient.getAllCount_MediaCompleted += h1;
                wsClient.getAllCount_MediaAsync();
            }
            else
            {
                wsClient.searchByTextCount_MediaCompleted += (s, e) =>
                {
                    DataList.TotalItemCount = e.Result;
                };
                wsClient.searchByTextCount_MediaAsync(this.SearchText);
            }
        }