Guest User

Untitled

a guest
Jan 16th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.59 KB | None | 0 0
  1. private async Task getInvoiceDetailsAsync(IDialogContext context, IAwaitable<object> result)
  2. {
  3. var activity = await result as Activity;
  4. companyName = activity.Text;
  5. noOfCompany = 10;
  6.  
  7. // calling the Api to get invoice details
  8. InvoiceDetailsController obj = new InvoiceDetailsController();
  9.  
  10. // store return data in to a list
  11. returnInvoiceDetails = obj.getInvoiceDetails(userid, companyName, noOfCompany);
  12. invoiceCount = obj.getItems();
  13.  
  14. // checking if the return list contains any useful values
  15.  
  16. if (invoiceCount!=0) {
  17. for (int i = 0; i < invoiceCount; i++)
  18. {
  19. customerID[i] = returnInvoiceDetails[i].customer_id.ToString();
  20. settleamount[i] = float.Parse(returnInvoiceDetails[i].settle_amount.ToString());
  21. settAmount[i] = settleamount[i].ToString("#,##0");
  22. }
  23. var selectedCard = await result;
  24. var message = context.MakeMessage();
  25. // calling the card to show details
  26.  
  27. var attachment = invoiceCard();
  28. message.Attachments.Add(attachment);
  29. await context.PostAsync(message); }
  30. context.Wait(MessageReceivedAsync);
  31.  
  32. }
  33.  
  34.  
  35. private static Attachment invoiceCard()
  36. {
  37. ThumbnailCard invoiceDetails = new ThumbnailCard
  38. {
  39. Images = new List<CardImage> {
  40. new CardImage("https://thumb9.shutterstock.com/display_pic_with_logo/701173/108824516/stock-photo-cloud-computing-concept-isolated-on-white-background-d-rendered-108824516.jpg"), },
  41. Title = "<b><u><font color ="#721B59">These are the Invoice Details for " + companyName+ "<b><u><font color ="#721B59"></font></b></u>",
  42. Text = $"<b>Customer Id :-</b>" + " " + customerID[0] + "<br> <b>Settlement amount :-</b>" + " " + settAmount[0] +
  43. "<br><br><b>Customer Id :-</b>" + " " + customerID[1] + "<br> <b>Settlement amount :-</b>" + " " + settAmount[1] +
  44. "<br><br><b>Customer Id :-</b>" + " " + customerID[2] + "<br> <b>Settlement amount :-</b>" + " " + settAmount[2] +
  45. "<br><br><b>Customer Id :-</b>" + " " + customerID[3] + "<br> <b>Settlement amount :-</b>" + " " + settAmount[3] +
  46. "<br><br><b>Customer Id :-</b>" + " " + customerID[4] + "<br> <b>Settlement amount :-</b>" + " " + settAmount[4],
  47. Buttons = new List<CardAction>
  48. {
  49. new CardAction(ActionTypes.ImBack,"Thank you",value:"U0001F642")
  50. },
  51. };
  52.  
  53. return invoiceDetails.ToAttachment();
  54. }
  55.  
  56. <?xml version="1.0" encoding="utf-8"?>
  57. <!--
  58. For more information on how to configure your ASP.NET application, please visit
  59. http://go.microsoft.com/fwlink/?LinkId=301879
  60. -->
  61. <configuration>
  62. <appSettings>
  63. <!-- update these with your BotId, Microsoft App Id and your Microsoft App Password-->
  64. <add key="BotId" value="AX_Bot" />
  65.  
  66. <add key="MicrosoftAppId" value="" />
  67. <add key="MicrosoftAppPassword" value="" />
  68.  
  69. </appSettings>
  70. <!--
  71. For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
  72.  
  73. The following attributes can be set on the <httpRuntime> tag.
  74. <system.Web>
  75. <httpRuntime targetFramework="4.6" />
  76. </system.Web>
  77. -->
  78. <system.web>
  79. <customErrors mode="Off" />
  80. <compilation debug="true" targetFramework="4.6" />
  81. <httpRuntime targetFramework="4.6" />
  82. </system.web>
  83. <system.webServer>
  84. <defaultDocument>
  85. <files>
  86. <clear />
  87. <add value="default.htm" />
  88. </files>
  89. </defaultDocument>
  90.  
  91. <handlers>
  92. <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  93. <remove name="OPTIONSVerbHandler" />
  94. <remove name="TRACEVerbHandler" />
  95. <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
  96. </handlers></system.webServer>
  97. <runtime>
  98. <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  99. <dependentAssembly>
  100. <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
  101. <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  102. </dependentAssembly>
  103. <dependentAssembly>
  104. <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
  105. <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  106. </dependentAssembly>
  107. <dependentAssembly>
  108. <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
  109. <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  110. </dependentAssembly>
  111. <dependentAssembly>
  112. <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
  113. <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
  114. </dependentAssembly>
  115. <dependentAssembly>
  116. <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  117. <bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" />
  118. </dependentAssembly>
  119. <dependentAssembly>
  120. <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
  121. <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  122. </dependentAssembly>
  123.  
  124. </assemblyBinding>
  125. </runtime>
  126. </configuration>
Add Comment
Please, Sign In to add comment