Based on the examples from the Internet I made this database, but I have some problems using it
How should I add ExtraItem to the order?
For example if I put in my orders a food item then I send a POST request to the server which returns a new created entry. What should I do next in order to add an Extra to that order? I have FoodItemExtraId but I don't know the OrderFoodItemId to make a POST request to OrderFoodItemExtra table.
Or maybe this schema is not correct?
Related
I am working on a web app (using webForms not mvc) that takes user input and adds it to a database table. This app will be available to users in a dev, qa, and production environment hitting each environments own database.
Currently, I have a promote button that works by connecting to the QA database from Dev or the Prod database from QA inserting/updating the data there and then redirecting to the QA/Prod version of the app.
Instead of doing it this way I would like to save myEntity in a variable and send it with the redirect. I'm thinking something like this:
MyEntityType myEntity = UserInputData();
Response.Redirect("myQAurl", myEntity);
Then in my QA Page_Load have something like:
If( fromDev ){
loadPageWithMyEntity();
}
By doing it this way I hope to prevent QA/Prod database connections directly from dev --> QA or QA --> Prod.
If passing an Entity wont work I could also use an array, list, etc.
When doing a redirect:
Response.Redirect("myQAurl", myEntity);
The way that works is that the server basically tells the browser to make a GET request to the supplied URL. Which means that any information sent over that redirect has to be in the query string on that URL. So you would have two options:
Include a bunch of key/value pairs in the query string which can be used to re-construct the entity on the other end.
Serialize the entity to a string and have one key/value pair with that as the value, then de-serialize to the entity on the other end.
If the entity is large, this could be problematic. There's a reasonable limit to the size of a URL in most web servers.
For large entities, to truly transfer from one system to another where they don't share any back end you would likely need a POST request. Which can't be done with a redirect. Instead, you would show the user a form (which could be entirely hidden and invisible, so not necessarily shown) and the user would have to post that form (which could be done with JavaScript, so not necessarily the user posting it).
Beyond those, you're likely looking at a back-end hand-off, such as storing the data in a temporary database location on one system and consuming it on the other.
I have a really long webAPI request that basically does the follow :
1. retrieves a list of item categories from the db
2. for each category, retrieve all the items in the category
Now, the entire process takes a very long time and I don't want the user to wait till the entire process is over, if a category has finished loading I want it to return to the client
Does anyone know how I can do that? Send a request and get progress notifications by the server whenever a part of the request has finished?
You could use SignalR to send the data from the server to the client when it's available.
The other option is polling from the client. The client makes the initial request, which triggers a server side process that prepares the data and keeps it somewhere (in memory, in a database). Then the client polls the server for new available data until the server process finishes.
you need to break your request. use for loop. if elements from first category are downloaded then do something with them before going for second category.
so your request will go inside some loop. You can use Jquery or page methods if you are using asp.net webforms
PushStreamContent might help you:
http://weblogs.asp.net/andresv/asynchronous-streaming-in-asp-net-webapi
I am using C#.NET Web API for my iOS application but I have concerns about multiple requests arrive at the same time.
Let's assume I try to prevent duplicating records while inserting a new record into Users table by:
Check if xxx#example.com exists in the Users table.
Insert if not exists.
Return OK.
Actually it's that simple unless web api runs async.
What if related web api method gets two requests at the same time (with same e-mail request) and when the first request reaches step 2 (but not executed yet) and second request will get "not exists" response since step two for first request has not been executed yet. Then two e-mail address will be saved and I will have duplicated records.
Using lock on static object seems will solve the problem but it will create performance issues.
If I don't want DB to get rows duplicated, how can I overcome by that problem?
UPDATE:
I can't use unique constraint on e-mail column due to I already have it on Id column.
If you make the email address in your table have a unique constraint then all you have to do is insert the email address, if it already there it will fail, if not you will have inserted a new record.
You need to handle the failure maybe respond with some appropriate code to the client so it knows email already exists.
Moving at snail's pace I started creating sample MVC app for printing website like vistaprint. I created a database with three tables, Client, JobType, Job.
Client table has ClientId, Name, Address
JobType is a look up table with types LetterPrint, CardPrint.
Job has clientId and jobtype id and fileformat.
Then created a EDMX file with all the table.
Now trying to create controller. How many controller do I need assuming that I will need to create a Client, and a Job. Job Type table will be updated using sql script?
I guess 1 controller for Client and Job each .
How many views I will need?
I think 3 for each of client and job. List, Create(update), Delete(readonly mode).
Am I going in right direction?
Thanks in advance.
In suggestion that there be a some person (administrator or someone) who will create clients and create jobs asked by client I'll build such views:
Jobs:
List of jobs. Can be filtered to show jobs asked by one client. One view, filtering happens in model/controller. There must be additional usually empty string about criteria of filtering. Of course, paging and another features should be enabled.
Create job. Client id can be setuped before rendering view (when it was linked from some client). If not setuped, we must provide autocomplete search by client names. How it looks: admin types client name and in down, in some div with ajax list of clients loaded. So there must be one another action that returns filtered list of clients in JSON.
Edit job
Remove job.
Clients:
List of clients. Paging, sorting, filtering. At each client must be link to jobs asked by client and link to create new job;
Create client
Edit client
Remove client.
If client can login and ask for creating new job, there are must be additional views:
Register page
Login page
After login client must see only his jobs and their status and perhaps dunno about possibility (and have no such possibility) to reset filter. Perhaps, there can be special view for that, but I guess that there is need only in different filter setting in index action of jobs controller.
Special administrative actions must be marked with AuthorizeAttribute. Of course, there are a lot of possibilities to done it, but I think that this is nicest. Questions?
this is our first time using the Amazon MWS (or any API for that matter) and we want to pull all of the unshipped orders from our seller account. We've tried using many different methods (RequestReportRequest, with this link: http://www.amazonsellercommunity.com/forums/message.jspa?messageID=2370410, and more) but none seem to work. Is there a simple way to access our unshipped orders using C#?
Thanks for the help.
Should be the same in all supported languages.
You can request an report using the RequestReport API operation with ReportType being set to _GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_ . As a response you get a ReportRequestId which you store.
Next you periodically check the status of your report request by calling the GetReportRequestList operation, probably with the parameter ReportRequestIdList containing your ReportRequestId. The response tells you in which ReportProcessingStatus the reportRequest is. According to the sellercentral webpage it can take up to 45 minutes to finish a report.
Once the ReportProcessingStatus is DONE, you need to get the reportId. For this purpose you use the GetReportList operation with the parameter ReportRequestIdList set to your ReportRequestId. The response contains the reportId
Finally, you get your report by calling GetReport with the reportId you got in step 3.
For more details, have a look in the MWS API reference