コード例 #1
0
    protected void tr_Position_Selected(object sender, MCSControls.MCSWebControls.SelectedEventArgs e)
    {
        if (tr_Position.SelectValue != "0")
        {
            string positions = "";
            if (cb_IncludeChild.Checked)
            {
                Org_PositionBLL pos = new Org_PositionBLL(int.Parse(tr_Position.SelectValue));
                positions = pos.GetAllChildPosition();
                if (positions != "")
                {
                    positions += ",";
                }
                positions += tr_Position.SelectValue;
            }
            else
            {
                positions = tr_Position.SelectValue;
            }

            DataTable dt = Org_StaffBLL.GetRealNameAndUserNameByPosition(positions);

            listAccount.Items.Clear();

            foreach (DataRow row in dt.Rows)
            {
                listAccount.Items.Add(new ListItem((string)row["UserName"] + "[" + (string)row["RealName"] + "]", (string)row["UserName"]));
            }
        }
    }
コード例 #2
0
    //protected void tbx_Name_TextChanged(object sender, EventArgs e)
    //{

    //}
    protected void bt_serch_Click(object sender, EventArgs e)
    {
        if (tr_Position.SelectedValue != "0")
        {
            string positions = "";
            if (cb_IncludeChild.Checked)
            {
                Org_PositionBLL pos = new Org_PositionBLL(int.Parse(tr_Position.SelectedValue));
                positions = pos.GetAllChildPosition();
                if (positions != "")
                {
                    positions += ",";
                }
                positions += tr_Position.SelectedValue;
            }
            else
            {
                positions = tr_Position.SelectedValue;
            }

            DataTable dt = Org_StaffBLL.GetRealNameAndUserNameByPosition(positions);
            dt.DefaultView.RowFilter = " RealName like '%" + tbx_Name.Text + "%' ";

            listAccount.Items.Clear();

            for (int i = 0; i < dt.DefaultView.Count; i++)
            {
                listAccount.Items.Add(new ListItem((string)dt.DefaultView[i]["UserName"] + "[" + (string)dt.DefaultView[i]["RealName"] + "]", (string)dt.DefaultView[i]["UserName"]));
            }
        }
    }
コード例 #3
0
    private void BindStaffList()
    {
        listAccount.Items.Clear();

        if (ddl_Position.SelectedValue != "0" || (ddl_Position.SelectedValue == "0" && tbx_Name.Text.Trim() != ""))
        {
            string positions = "";

            if (ddl_Position.SelectedValue == "0")
            {
                Org_PositionBLL pos = new Org_PositionBLL(1);
                positions = pos.GetAllChildPosition() + ",1";
            }
            else
            {
                if (cb_IncludeChild.Checked)
                {
                    Org_PositionBLL pos = new Org_PositionBLL(int.Parse(ddl_Position.SelectedValue));
                    positions = pos.GetAllChildPosition();
                    if (positions != "")
                    {
                        positions += ",";
                    }
                    positions += ddl_Position.SelectedValue;
                }
                else
                {
                    positions = ddl_Position.SelectedValue;
                }
            }

            DataTable dt = Org_StaffBLL.GetRealNameAndUserNameByPosition(positions);
            dt.DefaultView.RowFilter = " RealName like '%" + tbx_Name.Text + "%' ";

            for (int i = 0; i < dt.DefaultView.Count; i++)
            {
                listAccount.Items.Add(new ListItem((string)dt.DefaultView[i]["RealName"], (string)dt.DefaultView[i]["UserName"]));
            }
        }
    }