Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["userName"]))
            {
                TextBox1.Text = Request.QueryString["userName"];
            }
            else
            {
                TextBox1.Text = "NO DATA PROVIDED";
            }
            string value = "UseDevelopmentStorage=true";
            CloudStorageAccount cloudStorageAccount =
                CloudStorageAccount.Parse(value);
            CloudTableClient cloudTableClient
                = cloudStorageAccount.CreateCloudTableClient();

            cloudStorageAccount.CreateCloudTableClient().
            CreateTableIfNotExist("ProductTable2");

            svc = new ProductDataServiceContext(cloudStorageAccount.
                                                TableEndpoint.ToString(), cloudStorageAccount.Credentials);
            //TextBox2.Text = "No Item";
            count = 5;
            display_item(0);
        }
Exemple #2
0
        /*client
         * protected void Button2_Click(object sender, System.EventArgs e)
         * {
         *  string userName = TextBox1.Text;
         *  //Response.Redirect("~/Buyer.aspx");
         *
         *  Response.Redirect("~/Client.aspx?userName="******"UseDevelopmentStorage=true";
            CloudStorageAccount cloudStorageAccount =
                CloudStorageAccount.Parse(value);
            CloudTableClient cloudTableClient
                = cloudStorageAccount.CreateCloudTableClient();

            cloudStorageAccount.CreateCloudTableClient().
            CreateTableIfNotExist("ProductTable2");

            var product1 = new Album()
            {
                id = 1, name = "the man", artist = "david", startPrice = 10, year = 1970, genre = "pop/rock", formatType = "MP3", bidder = "", bid = 0, seller = "test", status = "available"
            };
            var product2 = new Album()
            {
                id = 2, name = "solo", artist = "lug", startPrice = 70, year = 2009, genre = "classical", formatType = "CD", bidder = "", bid = 0, seller = "test", status = "available"
            };
            var product3 = new Album()
            {
                id = 3, name = "Divnire", artist = "Ludovico Einaudi", startPrice = 30, year = 1997, genre = "classical", formatType = "CD", bidder = "", bid = 0, seller = "ka", status = "available"
            };
            var product4 = new Album()
            {
                id = 4, name = "shady lp", artist = "slim", startPrice = 15, year = 2004, genre = "rap", formatType = "MP3", bidder = "", bid = 0, seller = "test", status = "available"
            };
            var product5 = new Album()
            {
                id = 5, name = "mar lp", artist = "mars", startPrice = 12, year = 2000, genre = "rap", formatType = "CD", bidder = "", bid = 0, seller = "test", status = "available"
            };


            svc = new ProductDataServiceContext(cloudStorageAccount.
                                                TableEndpoint.ToString(), cloudStorageAccount.Credentials);

            delete_all();
            svc.AddObject("ProductTable2", product1);
            svc.AddObject("ProductTable2", product2);
            svc.AddObject("ProductTable2", product3);
            svc.AddObject("ProductTable2", product4);
            svc.AddObject("ProductTable2", product5);

            svc.SaveChanges();
        }