protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.ddlArea.DataSource = WebApp.GetDatas("SELECT 行政區名,ID FROM 行政區 Order by ID"); this.ddlArea.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { string Sql = @"SELECT VEWTABLE3_1.* FROM VEWTABLE3_1"; this.gvData.DataSource = WebApp.GetDatas(Sql); this.gvData.DataBind(); ((MasterPage)this.Page.Master).IsAdminPage = true; }
protected void gvData_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { string AreaNum = this.gvData.Rows[e.NewSelectedIndex].Cells[1].Text; //id string SQL = "SELECT A.* FROM 行政區 A,R_機關資料_行政區 R WHERE A.ID = R.ID AND R.機關ID=" + AreaNum; this.GridView1.DataSource = WebApp.GetDatas(SQL); this.GridView1.DataBind(); this.DetailsView1.DefaultMode = DetailsViewMode.Insert; }
protected void Page_Load(object sender, EventArgs e) { string Sql = @"SELECT 行政區.縣市名||行政區.行政區名 行政區,COUNT(AREADATA.ID ) 土地筆數 FROM 行政區,AREADATA WHERE AREADATA.ID = 行政區.ID GROUP BY 行政區.ID ,行政區.行政區名,行政區.縣市名 ORDER BY 行政區.ID"; this.gvData.DataSource = WebApp.GetDatas(Sql); this.gvData.DataBind(); ((MasterPage)this.Page.Master).IsAdminPage = true; }
private void DataBind(int PageNum) { string sql = @" SELECT ID AS 行政區,行政區名,地號,地段號,地段名稱,所有者,異動時間 FROM ( SELECT t.* , rownum row_num FROM ( SELECT AREADATA.* ,行政區.行政區名 FROM AREADATA,行政區 WHERE AREADATA.ID = 行政區.ID ORDER BY 異動時間) t WHERE rownum <= {1} ) WHERE row_num >= {0}"; this.gvData.DataSource = WebApp.GetDatas(string.Format(sql, (PageNum - 1) * PageCount + 1, PageNum * PageCount + 1)); this.gvData.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.DataBind(1); BindPage(); } ((MasterPage)this.Page.Master).IsAdminPage = true; if (!IsPostBack) { this.ddlArea.DataSource = WebApp.GetDatas("SELECT 行政區名,ID FROM 行政區 order by id"); this.ddlArea.DataBind(); } }
/// <summary>【查詢】 /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> /// <Author>Wei-Ru.Hong</Author> protected void btnQuery_Click(object sender, EventArgs e) { string Area = this.ddlArea.SelectedValue; //行政區ID string Lot = this.ddlLot.SelectedValue; //地段號 string AreaNumb = this.ddlAreaNumb.SelectedValue; //地號 string SqlCmd = ""; SqlCmd = string.Format("SELECT 年度,價值 FROM 公告現值 WHERE 地段號={0} AND 地號={1}", Lot, AreaNumb); this.gvValues.DataSource = WebApp.GetDatas(SqlCmd); this.gvValues.DataBind(); SqlCmd = string.Format("SELECT D.類別 AS 機關,D.名稱,D.地址,D.聯絡資訊 FROM R_機關資料_行政區 R,機關資料 D WHERE R.機關ID=D.機關ID AND R.ID={0}", Area); this.gvOrgan.DataSource = WebApp.GetDatas(SqlCmd); this.gvOrgan.DataBind(); SqlCmd = "SELECT ROUND( AVG (價值),2) 價值 FROM 公告現值 V,AREADATA A WHERE V.地號 =A.地號 AND V.地段號 =A.地段號 AND A.ID = " + Area; lblResult.Text = string.Format("該行政區平均公告現值:{0}", WebApp.GetValue(SqlCmd)); }
protected void gvData_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { string SQL = "SELECT AREADATA.ID 行政區, AREADATA.*,行政區.行政區名 FROM AREADATA,行政區 WHERE AREADATA.ID = 行政區.ID AND 地號 ='{0}' AND 地段號='{1}' "; string AreaNum = this.gvData.Rows[e.NewSelectedIndex].Cells[3].Text; //地號 string Area = this.gvData.Rows[e.NewSelectedIndex].Cells[4].Text; //地段號 this.DetailsView1.DefaultMode = DetailsViewMode.Edit; SQL = string.Format(SQL, AreaNum, Area); this.DetailsView1.DataSource = WebApp.GetDatas(SQL); this.DetailsView1.DataBind(); this.DetailsView1.Visible = true; this.ddlLot.Visible = false; this.TextBox3.Visible = false; this.txtArea.Visible = false; this.ddlArea.Visible = false; this.DetailsView1.Visible = true; this.test.Visible = false; }
protected void ddlArea_SelectedIndexChanged(object sender, EventArgs e) { this.ddlLot.DataSource = WebApp.GetDatas("SELECT distinct 地段名稱, 地段號 FROM AREADATA WHERE ID= " + this.ddlArea.SelectedValue + " Order by 地段號"); this.ddlLot.DataBind(); }
/// <summary> [段] /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> /// <Author>Wei-Ru.Hong</Author> protected void ddlLot_SelectedIndexChanged(object sender, EventArgs e) { this.ddlAreaNumb.DataSource = WebApp.GetDatas("SELECT 地號 FROM AREADATA WHERE 地段號= " + this.ddlLot.SelectedValue + "Order by 地號"); this.ddlAreaNumb.DataBind(); }
public IList <Organ> GetDatas() { return(WebApp.GetDatas("SELECT * FROM 機關資料").ToList <Organ>()); }