2008年7月21日 星期一

寫 blog 的工具

在寫 blog 時,常常會需要寫關於程式碼的部份。有時,又要寫 sql script, 或 we.config。這些部份的顯示,其實都可以很簡單。但是寫程式習慣了 Visual Studio 的 Style。純看 notepad 的 style,是一點也不熟悉的。 找到了 Syntax Highlighter for Windows Live Writer 這樣的工具。它可以輕易的產生下面的樣子

asp.net web.config

<?xml version="1.0"?>
<configuration>
	<configSections>
		<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
				<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
					<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
					<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
					<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
					<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
				</sectionGroup>
			</sectionGroup>
		</sectionGroup>
	</configSections>
	<appSettings/>
	<system.web>
c# code
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BankPro.EI2.DAL;
using BankPro.EI2.Constants;
using BankPro.EI2.ObjectGroup.DAL;

namespace EI2.Profile
{
  public partial class CompanySingleChooseForm : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {

    }
SQL Script
	Declare @sellerTaxNo char(8)
	select @sellerTaxNo = taxNo from company where oid = @companyOid
	
	declare @invoiceAmount money
	declare @invoiceTax money
	declare @invoiceZeroAmount money
	declare @invoiceFreeAmount money
	declare @discAmount money
	declare @discTax money
	declare @discZeroAmount money
	declare @discFreeAmount money

SELECT @invoiceAmount = SUM([t2].[value])
FROM (
    SELECT [t0].[InvoiceAmount] - t0.InvoiceTax AS [value], [t0].[RateType], [t0].[TaxDate], [t1].[TypeID], [t0].SellerTaxNo
    FROM [dbo].[Invoice] AS [t0]
    INNER JOIN [dbo].[InvoiceType] AS [t1] ON [t1].[OID] = [t0].[InvoiceTypeOID]
	where t0.[RevenueOID] is not null and t0.ActionState = 1
    ) AS [t2]
WHERE ([t2].[RateType] = 1) AND ([t2].[TaxDate] = @taxDate) AND ([t2].[TypeID] LIKE
 @like) AND ([t2].SellerTaxNo = @sellerTaxNo) 

沒有留言:

Share with Facebook