using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
public string name {get;set;}
public string id {get;set;}
public string no {get;set;}
public static Dictionary<string,string> dicResult = new Dictionary<string,string>() {
{"少年牛頓:183", "Super" },{"Top945:396", "Super" },{"Top945:397", "Super" },{"未來少年:109", "Super" },{"科學少年:60", "Regan" }
,{"少年牛頓:184", "Regan" },{"Top945:398", "Regan" }, {"Top945:399", "Regan" }
public static void Main()
Check(new Book(){ name="Top945", id="273902", no="400" });
Check(new Book(){ name="科學少年", id="300120", no="61" });
Check(new Book(){ name="少年牛頓", id="273912", no="185" });
Check(new Book(){ name="未來少年", id="274477", no="110" });
Console.WriteLine("Done @"+DateTime.Now.AddHours(8).ToString("yyyy/MM/dd HH:mm:ss"));
private static void Check(Book book){
string url = "https://webpac.hcml.gov.tw/webpac/modules/WPSJReleaseListAjaxPage.do";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "application/x-www-form-urlencoded";
NameValueCollection postParams = HttpUtility.ParseQueryString(string.Empty);
postParams.Add("id", book.id);
postParams.Add("YNum", book.no);
byte[] byteArray = Encoding.UTF8.GetBytes(postParams.ToString());
using (Stream reqStream = request.GetRequestStream())
reqStream.Write(byteArray, 0, byteArray.Length);
using (WebResponse response = request.GetResponse())
using (StreamReader sr = new StreamReader(response.GetResponseStream(),Encoding.UTF8))
responseStr = sr.ReadToEnd();
if(responseStr.IndexOf("value=\"預約\"")>0) {
Console.WriteLine(string.Format("{0}:{1} is orderable! url=>https://webpac.hcml.gov.tw/webpac/bookDetail.jsp?id={2}", book.name, book.no, book.id));