-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating new sample - msgext-northwind-inventory-csharp #143
Merged
garrytrinder
merged 26 commits into
OfficeDev:main
from
Jegadeesh-MSFT:v-jegadeesh/northwind-csharp
Aug 1, 2024
Merged
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
0b3e934
Updating new sample - msgext-northwind-inventory-csharp
Jegadeesh-MSFT 81d3540
.Teamsapp and .Vs folders deleted
Jegadeesh-MSFT a0bc384
TTK implemented and lab exercise edited
Jegadeesh-MSFT 4eba098
TTK user file added
Jegadeesh-MSFT 81d289a
TTK Solution file updated
Jegadeesh-MSFT 9c52f77
Rename productSearchCommand.cs to ProductSearchCommand.cs
Jegadeesh-MSFT a153348
Rename utils.cs to Utils.cs
Jegadeesh-MSFT afde044
updating version history
Jegadeesh-MSFT 9b18335
Merge branch 'v-jegadeesh/northwind-csharp' of https://github.com/Jeg…
Jegadeesh-MSFT 306aed4
Fixing PR comments
Jegadeesh-MSFT 0586d52
Updating adaptive cards edit and success
Jegadeesh-MSFT ffe2aed
Adding lab files 4 and 5
Jegadeesh-MSFT c98998d
Fixing PR comments
Jegadeesh-MSFT 061db03
Fixind gitignore file as per PR comments
Jegadeesh-MSFT e80d508
Fixing PR comments for enable multi projects
Jegadeesh-MSFT b62903b
Fixing PR comments and addind Sample env file
Jegadeesh-MSFT e798ea6
Fixing PR comment of azurite
Jegadeesh-MSFT ce92227
Pr comments fix for trobleshoot page and M365 provision images added
Jegadeesh-MSFT f0299a4
Fixing PR comments ssl certificate and error in adaptive card
Jegadeesh-MSFT 124743f
adding assets folder
Jegadeesh-MSFT c79c930
Fixing the SSL certificate placement
Jegadeesh-MSFT f90385b
Fixing image name for azurite
Jegadeesh-MSFT 162b11a
Fixing PR comments
Jegadeesh-MSFT de5c125
Fixing PR comment for missing variable error
Jegadeesh-MSFT d0ec689
adding appsetting.sample file
Jegadeesh-MSFT b08bd5c
Fixing lab exercises links
Jegadeesh-MSFT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# TeamsFx files | ||
build | ||
appPackage/build | ||
env/.env.*.user | ||
env/.env.local | ||
appsettings.Development.json | ||
.deployment | ||
|
||
# User-specific files | ||
*.user | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Ll]og/ | ||
|
||
# Notification local store | ||
.notification.localstore.json | ||
33 changes: 33 additions & 0 deletions
33
samples/msgext-northwind-inventory-csharp/AdapterWithErrorHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Microsoft.Bot.Builder.Integration.AspNet.Core; | ||
using Microsoft.Bot.Builder.TraceExtensions; | ||
using Microsoft.Bot.Connector.Authentication; | ||
using Microsoft.Bot.Schema; | ||
|
||
namespace msgext_northwind_inventory_csharp; | ||
|
||
public class AdapterWithErrorHandler : CloudAdapter | ||
{ | ||
public AdapterWithErrorHandler(BotFrameworkAuthentication auth, ILogger<IBotFrameworkHttpAdapter> logger) | ||
: base(auth, logger) | ||
{ | ||
OnTurnError = async (turnContext, exception) => | ||
{ | ||
// Log any leaked exception from the application. | ||
// NOTE: In production environment, you should consider logging this to | ||
// Azure Application Insights. Visit https://aka.ms/bottelemetry to see how | ||
// to add telemetry capture to your bot. | ||
logger.LogError(exception, $"[OnTurnError] unhandled error : {exception.Message}"); | ||
|
||
// Only send error message for user messages, not for other message types so the bot doesn't spam a channel or chat. | ||
if (turnContext.Activity.Type == ActivityTypes.Message) | ||
{ | ||
// Send a message to the user | ||
await turnContext.SendActivityAsync("The bot encountered an error or bug."); | ||
await turnContext.SendActivityAsync("To continue to run this bot, please fix the bot source code."); | ||
|
||
// Send a trace activity, which will be displayed in the Bot Framework Emulator | ||
await turnContext.TraceActivityAsync("OnTurnError Trace", exception.Message, "https://www.botframework.com/schemas/error", "TurnError"); | ||
} | ||
}; | ||
} | ||
} |
241 changes: 241 additions & 0 deletions
241
samples/msgext-northwind-inventory-csharp/AdaptiveCards/editCard.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,241 @@ | ||
{ | ||
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json", | ||
"type": "AdaptiveCard", | ||
"version": "1.5", | ||
"refresh": { | ||
"userIds": [], | ||
"action": { | ||
"type": "Action.Execute", | ||
"verb": "refresh", | ||
"title": "Refresh", | ||
"data": { | ||
"productId": "${productId}" | ||
} | ||
} | ||
}, | ||
"body": [ | ||
{ | ||
"type": "Container", | ||
"separator": true, | ||
"items": [ | ||
{ | ||
"type": "ColumnSet", | ||
"columns": [ | ||
{ | ||
"type": "Column", | ||
"items": [ | ||
{ | ||
"type": "TextBlock", | ||
"size": "large", | ||
"weight": "bolder", | ||
"text": "📦 ${productName}", | ||
"wrap": true, | ||
"style": "heading" | ||
} | ||
], | ||
"width": "60" | ||
}, | ||
{ | ||
"type": "Column", | ||
"items": [ | ||
{ | ||
"type": "TextBlock", | ||
"text": "${inventoryStatus}", | ||
"wrap": true, | ||
"horizontalAlignment": "Right", | ||
"isSubtle": true, | ||
"color": "${if(inventoryStatus == 'In stock', 'good', if(inventoryStatus == 'low stock', 'warning', 'attention'))}" | ||
} | ||
], | ||
"width": "40" | ||
} | ||
] | ||
} | ||
|
||
], | ||
"bleed": true | ||
}, | ||
{ | ||
"type": "Container", | ||
"style": "emphasis", | ||
"items": [ | ||
{ | ||
"type": "TextBlock", | ||
"weight": "Bolder", | ||
"text": "**📍Supplier information**", | ||
"wrap": true, | ||
|
||
"size": "Medium", | ||
"isSubtle": false | ||
}, | ||
{ | ||
"type": "ColumnSet", | ||
"separator": true, | ||
"columns": [ | ||
{ | ||
"type": "Column", | ||
"width": "stretch", | ||
|
||
"items": [ | ||
{ | ||
"type": "FactSet", | ||
"spacing": "Large", | ||
"facts": [ | ||
{ | ||
"title": "Name", | ||
"value": "${supplierName}" | ||
}, | ||
{ | ||
"title": "City", | ||
"value": "${supplierCity}" | ||
} | ||
|
||
], | ||
"separator": true | ||
} | ||
] | ||
} | ||
|
||
] | ||
}, | ||
{ | ||
"type": "TextBlock", | ||
"weight": "Bolder", | ||
"text": "**🛒 Stock information**", | ||
"wrap": true, | ||
"size": "Medium", | ||
"isSubtle": false | ||
}, | ||
{ | ||
"type": "ColumnSet", | ||
"separator": true, | ||
"columns": [ | ||
{ | ||
"type": "Column", | ||
"width": "stretch", | ||
|
||
"items": [ | ||
{ | ||
"type": "FactSet", | ||
"spacing": "Large", | ||
"facts": [ | ||
{ | ||
"title": "Category", | ||
"value": "${categoryName}" | ||
}, | ||
{ | ||
"title": "Unit price", | ||
"value": "${unitPrice} USD" | ||
}, | ||
{ | ||
"title": "Avg discount", | ||
"value": "${string(averageDiscount)} %" | ||
}, | ||
{ | ||
"title": "Inventory valuation", | ||
"value": "${string(inventoryValue)} USD" | ||
} | ||
], | ||
"separator": true | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "Column", | ||
"width": "stretch", | ||
|
||
"items": [ | ||
{ | ||
"type": "FactSet", | ||
"spacing": "Large", | ||
"facts": [ | ||
|
||
{ | ||
"title": "Units in stock", | ||
"value": "${string(unitsInStock)}" | ||
}, | ||
{ | ||
"title": "Units on order", | ||
"value": "${string(unitsOnOrder)}" | ||
}, | ||
{ | ||
"title": "Reorder Level", | ||
"value": "${string(reorderLevel)}" | ||
}, | ||
{ | ||
"title": "Revenue this period", | ||
"value": "${string(revenue)} USD" | ||
} | ||
], | ||
"separator": true | ||
} | ||
] | ||
} | ||
|
||
|
||
] | ||
}] | ||
}, | ||
{ | ||
"type": "Container", | ||
"items": [ | ||
{ | ||
"type": "ActionSet", | ||
"actions": [ | ||
{ | ||
"type": "Action.ShowCard", | ||
"title": "Take action", | ||
"card": { | ||
"type": "AdaptiveCard", | ||
"body": [ | ||
{ | ||
"type": "Input.Text", | ||
"id": "txtStock", | ||
"label": "Quantity", | ||
"min": 0, | ||
"max": 9999, | ||
"errorMessage": "Invalid input, use whole positive number", | ||
"style": "Tel" | ||
} | ||
], | ||
"actions": [ | ||
{ | ||
"type": "Action.Execute", | ||
"title": "Update stock ✅", | ||
"verb": "ok", | ||
"data": { | ||
"productId": "${productId}" | ||
} | ||
}, | ||
{ | ||
"type": "Action.Execute", | ||
"title": "Restock 📦", | ||
"verb": "restock", | ||
"data": { | ||
"productId": "${productId}" | ||
} | ||
|
||
}, | ||
{ | ||
"type": "Action.Execute", | ||
"title": "Cancel restock ❌", | ||
"verb": "cancel", | ||
"data": { | ||
"productId": "${productId}" | ||
} | ||
}, | ||
{ | ||
"type": "Action.OpenUrl", | ||
"title": "Handoff to bot", | ||
"url": "https://teams.microsoft.com/l/chat/0/0?users=28:758dcadb-01d6-4b75-a8af-3c19d8e84687&continuation=test-continuation-token" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
|
21 changes: 21 additions & 0 deletions
21
samples/msgext-northwind-inventory-csharp/AdaptiveCards/errorCard.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"type": "AdaptiveCard", | ||
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json", | ||
"version": "1.5", | ||
"body": [ | ||
{ | ||
"type": "TextBlock", | ||
"text": "Oops! Something went wrong:", | ||
"wrap": true | ||
}, | ||
{ | ||
"type": "Graph", | ||
"someProperty": "foo", | ||
"fallback": { | ||
"type": "TextBlock", | ||
"text": "Could not update stock at this time", | ||
"wrap": true | ||
} | ||
} | ||
] | ||
} |
19 changes: 19 additions & 0 deletions
19
samples/msgext-northwind-inventory-csharp/AdaptiveCards/sampleData.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"productName": "Chai", | ||
"unitsInStock": "130", | ||
"productId": 1, | ||
"categoryId": 1, | ||
"imageUrl": "https://picsum.photos/id/431/200/300", | ||
"supplierName": "Contoso Beverage Company", | ||
"supplierCity": "London", | ||
"categoryName": "Beverages", | ||
"inventoryStatus": "In stock", | ||
"unitPrice": "18", | ||
"quantityPerUnit": "10 boxes x 20 bags", | ||
"unitsOnOrder": "25", | ||
"reorderLevel": "25", | ||
"unitSales": "828", | ||
"inventoryValue": "2,340", | ||
"revenue": "12,788", | ||
"averageDiscount": "8.6%" | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include the following paths:
appsettings.json
.vs
__azurite*
__blobstorage__
__queuestorage__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed