protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string idValue = Request.Params["id"];
         if (idValue != null)
         {
             int id = int.Parse(idValue);
             WFunctionStepBB functionStepBB = new WFunctionStepBB();
             try
             {
                 WFunctionStepData functionStepData = new WFunctionStepData();
                 functionStepData = functionStepBB.GetModel(id);
                 //����й��������˴�Ҫ��֤�Ƿ�����ɾ��
                 functionStepBB.DeleteRecord(id);
                 ClientScript.RegisterStartupScript(this.GetType(), "CloseSubmit", "CloseSubmit()", true);
             }
             catch (Exception ex)
             {
                 this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",4);", true);
                 return;
             }
             finally
             {
                 functionStepBB.Dispose();
             }
         }
     }
 }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        WFunctionStepData model = new WFunctionStepData();
        WFunctionStepBB functionStepBB = new WFunctionStepBB();
        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                this.IdValue = functionStepBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = functionStepBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                functionStepBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",4);", true);
            return;
        }
        finally
        {
            functionStepBB.Dispose();
        }

        this.ClientScript.RegisterStartupScript(this.GetType(), "CloseSubmit", "CloseSubmit()", true);
    }
 private void ShowInfo(int stepId)
 {
     WFunctionStepData functionStepData = new WFunctionStepData();
     WFunctionStepBB functionStepBB = new WFunctionStepBB();
     try
     {
         functionStepData = functionStepBB.GetModel(stepId);
         this.auditEmp.Text = functionStepData.doEmp;
         this.hidAuditEmp.Value = functionStepData.doEmp;
     }
     finally
     {
         functionStepBB.Dispose();
     }
 }
    ///// <summary>
    ///// �󶨲���
    ///// </summary>
    //private void BindDept()
    //{
    //    //treeview set
    //    this.deptTree.Nodes.Clear();
    //    this.deptTree.Font.Name = "����";
    //    this.deptTree.Font.Size = FontUnit.Parse("9");
    //    DataSet ds = new DataSet();
    //    HOrgnizationBB orgnizationBB = new HOrgnizationBB();
    //    try
    //    {
    //        //��ȡһ������
    //        ds = orgnizationBB.GetList("");
    //        DataRow[] drs = ds.Tables[0].Select("uppDepartId=0", "departId");//��ѡ�����и��ڵ�
    //        foreach (DataRow row in drs)
    //        {
    //            string departId = row["departId"].ToString();
    //            string departNm = row["departNm"].ToString();
    //            TreeNode rootNode = new TreeNode();
    //            rootNode.Text = departNm;
    //            rootNode.Value = departId;
    //            //rootNode.NavigateUrl = "#";
    //            rootNode.Expanded = true;
    //            //rootNode.ImageUrl = imageurl;
    //            rootNode.SelectAction = TreeNodeSelectAction.Expand;
    //            this.deptTree.Nodes.Add(rootNode);
    //            this.CreateDeptNode(int.Parse(departId), rootNode, ds.Tables[0]);
    //        }
    //    }
    //    finally
    //    {
    //        orgnizationBB.Dispose();
    //    }
    //}
    ////�����ڵ�
    //private void CreateDeptNode(int uppDepartId, TreeNode parentNode, DataTable dt)
    //{
    //    DataRow[] drs = dt.Select("uppDepartId=" + uppDepartId, "departId");//ѡ�������ӽڵ�
    //    foreach (DataRow row in drs)
    //    {
    //        string departId = row["departId"].ToString();
    //        string departNm = row["departNm"].ToString();
    //        TreeNode node = new TreeNode();
    //        node.Text = departNm;
    //        node.Value = departId;
    //        //node.NavigateUrl = "#";
    //        //node.ImageUrl = imageurl;
    //        node.Expanded = true;
    //        node.SelectAction = TreeNodeSelectAction.Expand;
    //        if (parentNode == null)
    //        {
    //            this.deptTree.Nodes.Clear();
    //            parentNode = new TreeNode();
    //            this.deptTree.Nodes.Add(parentNode);
    //        }
    //        parentNode.ChildNodes.Add(node);
    //        this.CreateDeptNode(int.Parse(departId), node, dt);
    //    }
    //}
    ///// <summary>
    ///// ����Ա
    ///// </summary>
    //private void BindEmp()
    //{
    //    //treeview set
    //    this.empTree.Nodes.Clear();
    //    this.empTree.Font.Name = "����";
    //    this.empTree.Font.Size = FontUnit.Parse("9");
    //    DataSet ds = new DataSet();
    //    HEemployeeBB eemployeeBB = new HEemployeeBB();
    //    try
    //    {
    //        string deptId = this.deptTree.SelectedValue;
    //        if (deptId == "")
    //        {
    //            deptId = this.deptTree.Nodes[0].Value;
    //        }
    //        ds = eemployeeBB.GetList(" nowDepartId='" + deptId + "'");
    //        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    //        {
    //            DataRow row = ds.Tables[0].Rows[i];
    //            string empId = row["empId"].ToString();
    //            string empNm = row["empNm"].ToString();
    //            TreeNode rootNode = new TreeNode();
    //            rootNode.Text = empNm;
    //            rootNode.Value = empId;
    //            rootNode.NavigateUrl = "#";
    //            rootNode.Expanded = true;
    //            //rootNode.ImageUrl = imageurl;
    //            rootNode.SelectAction = TreeNodeSelectAction.Expand;
    //            this.empTree.Nodes.Add(rootNode);
    //            //this.CreateNode(framename, int.Parse(nodeId), rootNode, dt);
    //        }
    //    }
    //    finally
    //    {
    //        eemployeeBB.Dispose();
    //    }
    //}
    ///// <summary>
    ///// �󶨽�ɫ
    ///// </summary>
    //private void BindRole()
    //{
    //    //treeview set
    //    this.roleTree.Nodes.Clear();
    //    this.roleTree.Font.Name = "����";
    //    this.roleTree.Font.Size = FontUnit.Parse("9");
    //    DataSet ds = new DataSet();
    //    PRoleBB roleBB = new PRoleBB();
    //    try
    //    {
    //        ds = roleBB.GetList("");
    //        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    //        {
    //            DataRow row = ds.Tables[0].Rows[i];
    //            string roleId = row["id"].ToString();
    //            string roleNm = row["roleName"].ToString();
    //            TreeNode rootNode = new TreeNode();
    //            rootNode.Text = roleNm;
    //            rootNode.Value = roleId;
    //            //rootNode.NavigateUrl = "#";
    //            //rootNode.Expanded = true;
    //            //rootNode.ImageUrl = imageurl;
    //            //rootNode.SelectAction = TreeNodeSelectAction.Expand;
    //            this.roleTree.Nodes.Add(rootNode);
    //        }
    //    }
    //    finally
    //    {
    //        roleBB.Dispose();
    //    }
    //}
    protected void btnSave_Click(object sender, EventArgs e)
    {
        WFunctionStepData functionStepData = new WFunctionStepData();
        WFunctionStepBB functionStepBB = new WFunctionStepBB();
        try
        {
            functionStepData = functionStepBB.GetModel(this.IdValue);
            functionStepData.doEmp = this.hidAuditEmp.Value;
            functionStepBB.ModifyRecord(functionStepData);
        }
        finally
        {
            functionStepBB.Dispose();
        }

        this.ClientScript.RegisterStartupScript(this.GetType(), "close", "close()", true);
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             this.IdValue = Convert.ToInt32(Request.Params["id"]);
             this.stepId.Value = this.IdValue.ToString();
         }
         if (Request.Params["state"] != null && Request.Params["state"].Trim() != string.Empty)
         {
             this.State = Request.Params["state"].ToString();
             switch (this.State)
             {
                 case "1":   //add
                     if (Request.Params["functionNo"] != null && Request.Params["functionNo"].Trim() != "")
                     {
                         this.functionNo.Text = Request.Params["functionNo"].ToString();
                     }
                     break;
                 case "2":   //update
                     //���ؿؼ�
                     WFunctionStepBB functionStepBB = new WFunctionStepBB();
                     WFunctionStepData functionStepData = new WFunctionStepData();
                     try
                     {
                         functionStepData = functionStepBB.GetModel(this.IdValue);
                         //����й��������˴�Ҫ��֤�Ƿ������޸�
                         this.ShowInfo(this.IdValue);
                     }
                     finally
                     {
                         functionStepBB.Dispose();
                     }
                     break;
                 default:
                     break;
             }
         }
     }
 }