示例#1
0
    protected void repeatControl_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView drv = e.Item.DataItem as DataRowView;

        if (drv == null)
        {
            return;
        }
        //签核、驳回按钮
        ImageButton cmd;

        if (this.rdoUnapprove.Checked)
        {
            HtmlInputCheckBox chk = e.Item.FindControl("checkbox") as HtmlInputCheckBox;
            chk.Visible = true;
            cmd         = e.Item.FindControl("cmdPass") as ImageButton;
            cmd.Visible = true;
            cmd.Attributes["onclick"] = "noteForm(1, " + Cast.Int(drv["ApproveResultID"]).ToString() + ");return false;";
            cmd         = e.Item.FindControl("cmdReject") as ImageButton;
            cmd.Visible = true;
            cmd.Attributes["onclick"] = "noteForm(2, " + Cast.Int(drv["ApproveResultID"]).ToString() + ");return false;";
        }
        else
        {
            HtmlInputCheckBox chk = e.Item.FindControl("checkbox") as HtmlInputCheckBox;
            chk.Visible = false;
            cmd         = e.Item.FindControl("cmdPass") as ImageButton;
            cmd.Visible = false;
            cmd         = e.Item.FindControl("cmdReject") as ImageButton;
            cmd.Visible = false;
        }
        //查看单据详细信息
        HtmlAnchor cmdView = e.Item.FindControl("cmdView") as HtmlAnchor;
        string     viewUrl = Cast.String(drv["ViewURL"], "").Trim();

        if (viewUrl.Length <= 0)
        {
            cmdView.HRef = "javascript:alert('该类型的单据没有设置查看页面,请和管理员联系');";
        }
        else
        {
            string ot  = Cast.String(drv["OrderTypeCode"]).Trim();
            string url = WebUtil.AppendParam(viewUrl, "ordNum", Cast.String(drv["OrderNumber"]));
            if (ot == StockInHead.ORD_TYPE_PRD_IN || ot == StockInHead.ORD_TYPE_PRD_OUT)
            {
                url = WebUtil.AppendParam(url, "m", "sp");
            }
            cmdView.HRef = "javascript:viewOrder('" + url + "');";
        }
        //查看签核历史记录
        cmd = e.Item.FindControl("cmdNote") as ImageButton;
        if (cmd != null)
        {
            cmd.Attributes.Add("ordNum", Cast.String(drv["OrderNumber"]));
            cmd.Attributes.Add("onclick", "showTips(this);");
        }
        //状态文本
        ApproveStatus status = Cast.Enum <ApproveStatus>(drv["Status"]);
        Label         lbl    = e.Item.FindControl("lblStatus") as Label;

        switch (status)
        {
        case ApproveStatus.Approve:
            lbl.Text      = "通过";
            lbl.ForeColor = System.Drawing.Color.Blue;
            break;

        case ApproveStatus.UnApprove:
            lbl.Text      = "签核中";
            lbl.ForeColor = System.Drawing.Color.Red;
            break;

        case ApproveStatus.Reject:
            lbl.Text      = "驳回";
            lbl.ForeColor = System.Drawing.Color.DarkGray;
            break;
        }
    }