オンライン投票システムの多くではなく、彼らと使いやすさで。だから私は個人的には、マイクロチャネルの投票システムを完了するのに時間がかかりました。
www.dukyun.com:私はちょうど例の行にコンクリートを見ることができます
開発環境:C#+のSQLServer
コンテンツページを投票、ランキング、ホームの投票:マイクロチャンネルモバイル端末票の開発はわずか3つのページが必要です。
効果はのようになります。
まず、我々はデータの最初のページを読む必要があり、次のように、キーコードは次のようになります。
protected override void LoadTemplateFile(string fileName)
{
BindCommData();
//开始加载栏目
string bid = Request.QueryString["bid"];//
if (!StringHelper.isNum(bid))
{
Response.Write("参数格式不正确!");
Response.End();
return;
}
string templatefile = "index.html";
if (!string.IsNullOrEmpty(bid))
{
DataRowView model = BLL.DataBaseHelper.instance.GetModelView("channel", "diyfileurl", "bid=" + bid);
if (model != null)
{
templatefile = model["diyfileurl"].ToString();//模板文件
}
}
string template = "default";
if (hs["template"] == null || hs["template"] == "")
{
throw new Exception("webconfig表缺少template参数");
}
else
{
template = hs["template"].ToString();
}
if (string.IsNullOrEmpty(templatefile))//判断是否设置了模板.
{
Response.Write("你还没有设置该栏目(编号为:" + bid + ",类型:封面模板)下的模板文件!请在后台栏目管理->高级->封面模板中设置.设置示例:index.html");
Response.End();
return;
}
string filename = Common.DataCache.GetCache("home_" + templatefile) as string;
if (filename == null)
{
filename = this.Server.MapPath("~/templets/" + template + "/" + templatefile);
Common.DataCache.SetCache("home_" + templatefile, filename);
}
base.LoadTemplateFile(filename);
}
これは主に、データ出力ASHXファイルテンプレートを読み込まれます。
次に、リストをお読みください。
protected override void LoadTemplateFile(string fileName)
{
BindCommData();
//开始加载栏目
string projectid = Request.QueryString["proid"];//
if (!StringHelper.isNum(projectid))
{
Response.Write("参数格式不正确!");
Response.End();
return;
}
string templatefile = "top.html";
string templatefolder = string.Empty;
if (!string.IsNullOrEmpty(projectid))
{
DataRowView model = BLL.DataBaseHelper.instance.GetModelView("u_voteproject", "*", "id=" + projectid);
if (model != null)
{
if (Convert.ToBoolean(model["islock"]) == true)
{
Response.Write("该活动已过期并被主办方删除,不再显示!");
Response.End();
return;
}
hs.Add("vote", model);
hs.Add("base", BaseWeb.BaseUrl + "/votetemplets/" + model["template_folder"] + "/");
templatefolder = model["template_folder"].ToString();
}
}
if (string.IsNullOrEmpty(templatefile))//判断是否设置了模板.
{
Response.Write("没有找到该项目(编号为:" + projectid + "的模版");
Response.End();
return;
}
string filename = Common.DataCache.GetCache("v_" + templatefile + "_" + projectid) as string;
if (filename == null)
{
filename = this.Server.MapPath("~/votetemplets/" + templatefolder + "/" + templatefile);
Common.DataCache.SetCache("v_" + templatefile + "_" + projectid, filename);
}
base.LoadTemplateFile(filename);
}
最後に、私たちは、ページの詳細な簡単な読書の投票を実現します。
必要に応じて、私は自由なソースコードを提供することができた場合は、コメント領域にメールアドレスを残すことができます。