Skip to content

Instantly share code, notes, and snippets.

*** Service
public void Edit(BillingItemViewModel item)
{
var acc = new AccountBook
{
Id = item.Id,
Categoryyy = item.BillType,
Dateee = item.BillDate,
@jasper-lai
jasper-lai / abc.cs
Created April 26, 2016 12:59
testing for Gist
// *** Service
public void Edit(BillingItemViewModel item)
{
var acc = new AccountBook
{
Id = item.Id,
Categoryyy = item.BillType,
Dateee = item.BillDate,
@jasper-lai
jasper-lai / gist:71817502b216613db5d38efb7050c72b
Created April 29, 2016 15:09
enable / disable button but not work for AJAX (enable)
Thread.Sleep(3 * 1000); //暫停一下, 看效果
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/jqueryajax")
<script type="text/javascript">
function postPage(page) {
var targetFormId = '#frmQuery';
$('#PageIndex').val(page);
$(targetFormId).submit();
}; //end of postPage(page)
function setSubmitInGoTo() {
//找出頁碼, 並改為呼叫 postPage(page) 作 submit
var gotoFormClass = '.PagedList-goToPage';
@jasper-lai
jasper-lai / watermark.cs
Last active September 27, 2016 10:57
Output watermark with DrawString() include Chinese characters
public void PrintPdfByEvoPdf(string fileName, string printerName)
{
// create the PDF printer
PdfPrint pdfPrint = new PdfPrint();
// for WatermarkText
pdfPrint.PagePrintedEvent += pdfPrint_PagePrintedEvent;
// set the license key
@jasper-lai
jasper-lai / IndexPage.sql
Last active December 29, 2016 06:49
用以檢查 Non-Clustered Index 的 page content
<SQL.1>
USE AdventureWorks2014
GO
WITH depth_results
AS
( SELECT
[index_id],
[index_type_desc],
[index_depth],
@jasper-lai
jasper-lai / NSubstituteStarter.cs
Created January 12, 2017 08:31
練習: NSubstitute stub/mock framework Getting Started
using System;
using System.Security.Cryptography.X509Certificates;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NSubstitute;
//=============================================
//http://nsubstitute.github.io/help/getting-started/
//=============================================
//TestCategory 的中文名稱叫作 "特性", 可依 TestCategory 找到測試方法
@jasper-lai
jasper-lai / ExpectedObjectsWithTryCatch
Created February 1, 2017 04:56
Expected Objects compared with try ... catch
using ExpectedObjects;
using System;
using System.Collections.Generic;
namespace ExpectedObjectsSample01
{
internal class Program
{
private static void Main(string[] args)
{
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- CDN for Bootstrap 4 CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css">
<!-- CDN for Bootstrap Font Awesome CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">