Sales Orders Sample for Devices Implementation Details
The Sales Orders Mobile Device sample contains a single smart device form with several panels. Each of the panels contains UI components aimed at accomplishing a specific task.
Application Panels
The application includes the following panels:
Panel name | Purpose |
---|---|
orderItemsPanel |
Lets the user view all order items in an order, add new items to the order, and delete items from the order. |
ordersPanel |
Lets users view the list of orders for the selected customer. It also lets the user edit the orders, add a new order, or delete an existing order. |
productsPanel |
Lets users add a product to an order. |
settingsPanel |
Lets users configure and save or reset the replication settings. |
synchronizePanel |
Lets the user synchronize the local SQL Server Compact Edition database with SQL Server. This panel also displays the progress of an on-going synchronization and allows the user to stop synchronization. |
Methods and Event Handlers
The MainForm class contains code to:
- Create and initially populate the local SQL Server 2005 Compact Edition (SQL Server Compact Edition) database with data from the Publisher
- Read data from the local database
- Edit and update the local database
- Synchronize changes with the Publisher
- Update the UI
The MainForm class contains the following methods and event handlers that perform data synchronization and update the UI during synchronization:
Method | Description |
---|---|
LastSuccessfulSyncTime |
Gets the last date and time that a successful synchronization occurred. It is called by the UpdateStatus method. |
LoadDefaultValues |
Loads default values for subscription properties. |
LoadSubscriptionSettings |
Loads properties of an existing subscription from the replication metadata using the SqlCeReplication object. |
OnStartTableDownloadCallback |
This method is called during replication every time a SQL Server table is downloaded to SQL Server Compact Edition. |
OnStartTableUploadCallback |
This method is called during replication every time a new local SQL Server Compact Edition table is uploaded to SQL Server. |
OnSynchronizationCallback |
This method is called automatically during asynchronous data synchronization. |
SaveSubscriptionSettings |
Sets the properties of the SqlCeReplication object required to create and synchronize the subscription. |
settingsUseAnonymous_CheckStateChanged |
Updates subscription properties when the Connect anonymously to server checkbox is selected. |
SyncCompletedCallback |
This method is called when the asynchronous data synchronization is completed. |
synchronizeStopButton_Click |
Stops the currently-running data synchronization. |
synchronizeSynchronizeButton_Click |
Contains the code required to synchronize the local data with SQL Server. |
UpdateStatus |
Called by UserInterfaceUpdateEvent to update the UI. |
UserInterfaceUpdateEvent |
Updates the status text box to show the user the synchronization progress. |
The main form also contains the following methods and event handlers. These perform the bulk of additional functions in the application:
Method | Description |
---|---|
CheckEmployeeTableExists |
Checks if the Employee table exists in the local database. |
ClearStatusTextBox |
Clears the status text box. |
fileExitMenuItem_Click |
Closes the application. |
fileViewOrdersMenuItem_Click |
Calls ViewCustomerOrders. |
fileViewInventoryMenuItem_Click |
Calls LoadSalesOrderProduct. |
InsertCustomer |
Adds a new customer to the Customer table. |
LoadCustomerOrders |
Loads the sales order for the currently-selected customer. |
LoadSalesOrderItems |
Retrieves the list of items in the selected sales order. |
LoadSalesOrderProduct |
Retrieves the detailed product information for the selected product. |
orderItemsAddItemButton_Click |
Calls LoadSalesOrderProduct. |
orderItemsDataGrid_DoubleClick |
Opens the productsPanel when a user double-clicks on the product name column. |
orderItemsDeleteItemButton_Click |
Deletes the selected product from the sales order. |
ordersCustomersComboBox_SelectedIndexChanged |
Calls LoadCustomerOrders. |
ordersDataGrid_Click |
Loads the sales order items and displays the orderItemsPanel panel. |
ordersDeleteOrderButton_Click |
Deletes the selected order from the SalesOrderDetail table. |
productsCancelButton_Click |
Cancel the changes to the sales order product selection. |
productsSaveButton_Click |
Saves the changes to the product selection. |
RetrieveSalesPerson |
Retrieves the ID value for the current salesperson. |
settingsResetButton_Click |
Clears all fields on the active panel. |
settingsSaveButton_Click |
Calls SaveUserSettings. |
ShowPanel |
Displays the selected panel. |
synchronizeClearStatusButton_Click |
Calls ClearStatusTextBox. |
toolsSettingsMenuItem_Click |
Displays the settingsPanel panel. |
toolsSynchronizeMenuItem_Click |
Opens the synchronizePanel panel. |
UpdateButtons |
Resets button properties. |
UpdateCurrentProductCategoryID |
Changes the product category to match the currently selected product. |
ViewCustomerOrders |
Connects to the local database and populates the Customers drop-down list with the current list of customers. |
See Also
Other Resources
Sales Orders Replication Sample Application for Devices