protected void gvMain_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#EAF1FD',this.style.fontWeight='';");
         e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';");
         CaiNotRuView model = e.Row.DataItem as CaiNotRuView;
         System.Web.UI.WebControls.Label lblIsHanShui = e.Row.FindControl("lblIsHanShui") as System.Web.UI.WebControls.Label;
         if (lblIsHanShui != null)
         {
             lblIsHanShui.Text = model.IsHanShui == 1 ? "含税" : "不含税";
         }
         if (model.IsHanShui == 0)
         {
             e.Row.BackColor = System.Drawing.Color.LightGray;
         }
     }
 }
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public CaiNotRuView ReaderBind(IDataReader dataReader)
        {
            CaiNotRuView model = new CaiNotRuView();
            object       ojb;

            model.GoodTypeSmName = dataReader["GoodTypeSmName"].ToString();
            model.ProNo          = dataReader["ProNo"].ToString();
            model.PONo           = dataReader["PONo"].ToString();
            model.POName         = dataReader["POName"].ToString();
            ojb = dataReader["PODate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.PODate = (DateTime)ojb;
            }
            ojb = dataReader["POTotal"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.POTotal = (decimal)ojb;
            }
            ojb = dataReader["IsHanShui"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsHanShui = (int)ojb;
            }
            model.GuestName = dataReader["GuestName"].ToString();
            model.AE        = dataReader["AE"].ToString();
            model.GoodNo    = dataReader["GoodNo"].ToString();
            model.GoodName  = dataReader["GoodName"].ToString();
            model.GoodSpec  = dataReader["GoodSpec"].ToString();
            ojb             = dataReader["Num"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Num = (decimal)ojb;
            }
            ojb = dataReader["totalOrderNum"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.totalOrderNum = (decimal)ojb;
            }
            model.lastSupplier = dataReader["lastSupplier"].ToString();
            ojb = dataReader["lastPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.lastPrice = (decimal)ojb;
            }
            ojb = dataReader["POGoodSum"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.POGoodSum = (decimal)ojb;
            }
            ojb = dataReader["MinInHouseDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MinInHouseDate = (DateTime)ojb;
            }
            ojb = dataReader["InHouseSum"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.InHouseSum = (decimal)ojb;
            }
            ojb = dataReader["CaiGoodSum"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CaiGoodSum = (decimal)ojb;
            }
            ojb = dataReader["GoodNum"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.GoodNum = (decimal)ojb;
            }
            ojb = dataReader["GoodAvgPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.GoodAvgPrice = (decimal)ojb;
            }
            //decimal OrderCaiNum = 0;
            //ojb = dataReader["OrderCaiNum"];
            //if (ojb != null && ojb != DBNull.Value)
            //{
            //    OrderCaiNum = (decimal)ojb;
            //}
            if (model.POGoodSum != 0)
            {
                model.POGoodSum = model.POGoodSum - model.Num;
            }
            return(model);
        }