how to dynamically add a row in database through web service - c#

I have two windows application in C# one user side and other admin side..When I run the windows application at the user side, it should make a web service call and through web service it should add a row into the database present at the admin side..Also the row that is to be added in the database should be containing the details entered by the user..can any1 please tel me whether this is possible or not and if yes then how??

Make a WebService method that takes values of the parameters you need to add to the database. You call this method from users application and pass all the needed information like to a normal method. Then implement the methods body to use this information to add a row in the db table. What exactly do you mean by how? Which part?
EDIT: If you are new to web services then this task may not be straight forward for you. I am a Java programmer so I won't help you with the coding in C#. You might want to read more on WCF which is an important API for a C# developer and might help you both with WebService and Database access. You can find lots of tutorials on the internet to implement both. You can also choose a different approach than WCF but i think its the best choice if you want to stick with C# for longer. This might be very helpful for you:
WCF, Web services or ADO.NET data services: What shall I use?

Related

Retrieve data from API of different source systems using C#

I am here for your help. First time handling a task about the API, SAP/SOAP, Web services. Sorry, as this is a long post. Let me explain the workflow.
XYZ Server calls the API Application (which I need to develop) to obtain the UserIDs.
These UserIDs will be used to retrieve the data from API of 3 different source systems (ABC, PGS, KGT). ABC and PGS are using RestAPI while the KGT is using SOAP.
The retrieved data will be stored in the In-Memory.
The API Application will insert all the APIs in the In-Memory to the XYZ server.
Here's my question:
Is it possible to use only the VS Code for the development?
There's no database provided. How am I able to store the retrieved data into the memory?
Based on the workflow, is it possible to develop the API application in just a week? Given that I am only a newbie?
I just need your ideas on how I am going to start the development. Currently, I already have a method to get the user ID and to insert the data back into the XYZ server.
Note: The API Application is a non-UI. It serves or acts as a middleman, to transfer data from other systems to XYZ system.
Appreciate your response.
I don't know if it helps but I will try to help you.
First, I think it i totally possible to only use VS Code as you are just coding an API.
Second, have you though about having an in-memory database like Redis?
Third, I think it depends. It is possible to do that in a week at least for more experienced people, but as a "newbie" as you said, I think maybe some more time might be needed.
Hope it helps ^^

Storing and Reporting on data retrieved from an API

I have a very high-level, generic question related to the retrieval of data with an API, the storage of that data, and the ability to report off of the data. My background is primarily on the database side with a specific focus on reporting out of Crystal. That being said, I'm fairly green when it comes to APIs, SDKs, .NET, and Visual Studio, so feel free to respond as if I'm 5.
I've attached a quick mock-up of the application architecture for context. The vendor we're working with touts their APIs as the best way to retrieve data for reporting purposes, but I'm struggling with visualizing the layer between raw API data retrieval and a reporting environment. Having not worked with API data retrieval in the past, can someone explain to me in layman's terms how this process would work?
1.) How would I go about retrieving data from the app server via the vendor's API? Is it as simple as creating a visual studio project and coding the API call?
2.) Let's say I'm able to retrieve the data with an API call, what is the best method for storing / reporting against that data? Is it possible to develop real-time reports out of visual studio with API call data?
3.) If #2 is not possible, the data pulled from the API calls will have to be stored somewhere. Is it possible to code the API calls to write results directly to a separate reporting datamart?
Again, I apologize if these questions are extremely elementary. I'm basically looking for context around the scenario to identify how close or rather far off I am in my understanding.
Any help is appreciated.
Thanks!
i´m going to try to answer each question as high level as possible:
1) Retrieving the data via the API is fairly simple, you need to code the call with a proper requerst and handle the response, for example if your API is exposed with a REST web service all you need to do is make an http call to the ws endpoint according to the service definition.
2) You said that the report requirement is probably a SSRS report. The way to proceed depends on how you want to handle this data. One approach culd be to store it in a database and then create a report server project that generates reports with this data.
3) Yes, according to the data format you can do whatever you want with it, from exporting a csv file to store it inside a dedicated database.
I hope this was useful in some way, as i´m not super experienced in report generation but have worked with different APIs handling data

WCF synchronization between WPF client and server best practices

I am new in sync-ing data between the server and the client, so I want to ask for your advise on how would be better to achieve it. (Best Practices).
I created WPF app, which will be getting data (via WCF) from Web Server and stored them in local database. In future I will sending new or edited data to server.
When I start up my app, I need get new data that I don't have, but it's on the server.
But getting all data every time is redundant, so I need to get only new data.
Also some data maybe changed on server, so I need to get these data as well. And so on.
Questions:
Could you please give me a guidance on how should I do that or any useful resource I can read and learn about it? Do I need to use some particular framework?
Take a look at SyncFramework.
Also, this section will be useful.

wcf service(REST or SOAP or WEB API) thats accepts any data in any structure

I am trying to build a service/API. In my scenario there will be a lots of devices that monitor health. For example a heart beat monitor will monitor heart beats send out heart beat data. A pulse rate monitor will monitor pulses send out data and similarly you can magine a lot of devices thats send out data to my service in their own format. The service/API i am trying to build should be able to accept data in any format and store it in a azure table or blob storage. Any pointers on how to get started with this design would be helpful. I am also not sure if asp.net web api or WCF will be a better choice.
Also there is no business logic there in the service i have mentioned. From the service perspective i dont have to know the data's structure. All i have to do is to persist it it and retrieve it when asked for. Nothing more
Considering that you're (eventually) going to have to know what that data is, I would recommend to define each of them as you encounter them and then process that data.
Pay now or pay later.
Some things to think about ...
You are still going to need to be able to identify which data is which, so the minimum you can get away with is a structure with an Id or Name field and then the string data you mention which would contain the rest of the any format data.
So you either need the submitter to understand that format and send it in with the Id or Name field, or you need to set up multiple methods for the users to call when submitting data to the service like:
.addHeartBeat()
.addPulseRate()
etc ... and have that method add the Id or Name to your data. Then you would need a corresponding way to request that data back - using the same structure (either the user needs to know the Id, or to call a specific method). You also need to consider what other criteria the requester might use like date ranges, particular patient etc .. then all those possible filter fields need to be separate from the blob data in order to efficiently query it.
Looks like you want to build a file upload load service that accepts any kind of file and store it in blob (literally you can treat everything you want to monitor as a file). First of all, consider to generate SAS and allow client to upload the files to blob storage directly. This can save some effort, and give a better performance. If that’s not an option, then use ASP.NET Web API. While WCF also supports REST, in the long run, it is recommended to use ASP.NET Web API to build new RESTful services. WCF can be used to build SOAP services, but SOAP requires the client to send SOAP envelops rather than arbitrary data.
Best Regards,
Ming Xu.

WCF for web sites?

I'm working For my company on a .NET N-tier architecture and have several questions. Basics: the project should be split into layers and should not allow tues develop as easy as possible additional modules for modules like logging, ratings, user management etc.
Environment: VS2010, EF4, SQL Server 2008, LinqToSql, c#
Current situation is as follows:
I have a Data Access Layer WHERE I'm using Entity Framework Tues access database ENTITIES.
then I have a Bussines Layer, with all the logic Insert, update, delete and additional methods for searching etc.
The next layer is for WCF Service Contracts
Finally there is a presentation layer (desktop and web).
First I have created a desktop application. After adding a service reference and presentation layer on the left side in the datasources tab all shown all the tables from the database. This is great.
Then I used a datagridview and bound his DataSource to WCF with bindingsource and finally the wizard to order columns etc. This worked fine.
The next try was to make a web site with the functionality itself. Despite the fact that I added a WCF service reference, datasources are not displayed, therefore it is not possible to use the wizard for quick changes and all the stuff must be coded! This work is difficult and needs a lot of code to serve with basic operations like insert, update, delete. But if I add a reference to the Data Access Layer and add in the web.config a connection string, then I can use the wizard. But then, access to datasource (DAL) does not take place through WCF.
I found out that in Asp.net Dynamic Data web site has a basis for insert, update and delete done. It would probably use this a better or I am wrong?
Question 1: Should the DAL for .edmx use the auto generated code (code generation add items)?
Question 2: How to to get the same DataSources (in the tab) as in the desktop application?
Question 3: Is it possible to use WCF in conjunction with Telericks DataGrid as it already supports Ajax by default, insert, update and delete operations?
Question 4: How to design architecture that will support modularity?
I have spent hours and hours to find concrete informations about this, and still don't know what's the correct and best way. I was searching for articles, where solving of such specific problems would be demonstrated, but didn't found.
I really hope, to get answers/help from you.
Any help is welcome and thanks in advance.
Greetings
Yes, as long it gets your work done, otherwise extend.
This seems purely design related question; but if you are using telerik, I hope you can find the same for web as well as desktop.
Yes. But you will have to tweak the objects returned from web service to set into the telerik datagrid datasource.
You've already torn it down to business, data, and ui level; so its somewhat modular already. ASP.NET MVC can be your best bet. You can also consider using ASP.NET Modules to keep the concerns separate logging, authentication.

Categories