Esempio n. 1
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        ZcspBU      bu1 = new ZcspBU();
        DataRowView dv  = e.Row.DataItem as DataRowView;

        if (dv != null)
        {
            DataRow dr = dv.Row;

            //设置档案号
            HyperLink link2 = e.Row.FindControl("Link2") as HyperLink;
            if (link2 != null)
            {
                if (dr["zcid"].ToString().Trim() != String.Empty)
                {
                    link2.NavigateUrl = "~/ZcMng2/ZcDetail1.aspx?id=" + dr["zcid"].ToString();
                    link2.ToolTip     = "浏览资产的详细情况";
                }

                if (dr["zcbid"].ToString().Trim() != String.Empty)
                {
                    link2.NavigateUrl = "~/ZcMng2/ZcBaoDetail1.aspx?id=" + dr["zcbid"].ToString();
                    link2.ToolTip     = "浏览资产包的详细情况";
                }
                link2.Target = "_blank";

                String num = dr["num2"].ToString().Trim();
                if (num == String.Empty)
                {
                    num = "无编号";
                }
                link2.Text = num;
            }

            //设置项目名称
            //设置资产处置链接的地址
            HyperLink link1 = e.Row.FindControl("Link1") as HyperLink;
            if (link1 != null)
            {
                if (dr["id"].ToString().Trim() != String.Empty)
                {
                    link1.NavigateUrl = "EditSbb.aspx?id=" + dr["id"].ToString();
                }
                link1.Text   = JSJ.SysFrame.Util.GetMaxLenth(dr["xmmc"].ToString(), 20);
                link1.Target = "_blank";
            }

            //计算本金
            String temp = null;
            Label  lab1 = e.Row.FindControl("benjin") as Label;
            if (lab1 != null)
            {
                temp = dr["benjin"].ToString().Replace(",", "");
                if (String.IsNullOrEmpty(temp))
                {
                    temp = "0";
                }
                lab1.Text = double.Parse(temp).ToString("n");
            }

            //计算利息
            lab1 = e.Row.FindControl("lixi") as Label;
            if (lab1 != null)
            {
                temp = dr["lixi"].ToString().Replace(",", "");
                if (String.IsNullOrEmpty(temp))
                {
                    temp = "0";
                }
                lab1.Text = double.Parse(temp).ToString("n");
            }

            //计算总额
            lab1 = e.Row.FindControl("zqce") as Label;
            if (lab1 != null)
            {
                temp = dr["zqce"].ToString().Replace(",", "");
                if (String.IsNullOrEmpty(temp))
                {
                    temp = "0";
                }
                lab1.Text = double.Parse(temp).ToString("n");
            }

            //审批状态
            lab1 = e.Row.FindControl("spstatus") as Label;
            if (lab1 != null && dr["id"].ToString().Trim() != String.Empty)
            {
                int status1 = bu1.GetShenPiStatus(dr["id"].ToString());

                if (status1 == -1)
                {
                    lab1.Text = "<span title='未启动审批'>□</span>";
                }
                if (status1 == 0)
                {
                    lab1.Text = "<span title='审批中'><font color='blue'>○</font></span>";
                }
                if (status1 == 1)
                {
                    lab1.Text = "<span title='审核委员会批'><font color='Red'>☆</font></span>";
                }
                if (status1 == 2)
                {
                    lab1.Text = "<span title='决策委员会批'><font color='Red'>☆☆</font></span>";
                }
            }


            //执行状态
            lab1 = e.Row.FindControl("zxzt") as Label;
            if (lab1 != null)
            {
                if (dr["status1"].ToString().Trim() != String.Empty)
                {
                    temp = dr["status1"].ToString() + "-" + dr["status2"].ToString();
                }
                else
                {
                    temp = "&nbsp;";
                }
                lab1.Text = temp;
            }

            lab1 = e.Row.FindControl("zcid") as Label;
            if (lab1 != null)
            {
                lab1.Text = dr["zcid"].ToString().Trim();
            }

            lab1 = e.Row.FindControl("zcbid") as Label;
            if (lab1 != null)
            {
                lab1.Text = dr["zcbid"].ToString().Trim();
            }
        }
    }
Esempio n. 2
0
    //调整数据的变化
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataRowView dv = e.Row.DataItem as DataRowView;

        if (dv != null)
        {
            DataRow dr   = dv.Row;
            String  czid = dr["id"].ToString();

            //设置资产(或资产包)的类别
            int    col1   = 8; //表示状态
            String spkind = dr["zcbid"].ToString().Trim();
            if (spkind == String.Empty)
            {
                e.Row.Cells[col1].Text = "资产";
            }
            else
            {
                e.Row.Cells[col1].Text = "资产包";
            }

            ZcspBU spbu1   = new ZcspBU();     //设置资产审批BU类
            int    status1 = spbu1.GetShenPiStatus(czid);
            //设置资产处置的审批状态
            Label labsp = e.Row.FindControl("spstatus") as Label;
            if (labsp != null)
            {
                if (status1 == -1)
                {
                    labsp.Text = "<span title='未启动审批'>□</span>";
                }
                if (status1 == 0)
                {
                    labsp.Text = "<span title='审批中'><font color='blue'>○</font></span>";
                }
                if (status1 == 1)
                {
                    labsp.Text = "<span title='审核委员会批'><font color='Red'>☆</font></span>";
                }
                if (status1 == 2)
                {
                    labsp.Text = "<span title='决策委员会批'><font color='Red'>☆☆</font></span>";
                }
            }


            //计算会议时间
            Label lab1 = e.Row.FindControl("hysj") as Label;
            if (lab1 != null)
            {
                if (status1 == 1)
                {
                    lab1.Text = dr["hysj1"].ToString();
                }

                if (status1 == 2)
                {
                    lab1.Text = dr["hysj2"].ToString();
                }
            }

            //设置资产的执行状态
            Label lab2 = e.Row.FindControl("zxzt") as Label;
            if (lab2 != null)
            {
                if (dr["status1"].ToString().Trim() != String.Empty)
                {
                    lab2.Text = dr["status1"].ToString().Trim() + "-" + dr["status2"].ToString().Trim();
                }
            }

            //设置资产处置链接的地址
            HyperLink link1 = e.Row.FindControl("Link1") as HyperLink;
            if (link1 != null)
            {
                if (dr["id"].ToString().Trim() != String.Empty)
                {
                    link1.NavigateUrl = "EditSbb.aspx?id=" + dr["id"].ToString();
                }


                if (ViewState["MenuIndex"] != null)
                {
                    link1.NavigateUrl += "&menuIndex=" + ViewState["MenuIndex"].ToString();
                }
                link1.Text = dr["xmmc"].ToString();
            }


            //设置资产信息处置链接的地址
            HyperLink link2 = e.Row.FindControl("Link2") as HyperLink;
            if (link1 != null)
            {
                if (dr["zcid"].ToString().Trim() != String.Empty)
                {
                    link2.NavigateUrl = "~/ZcMng2/ZcDetail1.aspx?id=" + dr["zcid"].ToString();
                    link2.ToolTip     = "浏览资产的详细情况";
                }

                if (dr["zcbid"].ToString().Trim() != String.Empty)
                {
                    link2.NavigateUrl = "~/ZcMng2/ZcBaoDetail1.aspx?id=" + dr["zcbid"].ToString();
                    link2.ToolTip     = "浏览资产包的详细情况";
                }
                link2.Target = "_blank";

                String num = dr["num2"].ToString().Trim();
                if (num == String.Empty)
                {
                    num = "无编号";
                }
                link2.Text = num;
            }


            //设置删除的操作是否可用
            LinkButton button1 = e.Row.FindControl("button1") as LinkButton;
            if (button1 != null)
            {
                bool spFlag = this.GetSpCount(dr["id"].ToString());
                if (spFlag)
                {
                    button1.Visible = false;
                }
            }
        }
    }