Тёмный

Display Product Data - A TimCo Retail Manager Video 

IAmTimCorey
Подписаться 421 тыс.
Просмотров 27 тыс.
50% 1

Опубликовано:

 

3 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 205   
@nogo1880
@nogo1880 3 года назад
Hey Tim. I know these videos are about 2 years old at this point, but I just stopped the lesson really quick to give you a tip in case someone hasn't already pointed this out to you. Instead of copying a line of code that you want to move, and pasting it where you want it to go, you can put your cursor on the line that you want to move, hold the ALT key, and then while holding the ALT key, you can use the up and down arrows to move the entire line to wherever you need it to go. This only works when moving it within the same class/file. Also, if I need to duplicate a line, I put the cursor on the line I want to duplicate and press CTRL + D, which copies the line directly underneath it. Then I use the ALT key to move it to the area that I want the line to exist. These both work on cs, xaml, sql, txt or most files I've worked on in Visual Studio. Sorry if you already started doing this in later videos, or if you have a reason you don't use it. Figured it would be helpful in case it was neither since I've seen you copy and pasting throughout the 16 videos I've watched so far. And as always, thank you for everything you do!
@IAmTimCorey
@IAmTimCorey 3 года назад
Thanks for sharing. I do often forget these.
@recurringnews
@recurringnews 5 лет назад
Vídeo more awaited than vacations.
@IAmTimCorey
@IAmTimCorey 5 лет назад
I'm glad you finally got it.
@mrt7948
@mrt7948 2 года назад
we must appreciate the time you take to explain things no matter how complicated it gets.
@IAmTimCorey
@IAmTimCorey 2 года назад
Thanks!
@rimmongeorge3587
@rimmongeorge3587 5 лет назад
Well, words are not enough to thank you for these great videos. I watched many courses on Lynda and similar websites. I believe this is the best series of tutorials I have ever seen.
@IAmTimCorey
@IAmTimCorey 5 лет назад
I appreciate the kind words.
@parko1965
@parko1965 4 года назад
This is a really good series, I'm slowly getting the idea of the structure of this solution and what the different parts do. Thanks @IAmTimCorey.
@IAmTimCorey
@IAmTimCorey 4 года назад
Great!
@benezard1454
@benezard1454 3 года назад
Re: duplicating classes between projects (i.e. ProductModel); I understand why you do it, but think this would be made clearer with a slightly differential naming convention e.g. DbProductModel and UIProductModel. Love you're teaching style and incredible resources. Thanks, Tim.
@IAmTimCorey
@IAmTimCorey 3 года назад
You are most welcome. Thanks for watching.
@nakshi_ashik9181
@nakshi_ashik9181 3 года назад
This is great I've been following this course and I've learned so much so far, I'm doing a different project from a retail manager so i wasn't sure if we would diverge at some point, but so far we're still on the same page!
@DoubleDP007
@DoubleDP007 2 года назад
Hey Tim, great video as always. I've given up on SQL's intellisense intermittent faults, you get the same problem in SSMS. What I've found working consistently is to alias your table, you also got a lot shorter intellisense list as a bonus ;-)
@IAmTimCorey
@IAmTimCorey 2 года назад
Thanks for sharing.
@GuySymonds1
@GuySymonds1 4 года назад
Love this and such a great lesson, understand why something is a best practice then understand when it is not best for you. Like everything there is an exception to the rule but to know it is an exception you first have to really understand the rule. It's almost like understanding recursion...
@IAmTimCorey
@IAmTimCorey 4 года назад
I am glad you enjoyed it.
@hank9027
@hank9027 2 года назад
Thank you Tim for your persistent and great contribution to teaching coding, I really benefit a lot from your videos!
@IAmTimCorey
@IAmTimCorey 2 года назад
You are welcome.
@Thunderbuck
@Thunderbuck 2 года назад
Well THAT was dense! I've been trying to do one segment a night but I had to break this one up into a couple of sessions. I really appreciate the effort; if nothing else, this is improving my listening skills considerably 🙂
@IAmTimCorey
@IAmTimCorey 2 года назад
Well done pushing through. Glad you are learning from this series.
@Thunderbuck
@Thunderbuck 2 года назад
@@IAmTimCorey Seriously, this is better than a lot of paid courses I've taken. It almost feels like on-the-job training.
@principedinerezza
@principedinerezza 4 года назад
I ran into an issue with productEndpoint.cs where I forgot to change "/api/User" to "/api/Product". The error was as follows: Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1 After about three hours of debugging and troubleshooting I finally realized my mistake. The debugger does not point to the correct file at all when trying to track down this issue, it points to SalesViewModel.cs at the line "await LoadProducts();". It took me a while to track it down, so I'm sharing my experience for others who might make the same mistake. I love your content and I'm starting to feel more comfortable with C#. Thank you for putting in all this work. (I am a patreon subscriber, but I would like to subscribe to your website "All access pass" once you reenable it.)
@IAmTimCorey
@IAmTimCorey 4 года назад
Thanks for sharing. I'm glad you figured it out. Those are really valuable lessons to learn - how to debug, how to check for minor details, and how to stick with it.
@serghus6317
@serghus6317 4 года назад
Hi Tim, I accidentally come across your awesome course and now catching up. Many thanks for this! This is the best way to pass your knowledge to those who need it. Really appreciate it. Just would like to mention about one small tip from VS 19: If you want to pass anything to constructor (dependency injection), don’t use “ctor”, instead type: private IAPIHelper _apiHelper; select the whole line and use “Ctrl + .” then you will have an option “Generate constructor ’ProductEndPoint(APIHelper)’ Done. Less typing.
@IAmTimCorey
@IAmTimCorey 4 года назад
I actually find it easier to go the ctor route, especially since I'm bringing in multiple items usually.
@patrickdaems6558
@patrickdaems6558 5 лет назад
Thx Tim at work I'm the only one who is glad that it is Monday :-)
@IAmTimCorey
@IAmTimCorey 5 лет назад
I'm glad I brighten your Monday.
@johnsinclair1447
@johnsinclair1447 4 года назад
Outstanding series, Tim. Truly a generous gift you have given everyone. I am learning a lot more with this practical application build than with any book, online course, or videos I have tried. Somewhere in the second-half, I get the error: System.Data.DataException: 'Error parsing column 0 (Id=2c55df43-dff6-4f60-a3db-4973de7e2a4f - String)' It's breaking in the SqlDataAccess.cs file....: public List LoadData....etc. method. Debug says both "connectionString" and "connectionStringName" are good, but the List Rows is null. Everything worked fine through the listing of products in the Sales view at ~ 37 min -- broke somewhere after that, but that doesn't make sense because this appears to be a User Table read problem, and I didn't touch the User table. I have spent 2-days going thru my code, which is an exact duplicate , but still can not locate problem. Will keep at it -- any suggestions appreciated.
@IAmTimCorey
@IAmTimCorey 4 года назад
The first issue sounds like the User table in your database has a data type of int instead of an nvarchar(128). Check the definition in the project but also check the actual table in the database since you are having a publishing error. As for the second error, you are trying to publish changes to your database but those changes would delete data. The script checks for data deletion and fails the publish as a result. This is to protect your data. However, since this is a demo database, delete the records in the table that is the problem (User table) and then run the publish again. My guess is that doing so, you will fix both problems.
@johnsinclair1447
@johnsinclair1447 4 года назад
​@@IAmTimCorey Thanks for the reply Tim. SOLVED -- John is a dope. The UserModel Id property was defined as "Int" instead of "string". I only looked at that 5 or 6 times. Somehow when I copied to the ProductModel, I must have unknowingly changed both the UserModel and ProductModel. The upside is I spent 2 days learning how the app works much better. Thanks again Tim.
@IAmTimCorey
@IAmTimCorey 4 года назад
It happens to us all. I'm glad you figured it out.
@HollandHiking
@HollandHiking 4 года назад
Hi Tim, Thank you for this video. It helps a lot to understand the pattern of how it works. I am looking forward on how you activate a view from a Menu, hopefully this may come soon in one of the enxt lessons (keeps me very motivated :-) ). I would like to suggest to use DataGrids instead of ListBox. For initial testing, this very easy, you can set AutoGenerateColumns to True, and that's all you need to see data. You can develop further, e.g. to use header templates to support filtering, you get sorting for free, you may add rowdetails, you can actually edit the data and save it again etcetera. So, it is as easy to se as a ListBox but have everything in place for more advanced use.
@IAmTimCorey
@IAmTimCorey 4 года назад
Thanks for the suggestion.
@harag9
@harag9 5 лет назад
I'm getting behind, work just gets in the way! Excellent video Tim, thanks man!
@IAmTimCorey
@IAmTimCorey 5 лет назад
I'm glad you enjoyed it.
@andrewthompson9714
@andrewthompson9714 4 года назад
I could be wrong, but I believe the reason you have to use the ItemTemplate is because you are trying to set the ItemTemplate property of the ListBox to be the DataTemplate. If you just drop a DataTemplate in, then XAML assumes it is content. I think the reason your list was not empty was because it contained a DataTemplate object (And it also couldn't find a view for it). I am new to this but this reasoning makes logical sense to me.
@IAmTimCorey
@IAmTimCorey 4 года назад
I don't remember specifically but you may be right.
@olabodebowoto1442
@olabodebowoto1442 5 лет назад
Your videos are very instructive and full of valuable Information.Thanks a bunch!.
@IAmTimCorey
@IAmTimCorey 5 лет назад
You are most welcome. Thanks for watching.
@SuperDre74
@SuperDre74 4 года назад
great video again, but I have a couple of points: 1.You set the database default of QuantityInStock to 1, but IMHO it should be 0 as 1 implies when you add the product you actually already have at least one item of the product, which might not be the case (as in preorder or something like that, or you just want to show the product in your list even though you don't have it and you'll just buy it when a customer wants it (that's sadly how a lot of webshops also work, showing stock they don't have so they show up in listings on other sites). 2.Inconsitency in naming stored procedures, in an earlier video you you named the first stores procedure 'spUserLookup', in this video you name it 'spProduct_GetAll'. So to be consistent it should be 'spUser_Lookup' OR 'spProductGetAll'. 3.Why not an overload of sqlDataAccess.LoadData without the parameters option, as you will use more stored procedures which don't need parameters and IMHO it's much cleaner to use a version of LoadData without the parameters if you don't have them (especially performance wise, no need to create junk we don't use). 4.Difference in return value of the web API, swagger returns it in the order of how the properties are sorted in ProductModel.cs, but calling api/products directly it returns it in alphabetical order.
@IAmTimCorey
@IAmTimCorey 4 года назад
We would only do an insert if we are adding things to the inventory. There won't be a pre-order of inventory listed. That's why I defaulted to 1. You are right about the inconsistent name. I believe I fixed it later but I'll have to check. As for the overload, if we did an overload, we would also need to either have a repetition of code (one passing parameters, one not) or we would at least need to do an if check to see if parameters were passed. Doing that would add complexity to the code that an empty object avoids. I went with simplicity. The order of the properties does not matter.
@stinefelt
@stinefelt 4 года назад
Tim, this was wonderful and I really enjoyed it.
@IAmTimCorey
@IAmTimCorey 4 года назад
Glad you liked it
@michaeleichner9797
@michaeleichner9797 4 года назад
Tim, I believe that the way to get the Select * to expand to it's individual fields, is not control .period, but control R control E
@IAmTimCorey
@IAmTimCorey 4 года назад
Yep, they didn't add the Ctrl+. option (yet).
@mov4736
@mov4736 3 года назад
Thanks :D
@jasoncarpenter1938
@jasoncarpenter1938 4 года назад
Hey Tim, Watching your video series now. I have a new project I'm starting and your approach to using the Dapper library is going to make my new data access layer much more easy to read. Good comment on reducing your server query load by updating the instock quantity field. I'm only about 10 minutes into the video right now, but wanted to write this while I had it on the top of my head. Batching the job to update the available stock on a nightly job is the right approach. I would add a bit field to the SaleDetail table to record whether the batch job has run on the record. Then just have the available stock decremented by the number of records that match your productid in that time period and are unprocessed and then mark the flag in the sale detail table. Should reduce your query overhead by being able to target that specific product id where batchprocessed = false to deduct the available stock on your active sales UI.
@IAmTimCorey
@IAmTimCorey 4 года назад
Thanks!
@mariorod360
@mariorod360 5 лет назад
Tim, you Legend! Your videos are always awesome! A quick little value add for one of your videos might be to show us how to edit or add code snippets to make the creation of properties a little quicker (and avoid little bugs like putting NotifyOfPropertyChanged statements before actually assigning a new value to the field 😁). Really looking forward to your next video.
@IAmTimCorey
@IAmTimCorey 5 лет назад
That's already on my personal list of things I want to get to. I'll bump it up the priority list. Thanks for the suggestion.
@djangounchained7314
@djangounchained7314 4 года назад
Thanks Tim!! I am really learning!!! Keep it up!!
@IAmTimCorey
@IAmTimCorey 4 года назад
You are welcome.
@timothywestern6488
@timothywestern6488 5 лет назад
The stored procedure example is a place, where perhaps an example of creating a default template, with no count already on and begin and end, could be a useful thing to squeeze into one of these lessons.
@IAmTimCorey
@IAmTimCorey 5 лет назад
I'd like to do that at some point.
@mihaimyh
@mihaimyh 5 лет назад
Monday just got my favorite day of the week. Thank you for your efforts on creating this videos. One question: are you going to version your api to avoid breaking the contract between it and the clients consuming it?
@IAmTimCorey
@IAmTimCorey 5 лет назад
I haven't decided yet. Probably. We haven't gotten to that point yet though.
@ahmadkelany
@ahmadkelany 5 лет назад
Tip: @14:08 You can expand the * to the actual column names by right clicking any where in the editor -> refactor -> expand wildcards.
@IAmTimCorey
@IAmTimCorey 5 лет назад
Thanks! I got thrown off by the Ctrl+. not working and didn't think to do that.
@hqcart1
@hqcart1 5 лет назад
Thanks tim! you are a real inspiration!
@IAmTimCorey
@IAmTimCorey 5 лет назад
You are welcome.
@sandorottoplesko4891
@sandorottoplesko4891 5 лет назад
Another awesome video Tim. :) I 'm going to spice our project with some Rx because Caliburn.micro is even cooler with it. Maybe I'm going to add another UI project which uses ReactiveUI MVVM framework which can be used not just for WPF and UWP like Micro. Keep up the good work Tim.
@IAmTimCorey
@IAmTimCorey 5 лет назад
Cool. Let me know how it turns out.
@girornsveinsson7970
@girornsveinsson7970 4 года назад
Ctrl+R, E expands wildcards.
@IAmTimCorey
@IAmTimCorey 4 года назад
Thanks for sharing.
@MBCDC1
@MBCDC1 2 года назад
Well, I regard the data-model as a very simple example and for this demo application it is ok. But in real-world systems this would be much more complex. At least the systems I worked with would for example neither tolerate inventory- or stock data in the main product-table nor would there be price information in the inventory-table(s). The product price is normally not a single static value, but depends as a net price on the underlying calculation scheme and could furthermore be influenced by the customer or customer group that wants to buy the product. So there could be special net-prices for every customer or customer group and on top of that there could be one or more discount schemes attached to the customer or customer group. So, the sales-price is determined and/or calculated at runtime. The same goes for the product purchases. The purchase price depends on the supplier and incoming products are registered at least with supplier, date, price, quantity and sometimes lot- or batch number - which makes the inventory-/stock data-model even more complex. The information is then used to determine the sales price on the basis of the underlying calculation scheme. And on, and on, and on… But also there is the information of product quantity in stock in Tim´s solution. This information is normally not directly affected by the shopping-cart process. We should have at least one other column in the stock table that is called something like “reserved-quantity”. At the moment the customer puts a specific quantity of a certain product into his cart, it still is physically available in the inventory, but is for the moment not available for other customers. So the total quantity the company can offer to a customer is always the physical available quantity minus the reserved quantity. If you remove the product from the cart, the quantity in the cart is then removed from the reserved-quantity and is now again available for other customers, but does not alter the physically available quantity at this moment. When you check out your cart and the delivery-note is printed (or generated as PDF or email and sent to the customer) the product-quantity the customer has purchased is removed from the reserved quantity and finally from the physical available quantity as the product now physically is about to leave the company. If the product could not be delivered or there is a customer-return, the specific quantity will be added to the physical available quantity again the moment the returned product is stored again. But also this system could be far more complex and represents the most simple way to handle this in many wholesale systems. Since the main purpose of this course is to learn the techniques of developing a complete solution, it is OK the way Tim did it!
@MBCDC1
@MBCDC1 2 года назад
​@@suddengun007 I agree with you and think that in our case here the main topic should be (and is) the aspect of a development-cycle. Because of this, my last sentence was: “Since the main purpose of this course is to learn the techniques of developing a complete solution, it is OK the way Tim did it!” Since my professional way was closely connected to the development and maintenance of ERP systems from the conception to the final product for many, many years (if not necessarily connected to the PC world only) I really couldn't help as to at least describe some main aspects of the “real world”. But this was only the “tip of the iceberg" - it would get much more complicated than this… To discuss a simple data model a small to medium-sized business would have to use, would have taken us alone about at least 10 sessions! Well, I don't know yet if Tim will address some of these aspects later in the course, but I accept his “method” and focus on the technical aspects. In this regard, Tim does a great job, and it is relatively easy to follow him and even “understand” what is happening on the screen! 😁
@anthonyclanagan9914
@anthonyclanagan9914 2 года назад
More than once I've heard you reference not being able to use CTRL + . to expand the wild cards thus far in the series. That made me curious as to why this feature wasn't working in your situation. I did a little digging and found that if you highlight the * and right click their is an option to expand the wild card. It's refactor --> Expand Wildcards or CTRL + R,E. Hope this helps going forward.
@IAmTimCorey
@IAmTimCorey 2 года назад
Thanks for sharing.
@vanweapon
@vanweapon 4 года назад
'Details' is a good alternative to 'description'
@IAmTimCorey
@IAmTimCorey 4 года назад
I like it. Thanks for sharing.
@frankbelinga8776
@frankbelinga8776 4 года назад
Hi Tim, It would be nice to included the text of the products added to the db for people like myself that are learning and coding along. Great series and abundance learning ! Thanks
@IAmTimCorey
@IAmTimCorey 4 года назад
You mean which products I add? That can be whatever you want. I can look into creating a startup script, though, for testing systems.
@frankbelinga8776
@frankbelinga8776 4 года назад
IAmTimCorey I just finished the video, actually when you tested the product endpoint the products and their description were all visible 😅. Thank you for the quick reply 🙏🏾 and for putting this together.
@hargreavesc
@hargreavesc 4 года назад
Thanks for putting this course together, it has been incredibly helpful! Question about the 'duplicate' Models. If I were to have a BusinessLogic layer where lots of computations are done on the data, would I want to reference the Models in the UI layer, or create yet another set of Models for use in the BusinessLogic project?
@IAmTimCorey
@IAmTimCorey 4 года назад
Typically the computations would be done on the model, not in the model. If you do need to transform the data in some fundamental way that would include changing which properties are available then yes, you would create a new model for that as well. This is not a very common case, though.
@hargreavesc
@hargreavesc 4 года назад
Understood, is it common for the computations to be done on the models in the UI Library? Or more common to have a business logic project with it's own models (library of models), then the UI displays those models, or has its own if additional display properties are needed?
@charlesabell5382
@charlesabell5382 5 лет назад
I can't express how much I appreciate you doing this series. I am really learning a lot from your instruction. As I was coding along with this one I noticed a diff in UserController.cs at line 15 you have an [HttpGet] which is not present in the video when this file was created. Can you explain the purpose of the command?
@IAmTimCorey
@IAmTimCorey 5 лет назад
That specifies that the call will be a GET command (as opposed to POST, PATCH, etc.) A GET command means you are reading data (the rest are writing data).
@karatekid559
@karatekid559 5 лет назад
I'm sure Tim mentioned it, but for what it's worth make sure the Controller name matches the SQL table name exactly. I missed on letter and it threw everything off.
@IAmTimCorey
@IAmTimCorey 5 лет назад
The SQL table name does not have to match the controller name. The two do not have a relationship. I am assuming you had a naming mismatch between your columns and your model properties. Maybe it was something else.
@karatekid559
@karatekid559 5 лет назад
@@IAmTimCoreyok sorry about that. Quick question, how do we know what to type in the browser after "/api/"? is it the name of our table, or maybe name of the controller?
@IAmTimCorey
@IAmTimCorey 5 лет назад
The convention is the name of the controller, although you can change that if you want.
@karatekid559
@karatekid559 5 лет назад
@@IAmTimCorey Yea that's what threw me off. It's the controller name minus the word controller. That's why I was having trouble. Thank you
@objectaware5296
@objectaware5296 5 лет назад
Finally got this completed - short on time not issues with the lesson. I was wondering if the service api will have other layers such as a repository layer. Presently, the api library layer is serving two purposes library and repository should they not be broken out into separate projects? Also, the communication between the Service solution and the UI solution do not communicate with a Request / Response pattern will that be added? Without it there is no way to communicate the Request from the UI and the Response from the service. Along with that using data transfer objects (DTO) to decouple the domain models - will that be added at some point? If possible, could you provide Project Reference Flow diagrams for Service and UI of the finished solutions? My goal here was to learn WPF with MVVM in a Service Oriented Architecture and so far I'm very pleased. Thanks - I look forward to the next lesson.
@IAmTimCorey
@IAmTimCorey 5 лет назад
I tend to expand out as necessary. Otherwise you have a super-confusing jumble of things to configure and set up before you write a single line of code. We will expand into some of these as necessary.
@Musa1978K
@Musa1978K 3 года назад
Thanks alot
@IAmTimCorey
@IAmTimCorey 3 года назад
Most welcome
@nishan375
@nishan375 3 года назад
Great video and thank you for it. I was trying to do a little investigation about the async await and freezing windows and got into a bit of a confusion. in the SalesViewModel.cs file, LoadProducts() method, I added a Thread.Sleep(10000) to simulate time taken to load the data after a successful login. However, the login form freezes for the duration of the delay. I am not event sure if this is desirable but I would have thought that the screen should still be active during the delay.
@numinaoneiron1655
@numinaoneiron1655 5 лет назад
Just wondering, will this app have a multi-language support. I've always wondered how apps like facebook are able to change all text fields in one language into its equal counterpart in another language.
@IAmTimCorey
@IAmTimCorey 5 лет назад
I would like to add it in. We will see.
@mov4736
@mov4736 3 года назад
I am a bit confused on why did we separate code into library projects. Isn't it the same since the UI/API are pulling their libraries in anyways? Why is the ProductsEndpoint per request rather than a singleton? I can't think of any situation when we would need more than one instance of a single endpoint. In the onViewLoaded event, we placed the await below the base event. wouldn't that make it load an empty view then fill it up?
@nunyabuziness2700
@nunyabuziness2700 3 года назад
I have been thinking about the _apiClient and wondering why dont we create a singleton for it in Bootstrapper.cs? Then we could inject it in both ApiHelper.cs and ProductEndpoint.cs, seems like a more elegant solution as we get rid of the dependency we create in ApiHelper. Is there specific reason why you chose to create an instance of apiClient in ApiHelper?
@CynicalSaint48
@CynicalSaint48 5 лет назад
Hey Tim, this is a great video to get the full process of an implementation. As your data becomes more complex, with the MVVM pattern, is it advisable (or even possible) to start nesting models when your lists of properties grow? As an example, could you have an EmployeeModel, that was comprised of an EmployeeDemographicsModel, and an EmployeeCertificationsModel? Can this be done in a single Sql call, or would it be two Sql calls, that are joined after they are returned? Thanks again!
@IAmTimCorey
@IAmTimCorey 5 лет назад
Yes, that is possible. You can watch my Advanced Dapper video to see the specifics of how to do it.
@mastercompuk
@mastercompuk 5 лет назад
Hi Tim another very good video. Thank you. Would calling ....GetAll ().Result; work directly assign to productList? Or is it better to override method as you did ? I'm looking forward to watch another video with DI.
@IAmTimCorey
@IAmTimCorey 5 лет назад
I avoid the Result method wherever possible. It negates the reason for async and turns the call into a synchronous call. This way, things still load asynchronously. Good question.
@timothywestern6488
@timothywestern6488 5 лет назад
I know by the end of this module I was getting tired of logging in. I might explore how you can set that token while debugging.
@timothywestern6488
@timothywestern6488 5 лет назад
Another thought I had was to do this in the web or app config, so that you can define which view somehow in the config so you wouldn't need this check, just catch that value in the config.
@IAmTimCorey
@IAmTimCorey 5 лет назад
Not sure if it is in this video or an upcoming one, but I do put something in temporarily to make testing easier.
@danirdd92
@danirdd92 5 лет назад
Isn't the convention for async methods to end up with 'X'async()? As a side note, I'm either really tired or this is getting extremely complex, how do you manage to keep all this up ordered in your head, I clearly miss something because I cannot explain to myself why does it work. Maybe a long break and then looking back at the code and messing with it would do the trick
@IAmTimCorey
@IAmTimCorey 5 лет назад
Yes, mostly. The exception is when you are an API and everything you return is async. However, I believe the place you are referring to is the Authenticate method, which should be marked Async. Good catch. As for keeping it all in my head, practice helps but really, I try to review where we are at before I begin. It doesn't take long and it helps keep the relevant details fresh. This is a big project, though, and it will get bigger as we add another UI (or two) and as we move it to .NET Core. Documentation would help, but writing that isn't something you probably want to watch me do.
@kreide847
@kreide847 3 года назад
Is it ok to leave the route hard-coded in the endpoint class or should I create a config file where I can set these routes?
@jonestako4721
@jonestako4721 5 лет назад
Thank you for your videos. I want to watch your playlists. can you please recommend the order of the playlist. PS: I'm just a beginner
@kemmrich
@kemmrich 5 лет назад
if you go here (the playlist for the TimCo Retail Manager series), they are listed in order: ru-vid.com/group/PLLWMQd6PeGY0bEMxObA6dtYXuJOGfxSPx All of his playlists are here: ru-vid.complaylists
@IAmTimCorey
@IAmTimCorey 5 лет назад
Thanks for pointing that out Kevin. Yes, this series is in order in that playlist.
@IAmTimCorey
@IAmTimCorey 5 лет назад
Jones, if you are looking for an order of all of my content, I don't have everything in order (since that isn't really possible), but I do have a general ordering of items in the PDF on this page: www.iamtimcorey.com/p/learncsharp
@jonestako4721
@jonestako4721 5 лет назад
@@IAmTimCorey thanks
@Vitalick15
@Vitalick15 3 года назад
Thanks for your video)
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 года назад
Thanks for watching
@fraymansrandomthings993
@fraymansrandomthings993 5 лет назад
Could have added a column called "BatchQty" to the inventory table.. the inventory table's primary key is not productid but an id, that means that you can have multiple entries of the same productid which makes sense if everytime you get a batch (id would be batchid) you add it to that table.. with this model, you can tell whoever is pulling the part to pull it from batch x; additionally, an increase in price to the customer might set off by a trigger that calculates markup of the item based on the batch's cost (which I thought was the primary reason for the inventory table in the first place)
@IAmTimCorey
@IAmTimCorey 5 лет назад
Interesting suggestion. I’ll think about it. The inventory table’s purpose is to capture whenever we buy things for the store.
@nikoskondylis5618
@nikoskondylis5618 4 года назад
@@IAmTimCorey I would made another table named Stock and put the Product id, SalesQty, InventoryQty (and/or avg/min/max prices) updated (aggregated) when Sales or Inventory item updates. In this scema the Inventory table should be a details table.
@kailgale
@kailgale 3 года назад
@IAmTimCorey In the real world, database entries will be stored across multiple tables with foreign keys e.g. products table may have a ManufacturerId, ProductDetailed, ect. These would require joins to make them intelligible to users. My question is, given the context of this series, when would it be appropriate to join this data? We could do it in our stored procedures and return them through the api calls easily but, it seems like a display detail. Would this be done in the display models in the UI?
@fredgoodrum
@fredgoodrum 4 года назад
FWIW I have gotten into the habit of square brackets around all fields in my MSSQL SQL. Mainly due to expediency.
@IAmTimCorey
@IAmTimCorey 4 года назад
That works, it just makes it harder to read.
@JorgeBlancoPhotography
@JorgeBlancoPhotography 4 года назад
Hello Tim, Thank you for this great tutorial , @1:06 adding I'm getting datatemplete not found not sure how to add the reference
@IAmTimCorey
@IAmTimCorey 4 года назад
There is a spelling error in your term. It is
@onyebuchiboss
@onyebuchiboss 5 лет назад
getting this error - "'Error parsing column 1 " InnerException {"Input string was not in a correct format."} System.Exception {System.FormatException} ",i'm I missing anything Tim ??
@IAmTimCorey
@IAmTimCorey 5 лет назад
My guess is that you have a value that should be a non-string value but the value coming in is a string. So if you try to load FirstName into an ID field, it would error, for example. Look at where the error is occurring and see what you might be mapping incorrectly.
@dalewolver8739
@dalewolver8739 3 года назад
Everything was going great. I was typing along the whole series, then the end of this episode I get a blank items box. The product list looks good. I downloaded the Lesson 16 zip and compared/synced the files with my solution, still no go.. I did not get the exception you did and my data looks good. Bummer.. Using vs2019 vers 16.7.7. Did not see any updates required in the references/nuget..
@dalewolver8739
@dalewolver8739 3 года назад
Still stuck. Seems like the NotifyOnPropertyChange( () => Products); isn't doing anything. I put breakpoints and code in the SalesView.xaml.cs for the Listboxes DataContextChanged event. It triggers a couple times with nulls as the form is being created i assume, then next breakpoint is in the SalesViewModel in the Products property, where the NotifyOfPropertyChanged( ()=> Products); I can see the contents of Products at this point and Stepping through or pressing continue does not return to the SalesView.xaml as far as i know as those DataContextChanged events don't trigger.
@timothywestern6488
@timothywestern6488 5 лет назад
My ctrl . wasn't working in 2017 either, but right click > refactor gives me expand wildcards might be what you need to keybind. Could be something good to show later on.
@timothywestern6488
@timothywestern6488 5 лет назад
For those curious you can do this by going to Tools > Customize, Click Keyboard, IN show commands I typed wildcard and saw an SQL.ExpandWildcards command, then I selected the shortcut for Text Editor (rather than Global) and assigned it to ctrl + r, ctrl + w I'm not sure what the other two commands do that's different. (Also it looks like the editor name for stored procedures might be called Microsoft SQL Server Data Tools, T-SQL Editor in my version of Visual Studio, if you want to make it more specific.)
@IAmTimCorey
@IAmTimCorey 5 лет назад
I think mine was a quirk of the pre-release version I was using. It works now. Thanks for sharing.
@timothywestern6488
@timothywestern6488 5 лет назад
@@IAmTimCorey Maybe, I didn't get 2019 till I started this a few weeks ago, so, I didn't recall it working, maybe it got patched.
@jinjie8682
@jinjie8682 5 лет назад
Hi Tim, will "Category" properties will be added to the Product/Inventory model? It seems inevitable for managing the products when the list grown.
@IAmTimCorey
@IAmTimCorey 5 лет назад
Possibly. We'll have to see but it sounds like a good suggestion.
@sergestevens6034
@sergestevens6034 5 лет назад
Hi Tim, great video as always. The display of the products can be done simpler. In the ListBox tag just add DisplayMemberPath="ProductName". This way you don't have to include the ListBox.ItemTemplate, DataTemplate and TextBlock. I also have a question on navigation in MVVM. If I have a View ( A ) that can be called from two different View ( B & C ). So far in this series, the View to be activate when View A needs to close is determined in ViewModel A. But I can't figure out how to tell ViewModel A whether the originating ViewModel was B or C. Like in WinForms where you can pass this information to the constructor of the called Form. Any plans of covering this in one of the next videos ?
@IAmTimCorey
@IAmTimCorey 5 лет назад
Thanks!
@sergestevens6034
@sergestevens6034 5 лет назад
Hey Tim, did you get my question ? The layout of my comment wasn't the best. Kind regards, Serge
@IAmTimCorey
@IAmTimCorey 5 лет назад
Sorry, I missed it (the RU-vid dashboard cut off your comment - the beta version shows it though). I think the best solution here would be to fire off an event and using the eventing system to send data back to a parent. You really don't want to directly tie the two together if you can help it.
@sergestevens6034
@sergestevens6034 5 лет назад
Hi Tim, thanks for the tip ! My reply is a bit late as I didn't have much C# quality time this week. Anyway, I solved the problem by firing an event in the parent ( calledByXMethodEvent ), having the child subscribe to this event and giving it a property that is set with the name of the parent when the event fires. Thanks again for your advice and all the great videos. You rock ! Kind regards, Serge
@ThatBigGuyAl
@ThatBigGuyAl 5 лет назад
Hi Tim, I'm curious to know if you are going to keep this video series on RU-vid for the near future?
@IAmTimCorey
@IAmTimCorey 5 лет назад
Yes I am. I'll be using it for a while.
@ThatBigGuyAl
@ThatBigGuyAl 5 лет назад
IAmTimCorey Thank you.
@ezeewin6741
@ezeewin6741 4 года назад
Would it be advisable to declare a set of interfaces with the basic properties for a model? Or is it better just to create separate unrelated classes filled with the same properties? Personally, I think it is a relatively good idea as it would reduce the margin of error while allowing me to implement logic relevant to either part of the application.
@IAmTimCorey
@IAmTimCorey 4 года назад
I am not sure I follow. What benefit would an interface give you if you applied it to multiple models?
@lostboysstudios69
@lostboysstudios69 3 года назад
@@IAmTimCorey I think he meant a base class for models and put common things like id, created date, modified date, etc. then inherit from the base class on all of his models.
@christwatt78
@christwatt78 5 лет назад
Hi Tim, Loving the videos. Would it be worth creating an AuthorizedApiController class, have that inherit from ApiController and include the [Authorize] metatag and then have all new ApiControllers inherit from the AuthorizedApiController
@IAmTimCorey
@IAmTimCorey 5 лет назад
We could apply the authorize at the API level and say that everything has authorization by default. Then we could just apply [Anonymous] over any method or class that didn't use authorization. However, as we will see soon, we are still going to need to apply an attribute quite often, since we will be adding in role authorizations.
@kevinmerrell9952
@kevinmerrell9952 Год назад
Lot tracking or serial numbers are the only options.
@sc100200090
@sc100200090 4 года назад
Definitely Excellent! It is this video that made me realize the Caliburn's feature of using Can prefix to enable a control. However, sure would oblige if you could recommend a way to change the said Prefix of "Can" to a Suffix like ".enabled" so as to have more clear/personalized process like "btnCheckOut.enabled" instead of "CanbtnCheckOut"? Sure do appreciate such a matchless guidance. Thanks! :-)
@IAmTimCorey
@IAmTimCorey 4 года назад
I've never tried doing that. I wouldn't recommend it, since it would mean modifying how Caliburn Micro works, which means people who are familiar with CM would struggle to use it properly.
@321zipzapzoom
@321zipzapzoom 4 года назад
By Now I am used to it..So far things are working its always gud to adapt to naming conventions of FW.
@simon_smale
@simon_smale 4 года назад
With prices I’ve always been told to store it in the lowest denomination to then be able to store it as an int. would be interested in your thoughts
@IAmTimCorey
@IAmTimCorey 4 года назад
That can be a good option but it depends on the situation (sorry, that's a default answer for all programming questions and I'm contractually obligated to say it). Mostly I find that storing prices in the money type in SQL works just fine. That way you can get that ultra-precision you need for partial cents (like banks need) or you can just use the typical two places after the decimal (whole cents). With other databases, they don't handle the values well so storing $123.23 as 12323 (no decimal) is the way to go (SQLite is a good example of this).
@_rcs
@_rcs 4 года назад
Do you prefer to do all of your SQL in Stored Procedures even when an application grows large? I am wondering if this leads to lots of T-SQL duplication if you need to create multiple Stored Procedures that are similar to one another but can not be combined into one Stored Procedure.
@IAmTimCorey
@IAmTimCorey 4 года назад
I do. I have found that it enforces discipline in your development. Let's consider the scenario where you decide not to use stored procedures because they cause too much T-SQL duplication. How would you do it? Ad hoc queries in your code? That would still lead to T-SQL duplication, it would just be hidden in your code. A mixture of Ad-hoc queries and stored procedures? Same issue but now the queries are in two different places so it is even easier to hide the duplication (but it is still there or even worse). Some type of query builder? That is a recipe for SQL injection or other nasty surprises and the end result is (dynamic) query duplication and further hidden logic. The only real way to prevent T-SQL duplication (which I don't typically see as an issue) is to do more query work in LINQ after you get the data back. That sounds great but it means that you are using your application server to do what SQL does best (querying and sorting data) and you are passing more data across the wire than you need (extra columns so that other results can also use the same query and extra rows for the same reason).
@_rcs
@_rcs 4 года назад
@@IAmTimCorey Thank you, Tim. That is very insightful.
@bicentrick9989
@bicentrick9989 5 лет назад
i'm intrested in the case if product has a categori how would you build the Database around it?
@IAmTimCorey
@IAmTimCorey 5 лет назад
That’s more than I can put in a comment, sorry.
@timothywestern6488
@timothywestern6488 5 лет назад
(ha finally added the underscore... Did that many many episodes ago :)
@IAmTimCorey
@IAmTimCorey 5 лет назад
:-)
@Nuglets
@Nuglets 4 года назад
Would it be worth considering another table for tracking quantity, rather than adding the quantity to the Product table? I feel like the inventory table should be renamed to something like "Purchases", since it is representing the purchase of items and the "Inventory" table could then be used for actually tracking the inventory so that every time you purchase more items, you increment the inventory and every time you make a sale you decrement the inventory. I'm a novice when it comes to software development and database design, so I'm learning a ton from your videos, but something just doesn't feel right with tracking the quantity in the Product table from a database perspective. Thanks.
@IAmTimCorey
@IAmTimCorey 4 года назад
Good question. This all comes down to complexity. How complex a solution do you want to create. We could create another table for inventory. When you make a purchase, you would subtract from that table. But what if that failed to write? What if the user purchased something and returned it? What if you bought something to put into inventory but half of the load was bad? All of these affect inventory. In the perfect world, we would track them all and have a clear understanding of what is going on with each. However, that adds a lot of complexity to our systems. So instead what we did was to create as simple a system as we could. We use our purchases and sales to affect the inventory number. Instead of calculating that every time, we keep a copy of it (but we can always regenerate it if necessary). This allows us to create a robust application with as little complexity as possible. If we lose inventory, we could just adjust our purchased amounts (if you buy 100 oranges but 10 are bad, you really bought 90 - or at least that is one way to think about it). If a person returns an unopened item, we could void the sale, thus updating our inventory number. So the simple system handles most of the complex scenarios without being complex itself.
@Nuglets
@Nuglets 4 года назад
Thanks for the response, I appreciate it.
@niti2539
@niti2539 5 лет назад
Yes , the things i want is the pattern to follow.
@IAmTimCorey
@IAmTimCorey 5 лет назад
That's what this course is demonstrating. It is giving you the general pattern to follow to build an application (or at least one pattern).
@michaelschannong3755
@michaelschannong3755 5 лет назад
System.Data.DataException HResult=0x80131501 Message=Error parsing column 2 (RetailPrice=ui - String) Source= StackTrace: Inner Exception 1: FormatException: Inputstrengen var ikke i et korrekt format. ( The input string was not in the correct format.) Some who know what I can have done wrong
@IAmTimCorey
@IAmTimCorey 5 лет назад
It looks like you are trying to put a value in the RetailPrice column (which is probably a decimal) but the value you are putting in is not correct (probably a string like "$1.23").
@michaelschannong3755
@michaelschannong3755 5 лет назад
@@IAmTimCorey no but it puts my desc text in Retail Price, can't see why it does
@michaelschannong3755
@michaelschannong3755 5 лет назад
@@IAmTimCorey I just publish the database again so run it again as yours. You do an incredibly good job. will be so happy now that new paragraphs are coming. for have a program where I can get more secure in my planning of how it should be;)
@graithkingg9736
@graithkingg9736 3 года назад
Hi Im here to ask question again So Im trying to tweak the code and try to get specific item using Id $"/api/Product?Id={Id}" but the readAsAsync Always return null StackOverflow tells me that I should deserialize and use original Http Content Like ReadAsStringAsync
@IAmTimCorey
@IAmTimCorey 3 года назад
First, make that specific call manually to be sure it is returning actual data. Next, remember that it is returning one record, not a list of them. Make sure the variable you are capturing it into is just the model, not a list of model.
@meniman98
@meniman98 4 года назад
Hi Tim, I am getting a null exception error at 36:37 when you launch the api/product. It's not showing the products. What did I do wrong
@IAmTimCorey
@IAmTimCorey 4 года назад
Not sure. Do you have records in the database? Did you forget to instantiate a class? What you need to do is use your breakpoints and track down where the exception is happening and inspect the code to see what the values are in the variables and which one is not what you expect.
@johnschut5776
@johnschut5776 4 года назад
I am really enjoying the series and working at catching up. I have run into a small snag trying to debug my implementation of this segment. I get an exception error on the LoadProducts call, in var prodlist = await _productEndPoint.GetAll(); my _productEndPoint is a null object, I tried a breakpoint on where it is set, but only seems to fire before the login screen appears, which is before a user is known or a token is given. Is that correct?
@johnschut5776
@johnschut5776 4 года назад
After several hours of reviewing code and reviewing last 2 installements, I got it to work by pulling in the reference to the container and getting the reference to the endpoint back (the container had the reference...) I have no idea where I went wrong, but fetched the instance of the endpoint back just before the LoadProducts() was called. Hook or by Crook, i'm not sure.
@IAmTimCorey
@IAmTimCorey 4 года назад
Well, I am glad you got it to work.
@brainyexpert8221
@brainyexpert8221 4 года назад
Hi Tim, at 1:14:08 , when I login my data is not appear inside the listbox , but when I click on the list box I can see highlight as if text is there but I can't see it appear, I have debug it data is coming in when I attach breakpoint on sales view model, what can be the issue.
@IAmTimCorey
@IAmTimCorey 4 года назад
It probably has to do with the display of the data. Maybe your binding is incorrect for the items.
@buddyrowe7460
@buddyrowe7460 4 года назад
Hey Tim, how and where can I add waiting animations?
@IAmTimCorey
@IAmTimCorey 4 года назад
Add them on whichever form is displayed when a waiting action happens. You would just overlay the waiting animation on the form when you are waiting and hide it when you are not. Or you could put it right on the button that was clicked or the section that is running, etc.
@jonchicoine
@jonchicoine 3 года назад
Is there no playlist for this series of videos?
@IAmTimCorey
@IAmTimCorey 3 года назад
There is a playlist: ru-vid.com/group/PLLWMQd6PeGY0bEMxObA6dtYXuJOGfxSPx
@jonchicoine
@jonchicoine 3 года назад
@@IAmTimCorey ah thanks!
@farveshrahim8457
@farveshrahim8457 4 года назад
Hello Tim, I just want to display product image when user click on the item list, is it possible to display images on WPF through api call? if not how could we do that?
@IAmTimCorey
@IAmTimCorey 4 года назад
Yep. Your API can send the image URL and WPF can display that image.
@farveshrahim8457
@farveshrahim8457 4 года назад
@@IAmTimCorey Hey, thanks! but where shoould i store this image in order to access it?
@hashimumer7319
@hashimumer7319 3 года назад
i put five products on my data, when i logged in i do not see product lists. instead i see five times "(Binding ProductName)". what is the wrong with me?
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 года назад
First of all, there is nothing wrong with YOU. There is an error in your code. Step thru it carefully and slowly, checking one step at a time. You can fix this!
@Empathies92
@Empathies92 3 года назад
For some reason I can't see my Stored Procedure (spUserLookup) that we made before.. I also noticed this with the database Publish file.. When I check the folders in Windows Explorer they're all there though.. any thoughts on how to fix this?
@Empathies92
@Empathies92 3 года назад
I found a work-around (don't really feel like calling it a fix..) I select "Show all files" and then right-click those 2 files and choose "Include in Project" now they seem to show up like I want them to. I still find it strange that they weren't showing before..
@IAmTimCorey
@IAmTimCorey 3 года назад
I think this is a recent issue in Visual Studio. I need to replicate it in a demo environment, but I've seen this issue in personal projects recently. I think it is a VS bug.
@JSatterfield09
@JSatterfield09 3 года назад
For some reason when I login in, the spUserLookup stored procedure is called although and I get the following error: 'Procedure or function 'spUserLookup' expects parameter '@Id', which was not supplied.' - I did not make any updates to the UserData.cs file and the ProductData.cs calls the correct stored procedure created in this video, passing the new { } as the parameter. Any ideas?
@IAmTimCorey
@IAmTimCorey 3 года назад
Check out 23:34 - We are passing in Id to the spUserLookup stored procedure.
@efimov90
@efimov90 4 года назад
IAmTimCorey, 53:14 about sharing models: but is it really different things? I mean you have same models in webUI and desktopUI. Maybe you have an API layer between them, but anyway they display same things. For sure in desktop version you have custom LoggedInUserModel, but is it so bad? I mean you can have separate project for models only and share it between. And now actually this models not 'real' models, they are DTOs, but if they obtain some logic after - you will have a lot of problems to debug differences at web and desktop just because you not use DRY here.
@IAmTimCorey
@IAmTimCorey 4 года назад
DRY doesn't apply here. It is repetition but that is not what DRY is about. DRY is about repeating the same logic in multiple places. This is different logic, even if it comes to the same conclusion right now. Eventually, I am probably going to change the front-end model to fit the needs of the front-end (validation is a common reason). If I use a shared model, I can't do that. Now I have to refactor my entire application because I wanted to be DRY.
@efimov90
@efimov90 4 года назад
​@@IAmTimCorey, ok i can agree that it's different logic that like same, but i'm not sure that validation is goog reason to separate models, because you will have same validation at both sides (At 21 video you said: "you can't trust to UI", that indirect hints that you should use same domain model with same business logic). UI specialized validation must be only at ViewModels am i right?
@hashimumer7319
@hashimumer7319 3 года назад
i encountered this error "the method or operation is not implemented" so how can i solve it
@IAmTimCorey
@IAmTimCorey 3 года назад
Somewhere you probably have the line "throw new NotImplementedException();" This comes when you auto-generate a method and then never put content into the method body. It is a reminder to go back and put in that code.
@hashimumer7319
@hashimumer7319 3 года назад
@@IAmTimCorey Thanks the problem is exactly what mentioned. God Bless You!
@copperntz5907
@copperntz5907 Год назад
Productname != ProductName
@IAmTimCorey
@IAmTimCorey Год назад
Correct. That will get you.
@email195
@email195 Год назад
I avoid "order by" in stored procedures as this can be taxing on the SQL Server with large datasets. I prefer to do this in the UI since this is more of a presentation decision. Just my two cents.
@IAmTimCorey
@IAmTimCorey Год назад
That's not a good idea. Order by is a SQL job. Obviously if you have data in the UI and you want to change the order, you do it in the application. However, the first order should be done in SQL. That's what it does best. Ordering in SQL will be faster than in your application every time. That's what SQL is designed to do. If your SQL Server can't do ordering efficiently, you have badly messed up your SQL database. For instance, if you use a covering index, the sort can be free because the index is already sorted.
@defiledgamingnl2284
@defiledgamingnl2284 2 года назад
I am getting a System.Exception: 'Not Found' for the line await LoadProjecten(); i just can't find what i did wrong. its originating from ProjectEndPoint.GetAll() i am utterly stuck
@IAmTimCorey
@IAmTimCorey 2 года назад
You have a typo in "LoadProjecten" That might be it.
@defiledgamingnl2284
@defiledgamingnl2284 2 года назад
@@IAmTimCorey my lord... after a full day of looking. i managed to find out that the TYPO was a wrong API Uri. instead of Projecten i had Project... now it works and i can finally continue @ 1:07:02
@IAmTimCorey
@IAmTimCorey 2 года назад
Excellent! I am glad you figured it out. Almost every frustrating bug comes from a tiny mistake.
@programmingeveryday1976
@programmingeveryday1976 2 года назад
to get into automatically refactor use the control key plus R, E this is the refactoring shortcut for expand wild card CREATE PROCEDURE [dbo].[spProduct_GetAll] AS BEGIN SET NOCOUNT ON; SELECT [Id], [ProductName], [Discription], [RetailPrice], [QuantityInStock] FROM [dbo].[Product] ORDER BY [ProductName]; END
Далее
Лучше одной, чем с такими
00:54
Просмотров 942 тыс.
НОВАЯ "БУХАНКА" 2024. ФИНАЛ
1:39:04
Просмотров 405 тыс.
Living life on the edge 😳 #wrc
00:17
Просмотров 2,8 млн
Getting User Data - A TimCo Retail Manager Video
1:13:38
What is Span in C# and why you should be using it
15:15
Planning the Register - A TimCo Retail Manager Video
42:44