發表文章

目前顯示的是 10月, 2023的文章

SQL 16進位轉換 Hex Convert Int

SELECT BIBID, SUBSTRING(BIBID, 1, 2) + RIGHT(CONVERT(VARCHAR(8) ,CONVERT(varbinary(4), CONVERT(INT, CONVERT(VARBINARY, '00000' + SUBSTRING(BIBID, 3, 1), 2)) + 1), 2), 1) + RIGHT(BIBID, LEN(BIBID) - 3), RIGHT(CONVERT(VARCHAR(8) ,CONVERT(varbinary(4), CONVERT(INT, CONVERT(VARBINARY, '00000' + SUBSTRING(BIBID, 3, 1), 2)) + 1), 2), 1), SUBSTRING(BIBID, 3, 1) FROM [dbo].[BIBMasterActivityBin]

ASP.NET Core Razor 元件生命週期事件, OnInitialized , OnInitializedAsync, OnParametersSet, OnParametersSetAsync, OnAfterRender(bool firstRender), OnAfterRenderAsync(bool firstRender), ShouldRender()

 Blazor 元件觸發時的生命週期,一般在正常啟用下會有觸發的事件順序,但在同元件不同屬性載入時有幾個生命週期會減少些事件的觸發,下列紀錄一下在生命中週期的起應用順。 我的元件名稱為 BatchPredictCalculator     #region 元件運行生命週期     /// <summary>     /// 該Blazor中的 [paramete] 屬性變數變更時觸發     /// </summary>     /// <param name="parameters"></param>     /// <returns></returns>     public override async Task SetParametersAsync(ParameterView parameters)     {         await base.SetParametersAsync(parameters);     }     /// <summary>     /// 0. 初始化 - 第一次開啟時執行     /// </summary>     protected override void OnInitialized()     {     }     /// <summary>     /// 0. 初始化非同步 - 第一次開啟時執行     /// </summary>     /// <returns></returns>     protected override async Task OnInitializedAsync()     {         await base.OnInitializedAsync();     }     /// <summary>     /// 1. 元件切換時     /// </summary>     protected override void OnParametersSet()     {         base.OnParametersSet();     }     /// <summary

C# 來取得365 Outlook相關資訊,使用 Microsoft.Graph 讀取 帳號、帳號管理者、行事曆、行事曆事件等資訊

圖片
 在學習此操作之前先準備了解一下相關資訊及學習資源 線上API範本 https://developer.microsoft.com/en-us/graph/graph-explorer 線上操作文件 https://learn.microsoft.com/en-us/graph/overview?view=graph-rest-1.0 https://learn.microsoft.com/zh-cn/graph/overview 基本上我們必須先準備好下列4個數據資訊 string clientId = "應用程式 (用戶端) 識別碼" ; string authority = "目錄 (租用戶) 識別碼" ; string account = "Office 365 使用者的電子郵件信箱" ; string password = "Office 365 使用者的密碼" ; clientId = "應用程式 (用戶端) 識別碼" authority = "目錄 (租用戶) 識別碼" 操作權限的開啟 權限開放 /// <summary> /// 取得授權 /// </summary> /// <returns></returns> static async Task<AuthenticationResult> GetAuth() { string[] scopes = new string[] { "user.read", "Calendars.ReadBasic" }; IPublicClientApplication app; app = PublicClientApplicationBuilder.Create(clientId) .WithAuthority($"https://login.microsoftonline.com/{authority}") .Build(); AuthenticationResult result = null; try { // 使用