protected void Rebind()
    {
        DataSet dtWorkingPlaceName = WorkUnitInfoEx.SelectAllWorkUnitName();

        GridviewWorkingPlace.DataSource = dtWorkingPlaceName;
        GridviewWorkingPlace.DataBind();
    }
    protected void bt_AddWorkingPlace_Click(object sender, EventArgs e)
    {
        string WorkPlaceName = txtWorkingPlaceName.Text.ToString();

        if (!WorkUnitInfoEx.AddWorkUnitName(WorkPlaceName))
        {
            ERRORMessage.Text = "添加失败!";
            return;
        }
        Rebind();
    }
    protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int    index    = e.RowIndex;
        String SelectId = GridviewWorkingPlace.DataKeys[index].Value.ToString().Trim();

        if (!WorkUnitInfoEx.DeleteWorkUnitName(SelectId))
        {
            ERRORMessage.Text = "删除失败!";
            return;
        }
        Rebind();
    }
Beispiel #4
0
    protected void ControlInitalize()
    {
        DataSet dtDepartmentName = DepartmentInfoEx.SelectAllDepartName();

        for (int i = 0; i != dtDepartmentName.Tables[0].Rows.Count; i++)
        {
            ListItem ItemDepartmentName = new ListItem();
            ItemDepartmentName.Value = dtDepartmentName.Tables[0].Rows[i][0].ToString();
            ItemDepartmentName.Text  = dtDepartmentName.Tables[0].Rows[i][1].ToString();
            DropDownListDepartment.Items.Add(ItemDepartmentName);
        }

        DataSet dtWorkUnitName = WorkUnitInfoEx.SelectAllWorkUnitName();

        for (int i = 0; i != dtWorkUnitName.Tables[0].Rows.Count; i++)
        {
            ListItem ItemWorkUntiName = new ListItem();
            ItemWorkUntiName.Value = dtWorkUnitName.Tables[0].Rows[i][0].ToString();
            ItemWorkUntiName.Text  = dtWorkUnitName.Tables[0].Rows[i][1].ToString();
            DropDownListWorkUnit.Items.Add(ItemWorkUntiName);
        }
    }