private void Refresh(object sender, RoutedEventArgs e)
        {
            List <Products>  ProductList;
            PriceInformation priceInformation = new PriceInformation();
            var client = new WebClient();

            //var content1 = client.DownloadString("http://192.168.110.1:8080/OnlineTradeBlotterWebProject/rest/app/getPrices");

            priceInformation = new PriceInformation();
            var    content1      = client.DownloadString("http://192.168.110.1:8080/OnlineTradeBlotterWebProject/rest/app/getPrices1?entitlement=" + entitlement);
            Stream contentStream = GenerateStreamFromString(content1);

            DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List <Products>));

            ProductList = (List <Products>)serializer.ReadObject(contentStream);
            //priceInformation.Show();
            // System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
            // dtDateTime = dtDateTime.AddMilliseconds(ProductList.)
            foreach (Products products in ProductList)
            {
                System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
                dtDateTime          = dtDateTime.AddMilliseconds(products.timeUpdated).ToLocalTime();
                products.timeUpdate = dtDateTime;
            }

            dataGrid.ItemsSource = ProductList;
            // this.dataGrid.Columns[1].Visibile = false;
            //dataGrid.Columns[5].CellStyle= "MM/DD/YYYY HH:MM:SS";
        }
        private void Search(object sender, RoutedEventArgs e)
        {
            List <Products>  ProductList;
            PriceInformation priceInformation = new PriceInformation();
            var client = new WebClient();

            priceInformation = new PriceInformation();
            var    content1      = client.DownloadString("http://192.168.110.1:8080/OnlineTradeBlotterWebProject/rest/app/getPrices1?search=" + txtSearch.Text + "&entitlement=" + entitlement);
            Stream contentStream = GenerateStreamFromString(content1);

            DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List <Products>));

            ProductList = (List <Products>)serializer.ReadObject(contentStream);

            //priceInformation.Show();
            dataGrid.ItemsSource = ProductList;
        }
예제 #3
0
        private void ViewPrice(object sender, RoutedEventArgs e)
        {
            PriceInformation priceInformation = new PriceInformation();
            var client  = new WebClient();
            var content = client.DownloadString("http://192.168.110.1:8080/OnlineTradeBlotterWebProject/rest/app/signin1?userName="******"&key=" + txtPassword.Text);

            if (content != "0")
            {
                //MessageBox.Show("" + content);
                priceInformation = new PriceInformation(txtUserName.Text, content);
                priceInformation.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("User ID or Password is invalid! Please enter correct information.");
                return;
            }
        }
        private void refresh()
        {
            List <Products>  ProductList;
            PriceInformation priceInformation = new PriceInformation();
            var client = new WebClient();

            var    content1      = client.DownloadString("http://192.168.110.1:8080/OnlineTradeBlotterWebProject/rest/app/getPrices1?entitlement=" + entitlement);
            Stream contentStream = GenerateStreamFromString(content1);

            DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List <Products>));

            ProductList = (List <Products>)serializer.ReadObject(contentStream);
            foreach (Products products in ProductList)
            {
                System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
                dtDateTime          = dtDateTime.AddMilliseconds(products.timeUpdated).ToLocalTime();
                products.timeUpdate = dtDateTime;
            }

            dataGrid.ItemsSource = ProductList;
        }