This file contains hidden or 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
private string GetManufacturer(string MacAddress) | |
{ | |
using (ISession session = Global._DatabaseConn.OpenSession()) | |
{ | |
using (ITransaction transaction = session.BeginTransaction()) | |
{ | |
string strManuFacturer = "N/A"; | |
var OID = session.Query<normutils.data.Entities.MACIdentifier>(); | |
var Type = (from t in OID | |
where t.ID == MacAddress.Substring(0,8) |
This file contains hidden or 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
private void UpdateProducts() { | |
using (var context = new MyEntities()) { | |
using (var cn = context.Database.Connection) { | |
cn.Open(); | |
using (var tr = context.Database.Connection.BeginTransaction()) { | |
try { | |
//1. ADO.NETで独自のSQL文を実行。 | |
var sql = "UPDATE [Products] SET [Price] = [Price] * 1.1 "; | |
var cmd = cn.CreateCommand(); | |
cmd.Transaction = tr; |
This file contains hidden or 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
<?php | |
/** | |
* Loop Add to Cart -- with quantity and AJAX | |
* requires associated JavaScript file qty-add-to-cart.js | |
* | |
* @ref: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/ | |
* @ref: https://gist.github.com/mikejolley/2793710/ | |
*/ | |
// add this file to folder "woocommerce/loop" inside theme |
This file contains hidden or 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
using System; | |
using System.Net.Mail; | |
using System.Threading; | |
using System.Threading.Tasks; | |
public static class SmtpClientExtensions | |
{ | |
/// <summary> | |
/// Extension method to have SmtpClient's SendMailAsync respond to a CancellationToken | |
/// </summary> |
This file contains hidden or 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
class ContactInformationAuctionMessageBuilder : IMailMessageBuilder<ContactInformationAuction> | |
{ | |
private MailMessage mailMessage; | |
private StringBuilder body = new StringBuilder(); | |
public ContactInformationAuctionMessageBuilder() | |
{ | |
mailMessage = new MailMessage(); | |
} |
This file contains hidden or 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
[TestFixture] | |
class MailBuilderTest | |
{ | |
[Test] | |
public void TestContactInformation() | |
{ | |
// arrange | |
ContactInformation contactInformation = new ContactInformation() | |
{ | |
FirstName = "Homero", |
This file contains hidden or 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
var sendEmailTasks = recipientList.Select(async recipient => | |
{ | |
var message = new MailMessage { To = { recipient }, ... }; | |
// instantiate a new client for each mail because of this: | |
// http://www.codefrenzy.net/2012/01/30/how-asynchronous-is-smtpclient-sendasync/ | |
using (var smtpClient = new SmtpClient()) | |
{ | |
await smtpClient.SendMailAsync(message); | |
} |
This file contains hidden or 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
/** | |
* Calculate Age in C# | |
* https://gist.github.com/faisalman | |
* | |
* Copyright 2012-2013, Faisalman <[email protected]> | |
* Licensed under The MIT License | |
* http://www.opensource.org/licenses/mit-license | |
*/ | |
using System; |
This file contains hidden or 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
uses IPPeerClient,REST.Client, Data.Bind.Components, Data.Bind.ObjectScope; | |
procedure TForm1.Button1Click(Sender: TObject); | |
var | |
rc: TRESTClient; | |
rr: TRESTRequest; | |
res: TRESTResponse; | |
begin | |
TThread.CreateAnonymousThread( | |
procedure | |
begin |