Exemplo n.º 1
0
 public string CustomDataUpdate()
 {
     ProxomoApi api = Prox.api;
     //create a custom data (CD)
     MyCustomData mcd = new MyCustomData();
     mcd.Data = "test data";
     mcd.TableName = "TestTable";
     mcd.Date = DateTime.Now;
     //add the data and get the id
     string id = api.CustomDataAdd(mcd);
     //get the CD obj
     MyCustomData mcd1 = api.CustomDataGet<MyCustomData>("TestTable", id);
     mcd1.Data = "new data"; //change some value
     api.CustomDataUpdate<MyCustomData>(mcd1); //update the data
     //retreive data and print out
     MyCustomData mcd2 = api.CustomDataGet<MyCustomData>("TestTable", id);
     string s = "After update: " + mcd2.Data;
     return s;
 }
Exemplo n.º 2
0
        private void GenerateData(ProxomoApi api)
        {
            //MyCustomData represent the schema of the data you want to add
            MyCustomData cd = new MyCustomData();

            //some sample data
            for (int i = 0; i < 5; i++)
            {
                cd.TableName = "MyCustomTable";
                cd.Data = "data " + i;
                cd.ID = "";
                cd.Date = DateTime.Today.AddDays(i);

                //call api.CustomDataAdd to add data
                api.CustomDataAdd<MyCustomData>(cd);
            }
        }
Exemplo n.º 3
0
 public string CustomDataDelete()
 {
     ProxomoApi api = Prox.api;
     //create a custom data (CD)
     MyCustomData mcd = new MyCustomData();
     mcd.Data = "test data";
     mcd.TableName = "TestTable";
     mcd.Date = DateTime.Now;
     //add the data and get the id
     string id = api.CustomDataAdd(mcd);
     //delete the data
     api.CustomDataDelete("TestTable", id);
     //try get data again
     string s = "";
     try
     {
         MyCustomData mcd2 = api.CustomDataGet<MyCustomData>("TestTable", id);
     }
     catch
     {
         s = "custom data with id " + id + " not found => delete success";
     }
     return s;
 }