79 lines
1.8 KiB
C#
79 lines
1.8 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.OleDb;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Configuration;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using static TreeView;
|
|
|
|
public partial class admin_news_index : MyWeb.config
|
|
{
|
|
private Model.ezEntities _db = new Model.ezEntities();
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
|
|
BuildKind();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#region 分類
|
|
|
|
|
|
|
|
public void BuildKind()
|
|
{
|
|
s_kind.Items.Clear();
|
|
s_kind.Items.Add(new ListItem("請選擇", ""));
|
|
|
|
//buildMultiKind(s_kind, "news_kind", 0, "", 1, Model.news.KindLevelMax);
|
|
var qry1 = new TreeView().get_data2(_db.news_kind.Select(o => new TreeItem()
|
|
{
|
|
kind = o.kind,
|
|
num = o.num,
|
|
root = o.root,
|
|
range = o.range,
|
|
}).OrderBy(x => x.root).ThenBy(x => x.kind).ToList(), 0, 0);
|
|
if (qry1.Count() > 0)
|
|
foreach (var qq in qry1)
|
|
s_kind.Items.Add(new ListItem(new TreeView().RptDash(qq.Level) + qq.kind, qq.num.ToString()));
|
|
|
|
|
|
//活動
|
|
s_activity_num.Items.Clear();
|
|
s_activity_num.Items.Add(new ListItem("請選擇", ""));
|
|
var qry2 = _db.activities.AsEnumerable();
|
|
qry2 = qry2.OrderByDescending(o => o.num).ToList();
|
|
if (qry2.Count() > 0)
|
|
foreach (var qq in qry2)
|
|
s_activity_num.Items.Add(new ListItem(qq.subject, qq.num.ToString()));
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 匯出Excel
|
|
|
|
protected void excel_Click(object sender, EventArgs e)
|
|
{
|
|
//請參考訂單系統的匯出
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
} |