Esempio n. 1
0
        private void ReBindRuleTable()
        {
            if (!string.IsNullOrEmpty(hfSelectedApproveNode.Value) || !string.IsNullOrEmpty(hfSelectedRequestNode.Value))
            {
                tApproveTable.Rows.Clear();

                //选择的审批节点
                ProcessRuleBLL          bll    = new ProcessRuleBLL();
                IList <ProcessNodeInfo> pnList = bll.GetApproveNodesByNodeIds(hfSelectedApproveNode.Value);

                //选择的申请节点
                IList <RequestNodeInfo> rnList = bll.GetRequestNodesByNodeIds(hfSelectedRequestNode.Value);

                if (pnList != null)
                {
                    TableRow trHead = new TableRow();

                    TableCell tcHeadFoodName = new TableCell();
                    TableCell tcHeadType     = new TableCell();


                    tcHeadFoodName.Text = "发起节点";
                    tcHeadType.Text     = "表达式";


                    trHead.Cells.Add(tcHeadFoodName);
                    trHead.Cells.Add(tcHeadType);

                    trHead.HorizontalAlign = HorizontalAlign.Center;

                    trHead.Height = 30;

                    //循环创建列
                    foreach (ProcessNodeInfo info in pnList)
                    {
                        TableCell tdc = new TableCell();
                        tdc.Text = info.NodeName;
                        trHead.Cells.Add(tdc);
                    }

                    tApproveTable.Rows.Add(trHead);

                    int rowLoop = 0;
                    int colLoop = 1;

                    if (rnList != null)
                    {
                        //循环创建行
                        foreach (RequestNodeInfo info in rnList)
                        {
                            colLoop = 1;
                            ++rowLoop;
                            TableRow  tr  = new TableRow();
                            TableCell tc1 = new TableCell();
                            TableCell tc2 = new TableCell();

                            Label lb1 = new Label();
                            lb1.ID   = info.NodeID.ToString();
                            lb1.Text = info.NodeName;

                            Label lb2 = new Label();
                            lb2.ID   = info.NodeID.ToString() + "_2";
                            lb2.Text = info.Expression;

                            tc1.Controls.Add(lb1);
                            tr.Cells.Add(tc1);
                            tc2.Controls.Add(lb2);
                            tr.Cells.Add(tc2);

                            //添加CheckBox
                            foreach (ProcessNodeInfo pn in pnList)
                            {
                                ++colLoop;
                                TableCell tc = new TableCell();
                                CheckBox  cb = new CheckBox();
                                cb.ID = "cbApprove" + rowLoop + colLoop;
                                cb.Attributes.Add("RID", info.NodeID.ToString());
                                cb.Attributes.Add("PID", pn.NodeID.ToString());
                                cb.Attributes.Add("onclick", "checkNode(this,'" + info.NodeID.ToString() + "','" + pn.NodeID.ToString() + "')");

                                cb.Checked = bll.GetIsApproveByNodeIDs(info.NodeID.ToString(), pn.NodeID.ToString(), ddlGroup.SelectedValue);
                                if (cb.Checked)
                                {
                                    hfSelectedCheckBox.Value += info.NodeID.ToString() + ";" + pn.NodeID.ToString() + ";";
                                }
                                tc.Controls.Add(cb);
                                tr.Cells.Add(tc);
                            }
                            tApproveTable.Rows.Add(tr);
                        }
                    }
                }
            }
        }