<a href="http://line.me/ti/p/TLVcRv52Ps">連絡我</a>
Imports System.Runtime.CompilerServices Imports Microsoft.VisualBasic Public Module DateTimeExtension ''' <summary> ''' 將系統時間轉為當地的時間並轉為字串 ''' </summary> ''' <param name="dtSystem"></param> ''' <returns></returns> ''' <remarks></remarks> <Extension()> _ Public Function ToCountryDateTimeString(ByVal dtSystem As DateTime) As String If dtSystem = DateTime.MinValue Then Return "n/a" End If Dim cstTime As DateTime = dtSystem.ToCountryDateTime() ' tr-TR -> dd.MM.yyyy HH:mm:ss Dim langCode As String = SHOPUNT.DB.SysConfig.GetSysConfig("DefaultLangCode") Dim culture As New System.Globalization.CultureInfo(langCode) If cstTime.AddMonths(6) < Now Then Return cstTime.ToString("dd.MM.yyyy HH:mm", culture) Else Return cstTime.ToString("dd.MMM HH:mm", culture) End If End Function ''' <summary> ''' 將系統時間轉為當地的時間 ''' </summary> ''' <param name="dtSystem"></param> ''' <returns></returns> ''' <remarks></remarks> <Extension()> _ Public Function ToCountryDateTime(ByVal dtSystem As DateTime) As DateTime Dim cstZone As TimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(SHOPUNT.DB.SysConfig.GetSysConfig("DefaultTimeZone")) Dim localZone As TimeZoneInfo = TimeZoneInfo.Local Dim cstTime As DateTime = TimeZoneInfo.ConvertTime(dtSystem, localZone, cstZone) Return cstTime End Function ''' <summary> ''' 將使用者輸入的時間轉為系統時間 ''' </summary> ''' <param name="dtCountry"></param> ''' <returns></returns> ''' <remarks></remarks> <Extension()> _ Public Function ToSystemDateTime(ByVal dtCountry As DateTime) As DateTime Dim cstZone As TimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(SHOPUNT.DB.SysConfig.GetSysConfig("DefaultTimeZone")) Dim localZone As TimeZoneInfo = TimeZoneInfo.Local Dim sysTime As DateTime = TimeZoneInfo.ConvertTime(dtCountry, cstZone, localZone) Return sysTime End Function End Module使用上 只要
//先檢查是不是已經登入
FB.getLoginStatus(function (response) {
if (response.status === "connected") {
// 已登入FB
}
else {
// 未登入FB
// 盡量不要在此呼叫 FB.login , 因為彈跳視窗會被擋下來
}
});
//呼叫登入 scope:publish_stream 是要讓user同意發文到FB的權限
FB.login(function (response) {
if (response.authResponse) {
// 已登入,可取得 AccessToken
} else {
// 未登入
}
}, { scope: 'publish_stream' });
// 檢查 user 有無同意發文到FB的權限 (publish_stream)
FB.api({ method: 'users.hasAppPermission', ext_perm: 'publish_stream' }, function (resp) {
if (resp === "1") {
//有同意
} else {
//不同意
}
});
// 分享連結到登入者的FB牆
// msg 是發文的內容
// link, picture, caption, description 是一組的
var args = {
message: msg,
link: product.Link,
picture: product.Picture,
caption: product.Name,
description: "超高口碑BB霜/CC霜、頂級精華液哪款半價 由你決定!"
};
FB.api('/me/feed', 'post', args, function (response) {
if (response.id) {
// 成功會回傳訊息id
}
else {
// 分享失敗
}
});
FB.ui({
method: 'feed',
name: '快去搶!超過9成的使用者滿意推薦的《玻尿酸精華》',
link: 'http://www.shopunt.com/tch/event/2014-aqua-deluge/default.aspx',
picture: 'http://www.shopunt.com/Upload/tch/unt/14mar/fb154x154.jpg',
caption: 'UNT 頂級玻尿酸保濕精華液(奢華)',
description: '熱銷破百萬 真實口碑見證的水感奇肌 逆時補水科技 快速滲透 為肌膚注入高水位……'
},
function (response) {
if (response && response.post_id) {
// handle success
}
else {
alert("facebook分享失敗!");
}
}
);
Sub SendMail_gmail(ByVal Subject As String, ByVal Body As String, ByVal FromMail As String, ByVal ToMail As String)
Dim msg As New System.Net.Mail.MailMessage
Dim client As New System.Net.Mail.SmtpClient
Try
msg.Subject = Subject
msg.Body = Body
msg.From = New System.Net.Mail.MailAddress(FromMail)
msg.To.Add(ToMail)
msg.IsBodyHtml = True
client.Host = "smtp.gmail.com"
Dim basicauthenticationinfo As System.Net.NetworkCredential = New System.Net.NetworkCredential("username@gmail.com", "password")
client.Port = Int32.Parse("587")
client.EnableSsl = True
client.UseDefaultCredentials = False
client.Credentials = basicauthenticationinfo
client.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
client.Send(msg)
Catch ex As Exception
UW.WU.DebugWriteLine(ex.ToString, True, True)
End Try
End Sub
Dim d As Date = Now
Dim n As Decimal = 86400.99
Dim Cultures() As String = {"zh-TW", "pt-BR", "pt-PT", "en-US", "en-GB", "fr-FR", "de-DE", "es-ES", "ja-JP", "zh-CN", "ko-KR", "en-IN"}
For i As Integer = 0 To Cultures.GetUpperBound(0)
Dim c As New Globalization.CultureInfo(Cultures(i))
Response.Write(Cultures(i) & "<br/>" & d.ToString("D", c) & " <br/>" & d.ToString("d", c) & "<br/>" & n.ToString("C", c))
Response.Write("<hr/>")
Next
zh-TW
2013年12月25日
2013/12/25
NT$86,400.99
pt-BR
quarta-feira, 25 de dezembro de 2013
25/12/2013
R$ 86.400,99
pt-PT
quarta-feira, 25 de Dezembro de 2013
25-12-2013
86.400,99 €
en-US
Wednesday, December 25, 2013
12/25/2013
$86,400.99
en-GB
25 December 2013
25/12/2013
£86,400.99
fr-FR
mercredi 25 décembre 2013
25/12/2013
86 400,99 €
de-DE
Mittwoch, 25. Dezember 2013
25.12.2013
86.400,99 €
es-ES
miércoles, 25 de diciembre de 2013
25/12/2013
86.400,99 €
ja-JP
2013年12月25日
2013/12/25
¥86,401
zh-CN
2013年12月25日
2013/12/25
¥86,400.99
ko-KR
2013년 12월 25일 수요일
2013-12-25
₩86,401
en-IN
25 December 2013
25-12-2013
₹ 86,400.99