Author Topic: What are the procedures to add a new field to CustomerModule ? (Prog. Support)  (Read 6897 times)

toni

  • Jr. Member
  • **
  • Posts: 56
I would like to add Post Code and Number fields to "CustomerEditorView.xaml".  Although I added them, after compailing I can not see them on the form. What could it be the problem ? I have no problem with "CustomerSelectorView.xaml"  It was 10 years ago I was programming with C#. Everything has been changed :)

I ve got a database that has all postcodes in the uk.

1-User will enter postcode.
2-Street name will be brought automatically from my access database
3-Door numbers will be added to a combobox from my access database
4-User will select door number

What are the procedures to add new fields to CustomerModule ?

Thank you in advance.

You guys done a great job.

emre

  • SambaPOS Developer
  • Samba Team
  • Hero Member
  • *****
  • Posts: 1564
Quote
What could it be the problem ?

Anything :) OK. For adding new field to Customer follow these steps:

1. Open Domain Layer > Samba.Domain > Models > Customers > Customer.cs
2. Add a string property named PostCode.
3. Open Presentation Layer > Samba.Modules.CustomerModule > CustomerEditorViewModel.cs
4. Add a string property for PostCode filed and update get;set; methods. You can check other properties (for example Address) for hint.
5. Add a textbox and bind it to PostCode property on CustomerEditorView.xaml for editing PostCode.

Customer.cs contains Customer Model. SambaPOS automatically generates database from these models. You can either delete database for regeneration or add PostCode field manually to Customers table.

CustomerEditorViewModel sits between Customer Model and CustomerEditorView. It publishes model properties for editing / updating and supplies additional data for editor. For example Group Code combox values binded to ViewModel's GroupCodes property.

If you are interested you can read about MVVM pattern for more information.

toni

  • Jr. Member
  • **
  • Posts: 56
Thanks for reply. I have already done this steps (I took Adress field as a hint  ;))
The wierd thing is that in design mode I see my my texbox, combobox that I added. Hovewer after rebuilding the project and run it, I can't see my changes. The screen doesnt show my new properties. It shows only yours :) this only happens for CustomerEditorView.xaml.   If I change something on CustomerSelectorView.xaml I can see my changes.  It is so strange. Isn't it ?

emre

  • SambaPOS Developer
  • Samba Team
  • Hero Member
  • *****
  • Posts: 1564
Yes really strange.. If you didn't do it before you can try installing VS 2010 Service Pack 1. Redownloading sources might be another thing to try.

toni

  • Jr. Member
  • **
  • Posts: 56
Firstly I'm gonna install VS 2010 Service Pack 1 If doesnt help I'll try the second option (redownloading) 
Thank you very much indeed.