예제 #1
0
        protected void gvPrice_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label  lblState  = e.Row.FindControl("lblState") as Label;
                Button btnSubmit = e.Row.FindControl("btnSubmit") as Button;


                if (!Convert.IsDBNull(gvPrice.DataKeys[e.Row.RowIndex].Value))
                {
                    int emid = Convert.ToInt32(Session["EmployeeId"]);
                    //绑定子GridView
                    GridView       gv     = e.Row.FindControl("GridView2") as GridView;
                    int            SaleId = Convert.ToInt32(gvPrice.DataKeys[e.Row.RowIndex].Value);
                    OfferPriceInfo pc     = new OfferPriceInfo(SaleId);
                    int            mainid = Convert.ToInt32(pc.MainOfferPriceId);


                    DataTable dt = OfferPriceInfo.getOfferPriceListOfApproves(emid, mainid);

                    if (dt.Rows.Count == 0)
                    {
                        dt.Rows.Add(dt.NewRow());
                        UI.BindCtrl(dt.DefaultView, gv, AspNetPager2);
                        gv.Rows[0].Visible = false;
                    }
                    else
                    {
                        UI.BindCtrl(dt.DefaultView, gv, AspNetPager2);
                    }


                    //button控制
                    if (pc.IsApprove == 1)
                    {
                        btnSubmit.Enabled = false;
                    }

                    if (pc.IsApprove == 0)
                    {
                        lblState.Text = "市场部:待审  总经办:待审";
                    }
                    else if (pc.IsApprove == 1 && pc.IsApply2 == 0)
                    {
                        if (pc.PreIsOver == 1)
                        {
                            lblState.Text = "市场部:通过  总经办:待审";
                        }
                        else
                        {
                            lblState.Text = "市场部:修正";
                        }
                    }
                    else if (pc.IsApply2 == 1)
                    {
                        if (pc.IsOver2 == 1)
                        {
                            lblState.Text = "市场部:通过  总经办:通过";
                        }
                        else
                        {
                            lblState.Text = "市场部:通过  总经办:修正";
                        }
                    }
                }

                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    //鼠标移动到每项时颜色交替效果
                    e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'");
                    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e");

                    //设置悬浮鼠标指针形状为"小手"
                    e.Row.Attributes["style"] = "Cursor:hand";
                }
            }
        }