void Login_Show() { // Login Show begin // Login Open Event begin // Login Open Event end // Login BeforeShow Event begin // Login BeforeShow Event end if (Login_logged) { // User logged in Login_login.Text = "退出"; Login_password.Visible = false; Login_reset.Visible = false; //Login_trname.Visible = false; //Login_labelname.Visible = true; Login_name.Text = Utility.Dlookup("members", "member_login", "member_id=" + Session["UserID"]); } else { // User is not logged in Login_login.Text = "登陆"; Login_password.Visible = true; Login_reset.Visible = true; //Login_trname.Visible = true; //Login_labelname.Visible = false; } }
private void BindGrid() { DataView MyDv; string sWhere = ""; string sSel = Utility.GetParam("paID"); sTable = Utility.Dlookup("bm_bm", "tableName", "id=" + sSel);//("CarBarn", "count(*)", sExist); f1 = Utility.Dlookup("bm_bm", "f1", "id=" + sSel); f2 = Utility.Dlookup("bm_bm", "f2", "id=" + sSel); f1.Trim(); f2.Trim(); sTable.Trim(); String strsql; DataSet myDs; strsql = "select " + f1 + " as id," + f2 + " as Name " + " from " + sTable; //strsql="select top 10 meterReading.mrID,meterReading.mrYear from MeterReading order by sales DESC"; strsql += sWhere; myDs = Utility.ExecuteSql4Ds(strsql); MyDv = myDs.Tables[0].DefaultView; if (!object.Equals(ViewState["Sort"], null)) { MyDv.Sort = ViewState["Sort"].ToString(); } DataGrid1.DataSource = MyDv; if (!object.Equals(ViewState["Page"], null)) { DataGrid1.CurrentPageIndex = int.Parse(ViewState["Page"].ToString()); } try { DataGrid1.DataBind(); } catch { DataGrid1.CurrentPageIndex = DataGrid1.PageCount - 1; DataGrid1.DataBind(); } }
protected void Page_Show(object sender, EventArgs e) { Utility.buildListBox(ddlCell.Items, "select ID,Name from bm_Cell", "ID", "Name", null, ""); Utility.buildListBox(ddlSunny.Items, "select ID,Name from bm_Sunny", "ID", "Name", null, ""); Utility.buildListBox(ddlType.Items, "select ID,Name from bm_Indoor", "ID", "Name", null, ""); //楼名称 tbPaName.Text = Utility.Dlookup("pavilion", "Name", "paID=" + CCUtility.ToSQL(paID.Value, FieldTypes.Number)); tbPaName.Enabled = false; if (p_theID.Value.Length > 0) { string sWhere = ""; sWhere += "hoID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number); string sSQL = "select * from House where " + sWhere; SqlDataAdapter dsCommand = new SqlDataAdapter(sSQL, Utility.Connection); DataSet ds = new DataSet(); DataRow row; if (dsCommand.Fill(ds, 0, 1, "Table") > 0) { row = ds.Tables[0].Rows[0]; theID.Value = CCUtility.GetValue(row, "hoID"); paID.Value = CCUtility.GetValue(row, "paID"); tbRoom.Text = CCUtility.GetValue(row, "hoRoom"); tbLayer.Text = CCUtility.GetValue(row, "hoFloor"); tbArea.Text = CCUtility.GetValue(row, "hoArchArce"); tbArea2.Text = CCUtility.GetValue(row, "hoUseArce"); tbClientName.Text = CCUtility.GetValue(row, "Client_Name"); tbClientID.Text = CCUtility.GetValue(row, "CLIENT_CARD"); tbPhone.Text = CCUtility.GetValue(row, "CLIENT_PHONE"); tbClientCard.Text = CCUtility.GetValue(row, "CLIENT_ACCOUNT_NUMBER"); tbUseDate.Text = CCUtility.GetValue(row, "USE_DATE"); tbUnit.Text = CCUtility.GetValue(row, "COMPANY_NAME"); tbMemo.Text = CCUtility.GetValue(row, "Memo"); //类型 string s = CCUtility.GetValue(row, "indoorID"); try { ddlType.SelectedIndex = ddlType.Items.IndexOf(ddlType.Items.FindByValue(s)); } catch { } //单元 s = CCUtility.GetValue(row, "cellID"); try { ddlCell.SelectedIndex = ddlCell.Items.IndexOf(ddlCell.Items.FindByValue(s)); } catch { } //朝向 s = CCUtility.GetValue(row, "sunnyID"); try { ddlSunny.SelectedIndex = ddlSunny.Items.IndexOf(ddlSunny.Items.FindByValue(s)); } catch { } } } }