Skip to content
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
Merged
Show file tree
Hide file tree
Changes from all 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 Jun 26, 2024
81d3540
.Teamsapp and .Vs folders deleted
Jegadeesh-MSFT Jul 2, 2024
a0bc384
TTK implemented and lab exercise edited
Jegadeesh-MSFT Jul 2, 2024
4eba098
TTK user file added
Jegadeesh-MSFT Jul 2, 2024
81d289a
TTK Solution file updated
Jegadeesh-MSFT Jul 2, 2024
9c52f77
Rename productSearchCommand.cs to ProductSearchCommand.cs
Jegadeesh-MSFT Jul 2, 2024
a153348
Rename utils.cs to Utils.cs
Jegadeesh-MSFT Jul 2, 2024
afde044
updating version history
Jegadeesh-MSFT Jul 2, 2024
9b18335
Merge branch 'v-jegadeesh/northwind-csharp' of https://github.com/Jeg…
Jegadeesh-MSFT Jul 2, 2024
306aed4
Fixing PR comments
Jegadeesh-MSFT Jul 2, 2024
0586d52
Updating adaptive cards edit and success
Jegadeesh-MSFT Jul 2, 2024
ffe2aed
Adding lab files 4 and 5
Jegadeesh-MSFT Jul 4, 2024
c98998d
Fixing PR comments
Jegadeesh-MSFT Jul 8, 2024
061db03
Fixind gitignore file as per PR comments
Jegadeesh-MSFT Jul 8, 2024
e80d508
Fixing PR comments for enable multi projects
Jegadeesh-MSFT Jul 8, 2024
b62903b
Fixing PR comments and addind Sample env file
Jegadeesh-MSFT Jul 8, 2024
e798ea6
Fixing PR comment of azurite
Jegadeesh-MSFT Jul 9, 2024
ce92227
Pr comments fix for trobleshoot page and M365 provision images added
Jegadeesh-MSFT Jul 9, 2024
f0299a4
Fixing PR comments ssl certificate and error in adaptive card
Jegadeesh-MSFT Jul 10, 2024
124743f
adding assets folder
Jegadeesh-MSFT Jul 10, 2024
c79c930
Fixing the SSL certificate placement
Jegadeesh-MSFT Jul 11, 2024
f90385b
Fixing image name for azurite
Jegadeesh-MSFT Jul 11, 2024
162b11a
Fixing PR comments
Jegadeesh-MSFT Jul 18, 2024
de5c125
Fixing PR comment for missing variable error
Jegadeesh-MSFT Jul 30, 2024
d0ec689
adding appsetting.sample file
Jegadeesh-MSFT Jul 30, 2024
b08bd5c
Fixing lab exercises links
Jegadeesh-MSFT Jul 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions samples/msgext-northwind-inventory-csharp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# TeamsFx files
build
appPackage/build
env/.env.*.user
env/.env.local
appsettings.Development.json
.deployment
appsettings.json
.vs
__azurite*
__blobstorage__
__queuestorage__

# 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
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 NorthwindInventory;

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");
}
};
}
}
236 changes: 236 additions & 0 deletions samples/msgext-northwind-inventory-csharp/AdaptiveCards/editCard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
{
"$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}"
}
}
]
}
}
]
}
]
}
]
}

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
}
}
]
}
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%"
}
Loading