I have a backend application which serves data for windows and android mobile applications, The Service application is hosted as a MobileService on Azure, I have a table named 'todoitem' that is associated to this Mobile service . Now I want to query this table in my controller to check if a particular id is already present in the table if not I will insert it into the table and also send a push notification to the client application. However I am able to insert the data into the table but have no clue of how to retrieve it.
This is the code for insertion
public MobileServiceClient mClient1;
public IMobileServiceTable mToDoTable;
mClient1 = new MobileServiceClient("MobileServiceName", "Key");
mToDoTable = mClient1.GetTable("todoItem");
public void Add()
{
JObject jo = new JObject();
jo.Add("Text", "Hello World");
jo.Add("Complete", false);
jo.Add("id", "123456");
jo.Add("title", "New LED");
var inserted = mToDoTable.InsertAsync(jo);
}
what I want to do now is , I want to query the todoitem table of my mobile service , for example select * from todoitem where id="1234"
Any Help is much Appreciated
Per your other question, here is the link you need: https://azure.microsoft.com/en-us/documentation/articles/mobile-services-dotnet-how-to-use-client-library/
Also, consider upgrading to Azure Mobile Apps!
Related
I am working on a wpf application where I need it to work as a publisher. So I want to publish some data and there will be other devices listening to this data. I am trying to send this data with advertisement and have been following This Link but I am not able to even detect this application in my iPhone app who is supposed to read this published data.
I am trying to add the data as following:
private BluetoothLEAdvertisementPublisher publisher;
this.publisher = new BluetoothLEAdvertisementPublisher();
ushort id = 0x1234;
var manufacturerDataWriter = new DataWriter();
manufacturerDataWriter.WriteUInt16(id);
var manufacturerData = new BluetoothLEManufacturerData
{
CompanyId = 0xFFFE,
Data = manufacturerDataWriter.DetachBuffer()
};
publisher.Advertisement.ManufacturerData.Add(manufacturerData);
publisher.Start();
Edit:
Do I need to create some characteristics too? I found a tutorial on MSDN about this and using smaple code I am able to send the characteristics but I am still not able to advertise my custom data to other devices.
I am trying to figure out how to send notifications to my ios application users using AWS Simple Notification Service.
When I look at the Application Endpoint in the web app I see:
For each registered device I am going to store our unique userId in the User Data section. Then I will want to send a push like so:
public AmazonPushProvider(AmazonProviderObject provider)
{
_client = new AmazonSimpleNotificationServiceClient(provider.AWSAccessKey, provider.AWSSecretKey);
_appARN = provider.AppARN;
}
public void SendApplePush(string apsJson, int[] userIds = null)
{
var iOSModel = _client.ListEndpointsByPlatformApplication(new ListEndpointsByPlatformApplicationRequest { PlatformApplicationArn = _appARN });
foreach (var endpoint in iOSModel.Endpoints)
{
if (endpoint.???)
}
}
The problem is ListEndpointsByPlatformApplicationRequest doesn't seem to return a User Data property. How do I get the user data property from the list of endpoints by platform application?
Once you have the platform endpoint Id you can call GetEndpointAttributes()
Which returns a response with the following info:
Gets and sets the property Attributes.
Attributes include the following:
CustomUserData -- arbitrary user data to associate with the endpoint. Amazon SNS does not use this data. The data must be in UTF-8 format and less than 2KB.
Enabled -- flag that enables/disables delivery to the endpoint. Amazon SNS will set this to false when a notification service indicates to Amazon SNS that the endpoint is invalid. Users can set it back to true, typically after updating Token.
Token -- device token, also referred to as a registration id, for an app and mobile device. This is returned from the notification service when an app and mobile device are registered with the notification service.
I'm trying to learn c# and asp.net webforms and am working on an application that is similar to how reddit or facebook might function. Users have the ability to create accounts, send and accept friend requests, leave wall posts etc.
I have implemented the ability to send a friend request, but am stuck on the part where a user can accept the request. Here is the c#:
using (Database.DataModelDataContext db = new Database.DataModelDataContext())
{
//Guid RequesterId = new Guid(Request.QueryString["ID"]);
CRANK.Database.Friendship RequestAccept = new Database.Friendship
{
ID = Guid.NewGuid(),
UserA = base.UserId,
UserB =
};
db.Friendships.InsertOnSubmit(RequestAccept);
db.SubmitChanges();
}
So as you can see, UserA would be added to the database with the logged-in users ID. I can't figure out how to get the information for UserB or the person that the original friend request was sent from. I'm assuming we can somehow grab it from the code in asp.net.
So the ID was stored in a CommandArgument. I used this code:
Guid userRequested = Guid.Parse(e.CommandArgument.ToString());
UserB = userRequested
I'm working with windows phone apps using windows azure as database and is there any windows azure script to return back to my windows phone apps an id that created automatically by windows azure? so i can catch the id value and use it in my windows phone? instead of calling these method that I think maybe slow
addressItem = await addressTable
.Where(table => table.placeId == hereRestDetail.placeId)
.ToCollectionAsync();
When inserting data to a Table with autogenerated Id in Azure, once insertion finished the Id is sent back to client application. So you can simply get the Id from the same object model used for insert operation :
.....
await addressTable.InsertAsync(addressModel);
var generatedId = addressModel.Id;
.....
[Reference]
I am fairly new to Sitecore Analytics and I ran into situation where I want to save some Analytics data once a REST Service is called.
I am using Fiddler to call POST REST Service. Within REST Service (I have followed a similar article Sitecore Analytics: Trigger profiles and events from webservice), I wrote the following code. I am passing the correct dummy eventName MLN360_BLDG_CLK_EN, which I have create under /sitecore/system/Settings/Analytics/Page Events/
void TriggerPageEvent(string eventName)
{
if (!Tracker.IsActive)
{
Tracker.StartTracking();
}
Sitecore.Data.Database db = Sitecore.Configuration.Factory.GetDatabase("web");
Sitecore.Context.Item = db.GetItem("/sitecore");
PageEventData pageEventData = new PageEventData(eventName);
pageEventData.Text = "Value is here";
pageEventData.DataKey = String.Empty;
pageEventData.Data = " Data is here";
pageEventData.ItemId = new Guid(Sitecore.Context.Item.ID.ToString());
Tracker.CurrentPage.Register(pageEventData);
Tracker.Submit();
}
However, I don't seen any records in PageEvents table at all. If I use this code and paste it in a Item(.aspx page) that has Presentation layout assigned and call this Item (.aspx page) using web browser, the record is added to the database
How can I register event using webservice and also, how can I test it using client like Fiddler?
Thank you
The issue was with using the Fiddler, as they say "Half knowledge is extremely dangerous". I instead switched to Simple REST client extension of Chrome to make the requests and I could see the events in the Page Events Table.