protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { Response.Redirect("~/Login.aspx"); } SqlConnection con = new SqlConnection( WebConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString); con.Open(); string query = "select privilege from EMPLOYEE where employeeID = " + Session["user"]; SqlCommand cmd = new SqlCommand(query, con); if (Convert.ToInt32(cmd.ExecuteScalar()) == 0) { Response.Redirect("~/Login.aspx"); } con.Close(); if (!IsPostBack) { con = new SqlConnection( WebConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString); con.Open(); query = "select Dept_number, Dept_name from DEPARTMENT"; cmd = new SqlCommand(query, con); DepartmentList.DataSource = cmd.ExecuteReader(); DepartmentList.DataBind(); ListItem defaultDept = new ListItem("Select department", "-1"); DepartmentList.Items.Insert(0, defaultDept); con.Close(); } }
void BindDepartment() { Doctors o = new Doctors(); DataSet ds = o.getDepartment(); DepartmentList.DataSource = ds; DepartmentList.DataTextField = "ShortName"; DepartmentList.DataValueField = "Id"; DepartmentList.DataBind(); DepartmentList.Items.Insert(0, "Select"); }
protected void Bind() { List <Model.Department> list = BLL.DepartmentBLL.GetDepartmentList(); list.Insert(0, new Model.Department() { ID = -1, Name = "==请选择部门===" }); DepartmentList.DataSource = list; DepartmentList.DataTextField = "Name"; DepartmentList.DataValueField = "Id"; DepartmentList.DataBind(); }
void BindDepartment() { Doctors o = new Doctors(); DataSet ds = o.getDepartment(); DepartmentList.DataSource = ds; DepartmentList.DataTextField = "ShortName"; DepartmentList.DataValueField = "Id"; DepartmentList.DataBind(); DepartmentList.Items.Insert(0, "Select"); foreach (ListItem _listItem in this.DepartmentList.Items) { _listItem.Attributes.Add("title", _listItem.Text); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TableRows.Clear(); SqlConnection con = new SqlConnection( WebConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString); con.Open(); string query = "select Dept_number, Dept_name from DEPARTMENT"; SqlCommand cmd = new SqlCommand(query, con); DepartmentList.DataSource = cmd.ExecuteReader(); DepartmentList.DataBind(); ListItem defaultDept = new ListItem("Select department", "-1"); DepartmentList.Items.Insert(0, defaultDept); con.Close(); } //EmployeeLbl.Text = Session["user"].ToString(); //CustomerLbl.Text = ; //InvLbl.Text =; StockTxt.ReadOnly = true; StockTxt.BackColor = System.Drawing.SystemColors.Window; TableRow tRow = new TableRow(); Table1.Rows.Add(tRow); TableCell tCell0 = new TableCell(); tCell0.Text = "Product_ID"; tRow.Cells.Add(tCell0); TableCell tCell1 = new TableCell(); tCell1.Text = "Item name"; tRow.Cells.Add(tCell1); TableCell tCell2 = new TableCell(); tCell2.Text = "Unit Price"; tRow.Cells.Add(tCell2); TableCell tCell3 = new TableCell(); tCell3.Text = "Quantity"; tRow.Cells.Add(tCell3); TableCell tCell4 = new TableCell(); tCell4.Text = "Sub-Total"; tRow.Cells.Add(tCell4); }
protected void DataPagerDepartment_PreRender(object sender, EventArgs e) { DepartmentList.DataSource = _dm.GetDepartments(); DepartmentList.DataBind(); }
protected void LoadDepartmentList() { DepartmentList.DataSource = _dm.GetDepartments(); DepartmentList.DataBind(); }